[R-sig-ME] MCMCglmm with datasets of different lengths

Volker Dellwo volker.dellwo at uzh.ch
Wed May 15 10:29:53 CEST 2013


Dear David,

On 5/9/13 7:24 AM, David Duffy wrote:
>> But then, ANOVA does not seem to be an appropriate model here as
>> the assumption of data independence is violated (each subject
>> reads the same sentences repeatedly).
>
> Not necessarily so, given you have speaker in the model.  Are tempo
> and sentence order randomized? Vary by speaker?

No, unfortunately not. It had to be in the design of this experiment
that speakers read the tempo versions in the same order and sentences
were part of a text so they were also read in the same order.

>> So I have been recommended to use linear mixed models, which
>> apparently gets more and more popular in my field. These models,
>> however, tell me a very different story of what I can see in the
>> data:
>
> Not if you fit comparable models. Looking at the interaction terms,
> ISTM you can use random slopes. Anyway, enough already ;)
>
> x <- read.table("BonnTempoData.txt", h=T) for(i in 1:3) x[,i] <-
> as.factor(x[,i]) hist(x$percentV) shapiro.test(x$percentV) # Not
> usually recommended library(MASS) boxcox(percentV ~
> (speaker+tempo+sentence)^2, data=x) anova(lm(percentV ~
> (speaker+tempo+sentence)^2, data=x)) qqnorm(r <-
> residuals(lm(percentV ~ (speaker+tempo+sentence)^2, data=x)))
> qqline(r)
>
> with(x, plot(percentV ~ tempo, notch=TRUE, col="grey90")) with(x,
> points(jitter(as.numeric(x$tempo)), x$percentV)) aline <-
> function(i) {y <- as.vector(by(x$percentV[x$speaker==i],
> x$tempo[x$speaker==i], mean)); lines(1:5,y,col=as.integer(i), lwd=3);
>  points(1:5,y,col=as.integer(i),pch=16,cex=3) } for(i in
> levels(x$speaker)) aline(i)

I worked myself through this code now and I guess I understand much more
- so this was very helpful, thanks a lot!!! I just have not worked out
yet what the function(i) does and what happens in the last line. I guess
it fits the random slopes, right?

Thanks again and best wishes,
Volker



More information about the R-sig-mixed-models mailing list