Lurking variables and categorical variables
The relationship between two categorical variables, X and Y, can also be strongly influenced by a third lurking variable, Z.
When the direction of the relationship reverses, the effect is called Simpson's paradox. As with other 'paradoxes', there is no real contradiction; it just takes a bit more thought to understand why your initial intuition is wrong.
Smoking and survival
The marginal relationship between smoking and survival is misleading. The conditional relationships for different age groups are much more meaningful.
Graphical representation