[R-sig-ME] treating measurement occasions as a numerical or as a factor predictor

Ben Bolker bbolker at gmail.com
Sat Dec 12 20:03:19 CET 2015


On 15-12-12 11:48 AM, Rich Shepard wrote:
> On Sun, 13 Dec 2015, K Imran M wrote:
> 
>> I would like to ask a question about treating measurement occasions in a
>> longitudinal analysis specifically when using linear mixed model. In my
>> study, I have taken data on 3 separate occasions (at baseline, at 1 month
>> and at 3 months post baseline). I am not sure what is best approach treat
>> these measurement occasions in my analysis using lmer or lme functions.
>> Should I treat them as a numeric or as a factor variable. My feeling says
>> that I should treat such measurement occasions as a factor but I do not
>> have strong theoretical reasons for that.
> 
> Kamarul,
> 
>   What question do you want to answer with your data?
> 
> Rich
> 

   A few thoughts to consider:

* with only 3 measurement occasions you won't really be able to treat
them as a random effect (not enough distinct levels to estimate
among-occasion variance reliably)
* if you treat measurement occasion as numeric (i.e., a linear effect of
time) you will assume that the change per month is identical throughout
the observation period (i.e. you will expect 2 times as much change from
1 month to 3 months post baseline as from baseline to 1 month post baseline)
* if you treat measurement occasion as categorical (factor) you will
estimate 2 parameters for the effect of occasion rather than 1.  There
are various ways you can break this up, depending on the contrasts you
choose (default 'contr.treatment': baseline vs 1 month, baseline vs. 3
months.  MASS::contr.sdif() gives you successive differences, making the
variable an ordered factor gives you contr.poly() (linear, quadratic
contrasts) by default.

   I would *generally* say that you're not complicating the model
much/spending very many parameters(degrees of freedom) by using a
categorical rather than a numeric input for time, and otherwise you're
making a fairly strong assumption, so I would recommend categorical.

  Ben Bolker



More information about the R-sig-mixed-models mailing list