[R] lme model specification
spencer.graves at pdf.com
Fri Jan 20 16:38:26 CET 2006
Does each subject get only one LED per session or all 4 LEDs? This
should be important regarding which models are estimaable. In either
case, might the following help you?
nSubj <- 8
nSess <- 4
nObsPerSess <- 3
P4 <- permutations(4)
LED <- letters[t(P4[permSubj,])]
permSubj <- sample(24, nSubj)
N <- nSubj*nSess*nObsPerSess
DF <- data.frame(
illum=rep(c("star", "moon"), each=N/2),
feedback=rep(c("yes", "no"), each=N/4, length=N),
session=rep(1:nSess, each=nObsPerSess, nSubj),
fit <- lme(logestimate~logdistance*illum*feedback+LED,
Bill Simpson wrote:
> I have been asked to analyse the results of (what is to me) a very
> complicated experiment.
> The dependent measure is the estimated distance, which is measured as a
> function of the actual distance. There are also several other IVs.
> The plot of log estimated distance as a function of log distance is
> linear. So in the rest of the analysis I will use logestimate and
> My plan is to see how the other IVs affect the slope and intercept of
> this linear relationship between logestimate and log distance.
> What complicates everything is that each datum point is not independent.
> Rather, many data points come from each subject.
> * Each subject gets many objects at many distances which he has to
> * Each subject repeats this experiment using 4 colours of LEDs.
> * Each subject repeats this experiment on 4 different sessions.
> * Half the subjects do this under starlight, half under moonlight.
> * Half the subjects do it with feedback and half without.
> So some of these variables are within subjects and some between. I think
> lme is a good way to proceed. But I am hung up on how to specify the
> random=???|subject???, data=df1)
> I am familiar with the steps of model building using lm(), exploring
> different models etc, so I think I will be OK once I get the idea of
> specifying the basic lme model.
> I have Pinheiro and Bates (2000) here.
> Thanks very much for any help
> Bill Simpson
> R-help at stat.math.ethz.ch mailing list
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
More information about the R-help