I am using binary logistic regression with a number of continuous and dummy predictors.

Is it OK to include a continuous predictor for age as well as dummy predictors based on age, such as "teen" and "senior citizen", or will doing so bias the model estimates? EDIT: The age distribution of the sample being analyzed begins with "teens" and ends with "seniors."

The reason I'd like to do this is because I believe age behaves nonlinearly for the model in question, but not in the typical accelerating or decelerating way that would be found by fitting a quadratic function. Instead, I believe the outcome is less likely for teens than non-teens, has a negative, linear relationship with age for adults, and is more likely for seniors than non-seniors. I think the simplest way to model this may be to include a continuous variable for age, a dummy variable for teen, and another dummy variable for senior. I believe there are more advanced ways of dealing with such effects, but I'm wondering if my relatively simple approach is appropriate because it would probably be easier for me to implement and interpret.

If my proposed model is OK, how exactly would I interpret the meaning of the odds ratios? I think I would interpret age as: each additional year of age increases/decreases the likelihood of the outcome by x%, controlling for whether those in the sample were teens or seniors. I further think this means that the odds ratio for age indicates the odds of increasing/decreasing the outcome for those in the adult age range only (i.e., not teens and not seniors). Is that correct?

I’m also unsure of the interpretation of the dummy variables. I think they would be interpreted simply as: being a teen (or senior) increases/decreases the likelihood of the outcome by x%, controlling for the effect of years of age.

Thanks for reading, and feel free to tell me I'm horribly off base :D


1 Answer 1


It is allowed (in principle) but it is probably not a good functional form

It is okay to do this in principle, so long as you are aware of what this means in terms of the meaning of the predictors in your model. You need to scrutinise whether this leads to a sensible relationship between age and your latent response variable. In principle it is allowable to use any functional form between your age variable and your latent response, but in practice you might get a functional form that is implausible. Let me give you some guidance on how to judge this.

Ordinarily, when we put a continuous age variable as a predictor in a logistic regression model, this means that we are proposing a linear relationship$^\dagger$ between age and the latent logistic response (i.e., the latent continuous response underlying the binary outcome). If you add binary predictors for particular age categories (e.g., teens, seniors, etc.) on top of this, then this means that the proposed relationship now allows "jumps" at the boundaries of those age categories. This means that you now have a piecewise linear function where the piecewise lines are parallel, but there are discontinuities due to jumps at the category boundaries.

Your proposal is a generalisation of the straight-line function and it is allowable as a model input in principle. However, while this type of proposed functional relationship between age and the latent logistic response is allowed, it has some obvious drawbacks that make it implausible in most cases --- particularly the lack of continuity. Ultimately, you need to decide whether or not it is sensible in the context of your problem to allow "jumps" in the effect of age at the category boundaries of your age groups. In most cases this it will be quite dubious to believe that becoming a teenager suddenly causes a jump in the latent response variable, so the type of model you a proposing is rarely going to be sensible.

A more sensible alternative to what you are proposing is to use a piecewise linear function that imposes a continuity requirement on age, but allows different slopes over different age categories (called a linear spline). (This is achieved by using interactions between the age variable and the dummy variables and imposing appropriate constraints on the parameters; full details of linear splines are outside the scope of the present answer.) This gives a reasonably flexible functional form for the age variable, allowing for differing effects in different stages of life, but also imposing a continuity requirement on the overall effect of age. While this is probably an improvement of your proposal, it is still a rather crude form for the relationship, and it would naturally lead to consideration of higher-order spline functions (e.g., a cubic spline) as a further refinement of the relationship. Ultimately, I think the line of thinking you are pursuing is likely to lead you to consider some kind of higher-order spline function for the age variable, with your age categories forming the intervals used for the splines (and their boundaries giving the x-values for the knots).

Regardless of what particular form you decide to use, it is important to interpret the effect of age holistically using all the model variables that are determined by age. Consequently, you wouldn't interpret the main age term or the dummy terms independently --- you would interpret them together as giving the overall effect of age on your latent logistic response.

$^\dagger$ Strictly speaking, this is an affine relationship if we include consideration of the intercept term. I will call it "linear" here as a shorthand for a straight-line function.

  • $\begingroup$ Fantastic explanation. Thank you very much! I neglected to include one piece of important information in the OP: the age distribution of the sample being analyzed begins with "teens" and ends with "seniors." Based on your explanation, this means that there will not be a jump at the beginning boundary for teens (because teens define the beginning boundary) nor at the ending boundary for seniors (because seniors define the ending boundary). However, there will still be jumps at the transitions from teen to non-teen and from non-senior to senior. $\endgroup$
    – stmp945
    May 21, 2022 at 18:48
  • $\begingroup$ Fitting splines functions to the model would definitely be an improvement. However, it sounds like you are saying that my proposed model with one continuous age variable and two dummies at the boundaries can be used if interpreted correctly and with the caveat that it is only a rough approximation of reality. Is that correct? I am thinking it may be OK to use the relatively simple proposed approach that has the benefit of being more easily interpreted by the immediate audience but that ultimately the more sophisticated approach of fitting splines to the model should be investigated. $\endgroup$
    – stmp945
    May 21, 2022 at 18:49
  • $\begingroup$ Well, at the risk of repetition, I am saying that you need to think about whether or not it is plausible that there would be jumps in the effect of age at the boundaries you mention (but also parallel effects aside from these jumps). $\endgroup$
    – Ben
    May 21, 2022 at 22:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.