[R-sig-ME] corAR1() structure in lme()

Phillip Alday ph||||p@@|d@y @end|ng |rom mp|@n|
Mon Feb 17 11:48:06 CET 2020


I have no idea -- you may have to dig through the nlme source code to
find out (https://github.com/cran/nlme/tree/master/R). nlme is largely
in maintenance  mode at this point -- it's been 6 years since the last
commit, so even if this is undesired behavior (=bug), there may not be
much to be done about it unless you contribute the fix yourself. :(

From a higher-level perspective, Pinheiro and Bates (2000) may have some
insights into why this conversion is allowed (which admittedly is
different than why it is done). A quick search gives me this result on
page 236:

> As described in §5.3.1, the AR(1) model is equivalent to an ARMA(1, 0)
> model, so that the corARMA class can also be used to represent an corAR1
> object. However, the corAR1 methods are designed to take advantage of
> the particular structure of the AR(1) model, and are substantially more
> efficient than the corresponding corARMA methods.
Hope that helps,

Phillip


On 12/02/2020 23:48, James Pustejovsky wrote:
> 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]]
>
> _______________________________________________
> R-sig-mixed-models using 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