[R] lme model specification

Spencer Graves spencer.graves at pdf.com
Sun Jan 22 21:52:35 CET 2006


	  If you are now presenting subjects with pairs, have you considered 
multidimensional scaling and possibly "Bradley-Terry" models & 
extensions?  RSiteSearch("multidimensional scaling") and 
RSiteSearch("Bradley-Terry") both seemed to contain potentially useful 
information.

	  best wishes,
	  spencer graves

#################
Bill Simpson wrote:
 > Thanks very much Spencer for your helpful reply.
 >
 > On Fri, 2006-01-20 at 07:38 -0800, Spencer Graves wrote:
 >
 >>	  Does each subject get only one LED per session or all 4 LEDs?
 >
 > I simplified a bit. Each subject gets pairs of LEDs and needs to
 > estimate the distance between them. LED1 can be Red or Blue, and LED2
 > can be R or B -- so there are 4 combos. These are presented in random
 > order. So in one session yes each subject sees all combos of LEDs.
 >
 >
 >>  This
 >>should be important regarding which models are estimaable.  In either
 >>case, might the following help you?
 >>
 >>nSubj <- 8
 >>nSess <- 4
 >>nObsPerSess <- 3
 >>
 >>library(nlme)
 >>library(e1071)
 >>P4 <- permutations(4)
 >>
 >>LED <- letters[t(P4[permSubj,])]
 >>
 >>set.seed(1)
 >>permSubj <- sample(24, nSubj)
 >>N <- nSubj*nSess*nObsPerSess
 >>DF <- data.frame(
 >>   Subject=rep(1:nSubj, each=nSess*nObsPerSess),
 >>   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),
 >>   LED=rep(LED, each=nObsPerSess),
 >>   Rep=rep(1:nObsPerSess, nSess*nSubj),
 >>   logdistance=rep(1:nObsPerSess, nSess*nSubj),
 >>   logestimate=rnorm(nSubj*nSess*nObsPerSess) )
 >>
 >>fit <- lme(logestimate~logdistance*illum*feedback+LED,
 >>   random=~1|Subject,
 >>   correlation=corAR1(form=~Rep|Subject/session),
 >>   data=DF)
 >
 > Thanks very much, I didn't know about the corAR1 statement.
 >
 > Best wishes
 > Bill




More information about the R-help mailing list