[R-sig-ME] MCMCglmm: correslation between variables two variables in repeated measure?

Ben Bolker bbolker at gmail.com
Mon Jul 4 18:43:59 CEST 2011


Jarrod Hadfield <j.hadfield at ...> writes:

> 
> Hi,
> 
> Section 5.1 of the CourseNotes demonstrates how to fit such a model. A  
> limitation of MCMCglmm if there are >2 time points is that there will  
> probably be temporal auto-correlation which will not be accounted for  
> by simply fitting subject as a random effect.  ASReml would allow you  
> to include temporal auto-correlation if needed, and possibly lme.
> 
> Jarrod

  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 ...

> 
> Quoting Ndjido Ardo BAR <ndjido at ...> on Sun, 3 Jul 2011 13:31:05 +0200:
> 
> > Hi all,
> >
> > I'd like to test for correlation between two variables that represent
> > repeated measures (over time) on subjects of a follow-up. Test for
> > correlation is both within and accross subjects. The  first idea that hits
> > my mind is to use a bivariate model for exemple using MCMCglmm. I'd like to
> > know if this idea can lead to something correct.
> >
> > cheers,
> > Ardo.




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