Skip to content
Prev 181311 / 398502 Next

Naming a random effect in lmer

Hi Bill,

I'm about to take a look at this.  If I understand the issue, very
long expressions for what I call the "grouping factor" of a random
effects term (the expressions on the right hand side of the vertical
bar) are encountering problems with deparse.  I should have realized
that, any time one uses deparse, disaster looms.

I can tell you the reason that the collection of random-effects terms
is being named is partly for the printed form and partly so that terms
with the same grouping factor can be associated.

I guess my simplistic solution to the problem would be to precompute
these sums and give them names, if it is the sum like

Z2 + Z3 + Z4 + Z5 + Z6 + Z7 + Z8 + Z9

that is important, why not evaluate the sum

testGroupSamp <- within(testGroupSamp, Z29 <- Z2 + Z3 + Z4 + Z5 + Z6 +
Z7 + Z8 + Z9)

and use Z29 as the grouping factor.

Even the use of variables with names like Z1, Z2, ... and the use of
expressions like paste("Z", 2:9, sep = "") is not idiomatic R/S code.
It's an SPSS/SASism.  (You know I never realized before how close the
word "SASism", meaning a construction that is natural in SAS, is to
"Sadism".)  Why not create a matrix Z and evaluate these sums as
matrix/vector products?


Zs2<- paste("Z",2:9,sep="")
On Fri, May 22, 2009 at 5:30 PM, William Dunlap <wdunlap at tibco.com> wrote: