Re: [R] lme model specification

From: Spencer Graves <spencer.graves_at_pdf.com>
Date: Mon 23 Jan 2006 - 07:52:35 EST

          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


R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Mon Jan 23 08:01:42 2006

This archive was generated by hypermail 2.1.8 : Mon 23 Jan 2006 - 10:13:29 EST