Hi Folks, I'm trying to understand the model specification formalities for 'lme', and the documentation is leaving me a bit confused. Specifically, using the example dataset 'Orthodont' in the 'nlme' package, first I use the invocation given in the example shown by "?lme": > fm1 <- lme(distance ~ age, data = Orthodont) # random is ~ age Despite the Comment ("# random is ~ age"), > summary(fm1) says that [...] Random effects: Formula: ~age | Subject Structure: General positive-definite [...] Fixed effects: distance ~ age In view of the statement "Formula: ~age | Subject" above, I next try: > fm1<-lme(distance~age,data=Orthodont,random=~age|Subject) > summary(fm1) [...] Random effects: Formula: ~age | Subject Structure: General positive-definite, Log-Cholesky parametrization [...] Fixed effects: distance ~ age So the summaries of the two invocations give identical statements of the Random and Fixed Effects models, but the second adds "Log-Cholesky parametrization" to the "Structure", and the numerical results are very slightly different (though hardly enough to visible in this case). Finally, if I take the Comment ("# random is ~ age") from the first invocation and base an invocation on that: > fm1<-lme(distance~age,data=Orthodont,random=~age) > summary(fm1) I get results identical with the second invocation. I'm not following how/why the first two different invocations give rise to the different results, and am puzzled by their relationship with the third (given the Comment). Can someone explain? With thanks, Ted. -------------------------------------------------------------------- E-Mail: (Ted Harding) <Ted.Harding at nessie.mcc.ac.uk> Fax-to-email: +44 (0)870 167 1972 Date: 16-Dec-02 Time: 23:28:43 ------------------------------ XFMail ------------------------------
For convenience lme offers several different ways of specifying the formula and nesting structure of the random effects. The default random effects have the same model matrix as the fixed effects and the default grouping variable. If the model matrix has more than one column the default structure for the variance-covariance of the random effects is a general positive-definite symmetric (pdSymm) structure. The default parameterization for pdSymm is pdLogChol Orthodont is a groupedData object that carries information on the grouping structure. The default grouping variable is Subject. Hence the following specifications should be equivalent after fixed = distance ~ age, data = Orthodont random = list(Subject = pdLogChol(~ age)) random = list(Subject = pdSymm(~ age)) random = ~ age | Subject random = ~ age no random specification I'm not sure why you got different answers between your first and second specifications. It may be that there is a route through the code that picks up a parameterization for pdSymm other than pdLogChol. The default in S-PLUS was pdMatrixLog but we changed that in the R implementation because it is difficult (perhaps impossible) to get an analytic gradient of the matrix exponential. (Ted Harding) <Ted.Harding at nessie.mcc.ac.uk> writes:> I'm trying to understand the model specification formalities > for 'lme', and the documentation is leaving me a bit confused. > > Specifically, using the example dataset 'Orthodont' in the > 'nlme' package, first I use the invocation given in the example > shown by "?lme": > > > fm1 <- lme(distance ~ age, data = Orthodont) # random is ~ age > > Despite the Comment ("# random is ~ age"), > > > summary(fm1) > > says that > > [...] > Random effects: > Formula: ~age | Subject > Structure: General positive-definite > [...] > Fixed effects: distance ~ age > > In view of the statement "Formula: ~age | Subject" above, > I next try: > > > fm1<-lme(distance~age,data=Orthodont,random=~age|Subject) > > summary(fm1) > [...] > Random effects: > Formula: ~age | Subject > Structure: General positive-definite, Log-Cholesky parametrization > [...] > Fixed effects: distance ~ age > > So the summaries of the two invocations give identical statements > of the Random and Fixed Effects models, but the second adds > "Log-Cholesky parametrization" to the "Structure", and the numerical > results are very slightly different (though hardly enough to visible > in this case). > > Finally, if I take the Comment ("# random is ~ age") from the first > invocation and base an invocation on that: > > > fm1<-lme(distance~age,data=Orthodont,random=~age) > > summary(fm1) > > I get results identical with the second invocation. > > I'm not following how/why the first two different invocations give > rise to the different results, and am puzzled by their relationship > with the third (given the Comment). > > Can someone explain? > > With thanks, > Ted. > > > -------------------------------------------------------------------- > E-Mail: (Ted Harding) <Ted.Harding at nessie.mcc.ac.uk> > Fax-to-email: +44 (0)870 167 1972 > Date: 16-Dec-02 Time: 23:28:43 > ------------------------------ XFMail ------------------------------ > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > http://www.stat.math.ethz.ch/mailman/listinfo/r-help