Dear list, I am faced with the following model: y=E+P+M+H+PxE+Error y is a response, E and P are factors with fixed effects. M is a random effect nested in P and H is a random effect nested in M. PxE is interaction of P and E. It seems that I should fit such a model with the lme function of library nlme, but I was not able to figure out from the help page how to specify the formula. In the nlme documentation, the term "nested" is always associated with a "grouping", and I do not know what my grouping is here. Can anybody tell me how this must be specified in a call of lme? Thanks, Christian *********************************************************************** Christian Hennig University of Hamburg, Faculty of Mathematics - SPST/ZMS (Schwerpunkt Mathematische Statistik und Stochastische Prozesse, Zentrum fuer Modellierung und Simulation) Bundesstrasse 55, D-20146 Hamburg, Germany Tel: x40/42838 4907, privat x40/631 62 79 hennig at math.uni-hamburg.de, http://www.math.uni-hamburg.de/home/hennig/ ####################################################################### ich empfehle www.boag.de -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
lme: Specifying a formula
2 messages · Christian Hennig, Douglas Bates
Christian Hennig <fm3a004 at math.uni-hamburg.de> writes:
I am faced with the following model: y=E+P+M+H+PxE+Error y is a response, E and P are factors with fixed effects. M is a random effect nested in P and H is a random effect nested in M. PxE is interaction of P and E. It seems that I should fit such a model with the lme function of library nlme, but I was not able to figure out from the help page how to specify the formula. In the nlme documentation, the term "nested" is always associated with a "grouping", and I do not know what my grouping is here.
For a complicated model like this you may find it worthwhile looking
at the examples in
@Book{pinh:bate:2000,
author = {Jos\'{e} C. Pinheiro and Douglas M. Bates},
title = {Mixed-Effects Models in \textsf{S} and \textsf{S-PLUS}},
publisher = {Springer},
year = 2000,
series = {Statistics and Computing}
}
The grouping refers to the groups in the data with which random
effects are associated. If the levels of the M factor are distinct
for different levels of P then you can fit your model as
lme(y ~ E * P, data = mydata, random = ~ 1 | M/H)
The last argument indicates that there will be an additive scalar
random effect for M and for H within M.
If you do not have distinct levels for M within P you can create a new
factor with
getGroups(~ 1 | P/M, data = mydata, level = 2)
and assign it as the grouping factor.
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._