[R-sig-ME] data layout for crossed factors w/interaction in linear mix models
Rafael Diaz
tuteson at yahoo.com
Fri Aug 21 21:22:49 CEST 2009
Dear All,
I am trying to fit a simple linear mixed model (see below
this paragraph) arising from a crossed factorial design with
2 factors and ubalanced number of replicates (from two to
five) in each cell, but I keep getting an error message (see
bottom of message). The model is:
yijk = intercept + ai + bj + abij + ejik, where:
"intercept" is fixed, and the crosss factors, ai, i =
1,..,10, and bj, j= 1,..,10, are random. I am
interested in estimating the variance components of these
factors AND their interaction. I have tried:
fm1 <- lmer(formula = V1~1 + (1|V2) + (1|V3) + (1|V4),
data = 'datos') using two types of data layout for "datos":
1) using a matrix with 3 columns:
y intercept ai's bj's abij's
y111 1 1 1 1 (1x1)
y112 1 1 1 "
y121 1 1 2 2 (1x2)
y122 1 1 2 "
y123 1 1 2 "
y131 1 1 3 3 (1x3)
. . . . .
. . . . .
2) using the design matrix from Y = XBeta +Zb.
That is, using the same first two columns as above, but
substituting 1020 columns (10 for ai's, 10 for bj's and 100
for abij's) for the last three columns.
I get the message: "Error in eval(predvars, data, env) :
invalid envir argument"
Is my data layout mispecified? Do I need to input initial
values for the random components in order to get the REML
estimates? I lmer valid for unbalanced designs? Any help would be greatly appreciated.
Rafael Diaz
California State University Sacramento
Math and Stats
>
>
>
More information about the R-sig-mixed-models
mailing list