[R-sig-ME] lmer give error message
array chip
arrayprofile at yahoo.com
Fri Oct 8 23:47:31 CEST 2010
Hi, I have an ophthalmology dataset, that has as response variable "y", patient
ID (pid), visit (0,1,2) and eye examined ("L' and "R").
Basically, each patient has 3 visit, during each visit, both eyes will be
assessed and produce response measurements. The first question is should I treat
eye.examined and visit as crossed or nested? I think it should be treated as
crossed because each eye will be assessed in each visit. On the other hand, the
2 measurements from the 2 eyes were from a given visit, so it looks like it can
be treated as nested as well (eye %in% visit).
The second question is, no matter which way I use, lmer() gives me error
message, while lme() from nlme package can handle nested design easily. Also, is
there a way to specify corssed design in lme() as well?
> dat <- read.table ("dat.txt", sep='\t', row.names=1, header=T)
> library(nlme)
### nested using lme
> lme(y~1, random=~1|pid/visit/eye,dat)
Random effects:
Formula: ~1 | pid
(Intercept)
StdDev: 2.881611
Formula: ~1 | visit %in% pid
(Intercept)
StdDev: 0.8154632
Formula: ~1 | eye %in% visit %in% pid
(Intercept) Residual
StdDev: 1.065172 0.5321993
### nested using lmer
> lmer(y~1+(1|pid/visit/eye),dat)
Error: length(f1) == length(f2) is not TRUE
In addition: Warning messages:
1: In visit:pid :
numerical expression has 718 elements: only the first used
2: In visit:pid :
numerical expression has 718 elements: only the first used
### crossed
> lmer(y~1+(1|pid/visit)+(1|pid/eye),dat)
Error: length(f1) == length(f2) is not TRUE
In addition: Warning messages:
1: In visit:pid :
numerical expression has 718 elements: only the first used
2: In visit:pid :
numerical expression has 718 elements: only the first used
3: In eye:pid : numerical expression has 718 elements: only the first used
4: In eye:pid : numerical expression has 718 elements: only the first used
Can anyone share their thoughts.
Thanks
John
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: dat.txt
URL: <https://stat.ethz.ch/pipermail/r-sig-mixed-models/attachments/20101008/62e3212e/attachment.txt>
More information about the R-sig-mixed-models
mailing list