Thank you Ted. I agree it is crossed design.




________________________________
From: Charles E. (Ted) Wright <cewright@uci.edu>

Cc: r-sig-mixed-models@r-project.org
Sent: Fri, October 8, 2010 3:02:17 PM
Subject: Re: [R-sig-ME] lmer give error message

John,

This is definitely a design in which visit and eye are crossed. To think of 
eye as nested within visit you would have to believe that it was a different 
pair of eyes that was being examined on each patient visit.

Ted Wright

On Fri, 8 Oct 2010, array chip wrote:

> 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
>
>
>



      
	[[alternative HTML version deleted]]


