[R-sig-ME] Mixed-Effects Models with Group or Covariate-Dependent Autocorrelation
Viechtbauer Wolfgang (STAT)
wolfgang.viechtbauer at maastrichtuniversity.nl
Mon Dec 31 17:12:47 CET 2012
Dear Mike,
Thank you for the suggestion and the example. A latent growth model may indeed be a possibility, at least for the case where I want to let the autocorrelation differ between the two groups (instead of letting is depend smoothly on a covariate). I do have highly repeated measurements (40-60 obs per person), but that will just require a rather lengthy model statement. And I do have missingness, so I guess I have to switch to FIML to handle that.
Best,
Wolfgang
> -----Original Message-----
> From: r-sig-mixed-models-bounces at r-project.org [mailto:r-sig-mixed-models-
> bounces at r-project.org] On Behalf Of Mike Cheung
> Sent: Wednesday, December 26, 2012 05:01
> To: Mike Cheung
> Cc: r-sig-mixed-models at r-project.org
> Subject: Re: [R-sig-ME] Mixed-Effects Models with Group or Covariate-
> Dependent Autocorrelation
>
> Hi Wolfgang,
>
> One approach is to use latent growth model (SEM). The following sample
> code
> fits a model with AR(1) (labeled "c1" in the model). You may add a
> multiple-group analysis for groups A and B. Two models can be then
> fitted--one with the same AR(1) by using the same label, i.e., "c1", and
> another model with different AR(1) by using a different label, say "c2". A
> likelihood-ratio test may be used to compare these two models.
>
> Hope it helps.
>
> my.df <-
> structure(list(anti0 = c(2L, 1L, 0L, 1L, 2L, 3L, 5L, 0L, 0L,
> 4L, 2L, 2L, 4L, 1L, 0L, 3L, 1L, 0L, 1L, 1L), anti1 = c(5L, 2L,
> 1L, 0L, 3L, 2L, 0L, 0L, 0L, 2L, 2L, 3L, 3L, 1L, 3L, 5L, 0L, 0L,
> 0L, 3L), anti2 = c(1L, 1L, 1L, 2L, 2L, 3L, 5L, 0L, 0L, 2L, 0L,
> 6L, 3L, 0L, 4L, 0L, 3L, 2L, 1L, 3L), anti3 = c(5L, 1L, 2L, 4L,
> 2L, 4L, 3L, 0L, 1L, 2L, 0L, 5L, 2L, 1L, 1L, 0L, 0L, 0L, 0L, 2L
> )), .Names = c("anti0", "anti1", "anti2", "anti3"), row.names = c(134L,
> 76L, 145L, 83L, 53L, 12L, 21L, 177L, 151L, 152L, 96L, 91L, 132L,
> 198L, 38L, 160L, 101L, 37L, 197L, 31L), class = "data.frame")
>
> library("lavaan")
>
> my.model1 <- 'i =~ 1*anti0 + 1*anti1 + 1*anti2 + 1*anti3
> s =~ 0*anti0 + 1*anti1 + 2*anti2 + 3*anti3
> ## Equality on error variances
> anti0 ~~ sigma*anti0
> anti1 ~~ sigma*anti1
> anti2 ~~ sigma*anti2
> anti3 ~~ sigma*anti3
> ## AR(1): Note that c1 is covariance, not correlation
> anti0 ~~ c1*anti1
> anti1 ~~ c1*anti2
> anti2 ~~ c1*anti3'
>
> my.fit1 <- growth(my.model1, data=my.df)
> summary(my.fit1, fit.measures=TRUE)
>
> Cheers,
> Mike
>
> --
> ---------------------------------------------------------------------
> Mike W.L. Cheung Phone: (65) 6516-3702
> Department of Psychology Fax: (65) 6773-1843
> National University of Singapore
> http://courses.nus.edu.sg/course/psycwlm/internet/
> ---------------------------------------------------------------------
>
> On Wed, Dec 12, 2012 at 10:51 PM, Viechtbauer Wolfgang (STAT) <
> wolfgang.viechtbauer at maastrichtuniversity.nl> wrote:
>
> > Dear All,
> >
> > I am currently working with some mixed-effects models for longitudinal
> > data where I want to test hypotheses about the difference in the
> strength
> > of the autocorrelation between two groups. In particular, let's say I
> have
> > data of the form:
> >
> > person time group y
> > ----------------------------
> > 1 0 A <value>
> > 1 1 A <value>
> > 1 2 A <value>
> > ... ... ... ...
> > 2 0 A <value>
> > 2 1 A <value>
> > 2 2 A <value>
> > ... ... ... ...
> >
> > and I want to fit the model:
> >
> > y_ij = beta_0 + beta_1 time_ij + u_0i + u_1i time + e_ij,
> >
> > where i is the index for person, j is the index for time, u_0i ~ N(0,
> > tau^2_0) is a random effect for the intercepts, u_1i ~ N(0, tau^2_1) is
> a
> > random effect for the slopes, cov(u_0i, u_1i) = tau_01 is the covariance
> > between these two random effects, and now I want to fit an AR(1)
> structure
> > for the errors e_ij, where the autocorelation is rho_A for people from
> > group A and rho_B for people from group B. In principle, I may also want
> to
> > let the error variance to differ for the two groups (i.e., sigma^2_A and
> > sigma^2_B).
> >
> > In nlme, I can fit models with a common autocorrelation structure for
> the
> > two groups, with:
> >
> > lme(y ~ time, random = ~ time | person, correlation = corAR1(form = ~
> time
> > | person))
> >
> > but as far as I can tell, it is not possible to allow the
> autocorrelation
> > parameter to differ between the two groups.
> >
> > Does anybody know of a package/function that would allow fitting such a
> > model?
> >
> > Moreover, the groups are actually created by dichotomizing a continuous
> > measure. Ideally, I would like to fit a model, where rho depends on the
> > continuous measure directly. Or, to avoid issues related to rho having
> to
> > fall between -1 and 1, it would probably make more sense to assume that
> > f(rho) depends on that continuous measure, where f() is the arctanh
> > (inverse hyperbolic function or Fisher's r-to-z) transformation. Again,
> any
> > ideas on packages/functions that may handle such a model?
> >
> > Thanks in advance for any suggestions!
> >
> > Best,
> > Wolfgang
> >
> > --
> > Wolfgang Viechtbauer, Ph.D., Statistician
> > Department of Psychiatry and Psychology
> > School for Mental Health and Neuroscience
> > Faculty of Health, Medicine, and Life Sciences
> > Maastricht University, P.O. Box 616 (VIJV1)
> > 6200 MD Maastricht, The Netherlands
> > +31 (43) 388-4170 | http://www.wvbauer.com
> >
> > _______________________________________________
> > R-sig-mixed-models at r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
> >
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-mixed-models at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
More information about the R-sig-mixed-models
mailing list