3
$\begingroup$

Age is a predictor variable among a few others (gender, weight and height) and my response is the log-odds of a certain disease (binomial glm).

My age data runs from 21 until 40. I am not sure whether to treat age as a continuous variable or as a factor with age groups: 21-25, 26-30, 31-35, 36-40.

Are there any plots which I can produce that can help determine which would be the better approach?

$\endgroup$
4
  • 1
    $\begingroup$ Binning a continuous covariate as you have described assumes that the linear predictor is relatively flat within bins. Depending on the effect age has on your outcome, this can lead to poorer fit than could otherwise be obtained. As a rule of thumb, age is always a continuous covariate in my models unless there is a good principled reason to bin the data. $\endgroup$ Feb 7, 2019 at 21:15
  • 1
    $\begingroup$ A manifesto for the never binners: madrury.github.io/jekyll/update/statistics/2017/08/04/… $\endgroup$ Feb 7, 2019 at 21:19
  • $\begingroup$ @MatthewDrury Very nice! Everyone should read that. I might have missed something, though: I cannot find a description of how your various methods determined their knots. It occurs to me that the "binning" (which is a zero-order spline with specified, regularly spaced knots) might have suffered relative to the other splines simply because of differences in the procedures used to determine the knots. What did you do to control for this possibility? $\endgroup$
    – whuber
    Feb 7, 2019 at 21:56
  • $\begingroup$ I'll have to review, but I believe they are just equally spaced throughout the range of the data. I'll check for sure after work. $\endgroup$ Feb 7, 2019 at 23:34

2 Answers 2

1
$\begingroup$

It depends on the context. For example if you are looking for the effect of age on children's height, it makes sense to look at it as a continuous ( integer) value. If you're looking for e.g. the effect of age on oncogenesis then it makes sense if you look at age groups. Young vs old, above 55 and below 55, ...

For your example, unless age is a confounder of a hidden factor such as for example being college grad or still a student ( risk factor for young adults STD infection), I'd bin my data into reasonable bin sizes.

$\endgroup$
5
  • $\begingroup$ Why would it make sense that the effect of age on oncogenesis is best captured by binning? Why would you bin in the OP's example? $\endgroup$ Feb 8, 2019 at 0:10
  • $\begingroup$ It's about effect size really. Unless you have a population wide study, it's practically impossible to estimate the effect of age on oncogenesis on year to year basis. I have researched on national metadata consisting of millions of responders over periods of over 20 years. There, I was able to find significant coefficients for age with no binning. "log-odds of a certain disease ", this is a population epi question. That's why I'd use binning. $\endgroup$
    – Theoden
    Feb 8, 2019 at 17:56
  • $\begingroup$ Estimating a seperate effect from each year to year would also be binning, just with single year bins. I would advocate treating the variable as a continuous measurement, so fitting a line (if appropriate), or using a more general approach like a natural cubic spline to measure a non-linear effect. $\endgroup$ Feb 8, 2019 at 18:43
  • $\begingroup$ Yes, but that's playing with semantics. You can also say age by days is also binning because it's binning by 24 hours. In my mind binning is a means for capturing the effect. $\endgroup$
    – Theoden
    Feb 8, 2019 at 20:35
  • $\begingroup$ I thought your comment implied that you are estimating a seperate effect for each individual year. It's how you treat the variable in the regression specification that's at stake. $\endgroup$ Feb 8, 2019 at 23:08
0
$\begingroup$

create some sort of distribution plot (boxplot, violin plot) with all of the ages shown discretely on the x axis. you can examine that to see if there are shifts in the mean, or in the variance. that would give you some idea on what kind of bins you could try. Then you can just try it out both ways.

Sometimes, there would be theoretical reasons to bin or not bin (or more generally, to leave as one continuous variable or to recode in some way). Take something like alcohol consumption. Here in the US the legal drinking age is 21-- there's probably a break point there. At 18 students go to college and there's probably a shift there too. So you would probably not want to use age strictly as a continuous variable if your response was alcohol consumption.

For a disease: the aging process that might change our probability of getting a disease doesn't usually happen in sudden shifts, therefore, I would tend to start with a continuous variable. However, the impact of age may not be strictly linear-- being one year older might matter more if you're 39 than if you're 22. So binning may still be something you need to try, or adding the square of the age or something like that.

$\endgroup$

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.