[R-sig-ME] corAR1() structure in lme()
James Pustejovsky
jepu@to @end|ng |rom gm@||@com
Wed Feb 12 23:48:30 CET 2020
Hello,
I am writing some additional functionality for lme objects, and I have a
question about how lme() handles corAR1() structures. I noticed that
sometimes, if I specify a model with corAR1(), the fitted model has a
corStruct of class corARMA instead of (as you would expect) corAR1(). Here
are a few examples where this does and doesn't occur:
library(nlme)
data(Laski, package = "scdhlm")
Laski_AR1 <- lme(fixed = outcome ~ treatment,
random = ~ treatment | case,
correlation = corAR1(0.2, ~ time | case),
data = Laski)
inherits(Laski_AR1$modelStruct$corStruct, "corAR1") # TRUE
Laski_hetAR1 <- lme(fixed = outcome ~ treatment,
random = ~ treatment | case,
correlation = corAR1(0, ~ time | case),
weights = varIdent(form = ~ 1 | treatment),
data = Laski)
inherits(Laski_hetAR1$modelStruct$corStruct, "corAR1") # TRUE
data(egsingle, package = "mlmRev")
lme_2level <-
lme(fixed = math ~ year + female + black + hispanic,
random = ~ 1 | childid,
correlation = corAR1(0, ~ year | childid),
data = egsingle)
inherits(lme_2level$modelStruct$corStruct, "corAR1") # FALSE
lme_3level <-
lme(fixed = math ~ year + female + black + hispanic,
random = ~ 1 | schoolid/childid,
correlation = corAR1(0.1, ~ year | schoolid/childid),
data = egsingle)
inherits(lme_3level$modelStruct$corStruct, "corAR1") # FALSE
Does anyone have a sense of why the class of the fitted model's corStruct
is not consistent with the input class?
Thanks for any pointers!
Kind Regards,
James
[[alternative HTML version deleted]]
More information about the R-sig-mixed-models
mailing list