On 18 Sep 2005, at 16:27, Douglas Bates wrote: > I have a couple of other comments. You can write the nested grouping > factors as Sundar did without having to explicitly evaluate the > interaction term and drop unused levels. The lmer function, like most > modeling functions in R, uses the optional argument drop.unused.levels > = TRUE when creating the model frame.
In other words, the use of "b:c" in a model formula, where both b and c are factors, results in an internal call to evalq(b:c)[,drop=T] (or equivalent), which is treated as a factor in a temporary model data frame? I know little of the internals to R - that is new to me, but does make sense for factors. Thus I could use |a:b and |a:b:c as random terms in lme or lmer, even though 'a' is a fixed, unnested factor. Notation like this in the model formula does indeed aid clarity. By the way, I noticed that in your mlmRev vignette you recommended this as good practice for lea:school (page 3), but then omitted to do it on page 4. > John Maindonald has already suggested the use of > > (1|b/c) => (1|b:c) + (1|b) > > as "syntactic sugar" for the lmer formula and it is a reasonable > request. This is, indeed, the behaviour I was expecting. > Unfortunately, implementing this is not high on my priority > list at present. (We just made a massive change in the sparse matrix > implementation in the Matrix package and shaking the bugs out of that > will take a while.) All your efforts in these areas are, I'm sure, much appreciated. I'm certainly very interested in learning to use lmer, and welcome all the improvements that are being made. > In any case the general recommendation for nested grouping factors is > first to ensure that they are stored as factors and then to create the > sequence of interaction terms. As a brief aside, I know that some people assume that lme treats random effects as factors even if they are of a numeric type. It might be worth doing a check in lmer (and even lme) that random effects are factors, producing a warning if not. Again, this is a non-vital suggestion, and I don't wish to take up any more of your time! Thanks Yan ______________________________________________ [email protected] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
