[R-sig-ME] How does lmer treat a date.format (as.Date) variable?

Ben Bolker bbolker at gmail.com
Wed Nov 30 21:56:24 CET 2016

On 16-11-30 01:51 AM, Meytar Sorek-Hamer wrote:
> Dear R project team,
> I have been working for a while with lmer (lme4) and I have a question
> please. I don't fully understand yet how does lmer treat a random variable
> in a date format (as.Date).
> This is the model syntax:
> Y~X+(1+X|date)
> I compared model results based on the same dataset just each time (model) I
> changed the date variable format (i.e. as.factor, as.numeric, as.Date) and
> received different results, while the best results were obtained when the
> date was in a date.format.
> I would highly appreciate your clarification for the differences between
> the three formats in lmer.
> Thank you very much in advance

  This seems weird. lme4 will always attempt to convert the grouping
variable (date in your case) to a factor.  Can we have a (small!)
reproducible example please? (What do you mean by "best results" in this

  Ben Bolker

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