[R-sig-ME] Please post to the listserv

Prathiba Natesan Batley pnb@t|ey @end|ng |rom gm@||@com
Thu Jan 26 21:23:45 CET 2023


John: You made my day!!! And in haste I typed in a f instead of an m in my
original message. Yes, it is a mixed effects model.

On Wed, Jan 25, 2023 at 6:21 PM John Fox <jfox using mcmaster.ca> wrote:

> Dear Prathiba,
>
> m2$modelStruct$corStruct is a fairly complex object, not a simple
> number. Try:
>
>         coef(m2$modelStruct$corStruct, unconstrained=FALSE)
>
> (By the way, I couldn't make sense of the sample dataset you said you
> supplied, so I couldn't check my answer. Also, your model is a mixed
> model, not a fixed-effects model -- there are random effects.)
>
> I hope this helps,
>   John
>
> --
> John Fox, Professor Emeritus
> McMaster University
> Hamilton, Ontario, Canada
> web: https://socialsciences.mcmaster.ca/jfox/
>
> On 2023-01-25 5:14 p.m., Prathiba Natesan Batley wrote:
> > Hello:
> > Could you please post the following to the listserv?
> >
> > I am in a bit of a pickle here. I tried running a fixed effects model
> with
> > autocorrelation on a very small dataset (single case design). My syntax
> > look like this:
> >    lm2 <- lme(y ~ 1 + treatment, random = ~1|pid, data = df, correlation
> =
> > corAR1())
> > I want to obtain the phi coefficient which I see is in
> > lm2$modelStruct$corStruct. But the moment I extract it and put it into a
> > matrix it stores a different value. In this case it should be -0.17 but
> is
> > stored as -0.35. Pls see below:
> >> lm.2$modelStruct$corStruct
> > Correlation structure of class corAR1 representing
> >         Phi
> > -0.1743846
> >
> >> cbind(1, lm.2$modelStruct$corStruct)
> >       [,1]       [,2]
> > [1,]    1 -0.3523706
> >
> > Here is a sample dataset and syntax
> >              d=.5
> >              ICC=.1
> >              m=6
> >              phi=0
> >              n=5
> >              rep=1
> >              df <- read.csv(paste0("data", d, "-", ICC, "-", phi, "-", m,
> > "-", n, "_", rep, ".csv"))
> > lm2 <- lme(y ~ 1 + treatment, random = ~1|pid, data = df, correlation =
> > corAR1())
> > phi.hps <- c(lm2[[1]][2]) #or lm2$modelStruct#corStruct
> > _______________________________________________
> > R-sig-mixed-models using r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>
>

	[[alternative HTML version deleted]]



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