Skip to content
Prev 6342 / 20628 Next

MCMCglmm: correslation between variables two variables in repeated measure?

Jarrod Hadfield <j.hadfield at ...> writes:
I would say that lme would allow you to fit this model, something
like:

(1) "melt" your data (possibly using melt() from the reshape package
so that it is structured as

  subject time var value
   1       1    1   0.2342
   1       1    2   0.2
   1       2    1   0.3
   1       2    2   0.1
...

 etc.

 then you can model this in lme() via something like:

lme(value~(var-1),random=~var|subject/time,correlation=corAR1(~time|subject))

  (you should probably check for yourself that this makes sense ...)

  This only tests correlation within subjects -- I'm not sure how to think
about correlation within time, across subjects ...