I am using function lmer() within package "lme4". Repeated-measures design with 4 time points, data is in long format. The time points are equidistant apart. Should I treat that variable as an integer, or coerce it to a factor for interpretation of the multilevel model?

As a factor gives me fixed effect estimates for each time point - but as an integer gives me one "time" effect.

Let me know if you need any more information!

  • 1
    $\begingroup$ This is a question only you can answer. If you represent time as a categorical variable, you're essentially saying that you expect each measurement to exhibit a unique characteristic, unrelated (in the time scale) to previous and future measurements. If you include it as integer, then you're saying that time has a monotonic and stable effect across measurements and, importantly, also across unmeasured periods (you can simply use t*coeff to see its effect between measurements). $\endgroup$ Dec 6, 2018 at 0:43
  • 1
    $\begingroup$ Also note that if you do think time has some stable but not necessarily monotonic effect, you can include a squared term (in principle you can include an arbitrary amount of higher order terms but you'd need to come up with a very good explanation for that and run the risk of overfitting). $\endgroup$ Dec 6, 2018 at 0:47

1 Answer 1


Treating time as a fixed effect when you have 4 time points is a good way to establish whether you have non-linearity in your data. In this case each time point has it's own contribution to the outcome.

If the relationship is close to linear then including time as numeric will save 2 degrees of freedom in the model, and will make the model easier to interpret in the sense that the (single) estimate for time is the overall (linear) trend. If there is some non-linearity then adding a quadratic term may improve the fit. With 4 time points it doesn't really make sense to fit a cubic term too, so a better model will be the one with time as a factor if a quadratic model does not fit well.

You can run models using both approaches and test them to see which fits the data best, but also bearing in mind the difference in interpretation. Ultimately it is a choice you have to make, and it does not have one-size-fits-all answer.


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.