# How to explain smoothing functions in the logistic regression model

I fitted a logistic regression model with some smoothing functions, and the software made beautiful plots for them. Here is one example: My main concern is that there is no reference level in the continuous variable, so converting the estimates by an exponential function to odds ratio seems not quite right for smoothing functions. Hence, I am wondering how to explain smoothing functions appropriately?

Here is a part of output of the above smoothing function:

age estimate  95% CI
18  0.802419 (0.708936, 0.90305)
19  0.744268 (0.666983, 0.823497)
20  0.688122 (0.625178, 0.755262)
21  0.634746 (0.57693, 0.69252)
22  0.584887 (0.530877, 0.638431)
23  0.538855 (0.485444, 0.589725)
24  0.496467 (0.44487, 0.550205)
25  0.457521 (0.405356, 0.511471)
26  0.421809 (0.370094, 0.47534)
27  0.389193 (0.340622, 0.441149)


Any suggestion will be appreciated!

• Unless I am misunderstanding your concern (always a possibility), it seems to me the lack of a reference level for Age is irrelevant. The odds ratio that the conversion of the estimates would put out is (probability of the event / (1-probability of the event)) where "event" is determined by the left hand side variable of your regression. All the smoothing function does is generate a smooth, but not necessarily linear, fit to the odds ratio (equivalent to generating a smooth but not necessarily linear fit to the probability.) There's no assumption about a reference Age in there. – jbowman Sep 9 '13 at 17:26

The reference age is the age that your function cuts the x-axis (around 67, maybe, by eyeballing your graph). Whatever, let's say that it is 67. The odds ratio is the odds of the event (probability of the event divided by one minus the probability of the event), given the person's age divided by the odds of the event given the age=67: \begin{equation} \frac{\frac{P\{E|age\}}{1-P\{E|age\}}}{\frac{P\{E|67\}}{1-P\{E|67\}}}= \frac{exp(f(age))}{exp(f(67))}=exp(f(age)) \end{equation} So, the odds ratio for an 18-year-old relative to a 67-year-old would be $exp(0.8)=2.22$, or the 18-year-old has odds of the event 222% as high as the 67-year-old.

If you don't want the reference age to be 67, then you can make it anything you like via subtraction. If you want the reference age to be 18, then just subtract 0.8 from the value of f(age) for every value of age. Then the odds ratio for a 27-year-old, compared to (now) an 18-year-old is $exp(0.39-0.80)=0.66$, or the 27-year-old has odds 66% as high as the 18-year-old to have the event.

• Your answer is exactly what I want. An additional question is, based on your statement, how to calculate a new confidence interval of a specific age when the reference age is 18-year-old?? I am not sure whether doing the same subtraction for 95% CI is reliable. – cchien Sep 9 '13 at 19:06
• @cchien That is a little harder. To make a 95% CI for the odds ratio with 18 as the reference, you need to find the variance (and thus the std error) of $exp(f(age)-f(18))$ for various values of age. It's a little complicated because $f$ is a random function. But, it can be done using either the delta method or using bootstrapping. The latter is usually easier. – Bill Sep 10 '13 at 12:15
• Ok. I will try bootstrapping first. Thank you for such a great help! – cchien Sep 11 '13 at 14:55

The best way to explain the smoothing model is probably to show a graph and explain it.

However, I do not fully share your admiration for the graph you show. A minor point is that there are too many tick marks on the x-axis. More importantly, there is no inherent meaning to f(age). How exactly I would graph this depends on how many independent variables you have, but I would have the Y axis represent some kind of probability (given that this is a logistic model).

As @jbowman commented (and +1 to him/her) there is no need for a reference category with a smoothed fit, any more than there is one for a linear fit: With continuous IVs there is no reference level.

• My educated guess: the tick marks on the x-axis represent the position of the cases with respect of age. – boscovich Sep 9 '13 at 19:31