Discussion:
[R-sig-ME] Additive random effects un lme
Matías Alejandro Castillo Moine
2018-09-19 17:33:35 UTC
Permalink
Hi everybody!

Additive random effects in lme


IŽm working with lme() R function. I want to fit the following model y=u+A+B+e (where y is the response variable, u the general mean, A and B two categorical variables, and e the error term) but using only u as an fixed effect (so A and B must to be random effects but with additive response). How I can specify this model in lme function?

At moment, I was found this manner:


lme(y~1, random= ~1|A/B, data)


But the problem is that, according to the documentation of nlme package, that sintaxis will to fit an nested model of B nested on A.


In my case y are several biometrics variables of a crop, A are environments and B are genotypes. The term e will to include the interaction between A and B. Also, the error term is spatially correlated (I use the correlation argument for clean this effect).


Thanks you for your help!


Best regards,


Matías A. Castillo Moine

[[alternative HTML version deleted]]
Ben Bolker
2018-09-20 01:46:39 UTC
Permalink
These are also called "crossed" random effects. lme can do them in a
limited and complex way -- the syntax is given somewhere in one of the
later chapters of the Pinheiro and Bates 2000 book [see
https://stackoverflow.com/questions/36342072/how-to-get-two-random-effects-crossed-with-one-nested-in-the-other-in-nlme
] but it's much easier with lme4::lmer (y ~ 1 + (1|A) + (1|B)). Do you
have a reason you have to stick with lme?
Post by Matías Alejandro Castillo Moine
Hi everybody!
Additive random effects in lme
I�m working with lme() R function. I want to fit the following model y=u+A+B+e (where y is the response variable, u the general mean, A and B two categorical variables, and e the error term) but using only u as an fixed effect (so A and B must to be random effects but with additive response). How I can specify this model in lme function?
lme(y~1, random= ~1|A/B, data)
But the problem is that, according to the documentation of nlme package, that sintaxis will to fit an nested model of B nested on A.
In my case y are several biometrics variables of a crop, A are environments and B are genotypes. The term e will to include the interaction between A and B. Also, the error term is spatially correlated (I use the correlation argument for clean this effect).
Thanks you for your help!
Best regards,
Mat�as A. Castillo Moine
[[alternative HTML version deleted]]
_______________________________________________
https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
Loading...