Hi Volker,
It's hard to make any definite diagnoses without seeing the output of the commands you listed, but my suspicion is that you have your "speaker" and "sentence" factors represented in your data frame as numeric objects (e.g., integers 1 to length(speaker)) instead of factor objects. So when you try to test speaker or sentence by putting them in the model as fixed effects, the model tries to fit a non-sensical slope to the arbitrary x-values given by the factor labels. Obviously this kind of test doesn't make sense. The second kind of test, where you let the intercept vary randomly across speakers or sentences, does make sense. If this is indeed what is happening here, then the results should be more consistent if you first convert speaker and sentence to factors before testing them as fixed effects.
Jake
Date: Wed, 8 May 2013 18:04:07 +0200
From: volker.dellwo@uzh.ch
To: r-sig-mixed-models@r-project.org
Subject: [R-sig-ME] mixed-models problem

Dear R people,
 
I am new to R and mixed models and receive rather strange and 
contradictory results for a data analysis. Below is some R code with 
detailed comments. The data file is attached to the mail.
 
I would be very grateful for any suggestions!! I appreciate that this is 
probably a longer question than typically found on this list but it is 
important to me. So if anyone wants to offer me some paid assistance 
with this problem (e.g via Skype) I am more than happy to receive your 
suggestions.
 
With many many thanks in advance for your help!
Yours,
Volker
 
### R code starts here ####
 
# In an experiment, 15 speakers read a text consisting of 7 sentences 
under 5 different intended tempo categories, so we have three factors: 
tempo, speaker and sentence. We measured the percentage over which 
speech is vocalic (%V) for each sentence so N = 525 (15 speakers x 5 
tempos x 7 sentences). I am now particularly interested in between 
speaker differences of %V. Here is what I did:
 
rm(list = ls())
bt.data <- read.table("/Users/Flok/Desktop/BonnTempoData.txt",header=TRUE);
 
speaker <- factor(bt.data$speaker);
sentence <- factor(bt.data$sentence);
tempo <- factor(bt.data$tempo);
percentV <- bt.data$percentV
percentV_zScore <- bt.data$percentV_zScore
 
summary(speaker)
summary(sentence)
summary(tempo)
length(percentV)
 
     # (1) Descriptives:
 
             # Descriptively the differences between speakers seem 
strong. Sentence differences also look strong but there seems to be no 
difference in %V between the five different tempo conditions as you can 
see in the following box-plots:
             boxplot(percentV ~ tempo)
             boxplot(percentV ~ speaker)
             boxplot(percentV ~ sentence)
 
     # (2) Inferentials:
 
             #Inferentially I first tried an ANOVA which basically 
confrims all the descriptive results above. 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). 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 differnt story of what I can see in the data:
 
         # (2.1) Use lme4 package for analysis:
         library(lme4);
         library(languageR);
 
             # Surprisingly there is a strong effect of tempo:
             modelA <- lmer(percentV ~ tempo + (1|speaker) + 
(1|sentence), data=bt.data);
             pvals.modelA <- pvals.fnc(modelA);
             print(pvals.modelA)
 
             # Again, surprisingly there is no effect of seaker:
             modelB <- lmer(percentV ~ speaker + (1|tempo) + 
(1|sentence), data=bt.data);
             pvals.modelB <- pvals.fnc(modelB);
             print(pvals.modelB)
 
             # And again, no effect of sentence:
             modelC <- lmer(percentV ~ sentence + (1|tempo) + 
(1|sentence), data=bt.data);
             pvals.modelC <- pvals.fnc(modelC);
             print(pvals.modelC)
 
             # Comparing two models with and without speaker as a fixed 
effect comes to the same result:
             modelD <- lmer(percentV ~ 1 + (1|tempo) + (1|sentence), 
data=bt.data);
             anova.BvsD <- anova(modelB, modelD);
             print(anova.BvsD)
 
         # (2.2) Using the nlme package:
         library(nlme);
 
             # Now someone suggested to me to test the effects of 
speaker by adding speaker and sentence as a random factor in one model 
and excluding them consecutively in others and the comparing the models. 
When I do that, speaker is significant:
 
             modelA <- lme(percentV ~ tempo, 
random=list((~1|speaker),(~1|sentence)), data=bt.data, 
na.action=na.omit, method="ML");
 
             modelB <- lme(percentV ~ tempo, random=list((~1|sentence)), 
data=bt.data, na.action=na.omit, method="ML");
 
             modelC <- lme(percentV ~ tempo, random=list((~1|sentence)), 
data=bt.data, na.action=na.omit, method="ML");
 
             # Now we still get main effects for tempo:
             anova.modelA <- anova(modelA)
             print(anova.modelA)
 
             # But we also get effects for speaker and tempo when 
contrasting the models:
             comparison.AvsB <- anova(modelA, modelB);
             print(comparison.AvsB)
             comparison.AvsC <- anova(modelA, modelC);
             print(comparison.AvsC)
 
# So I have two questions:
 
     # (a) Why are the effects of the mixed-models so much different 
from what I can see descriptively? I would certainly not expect an 
effect of tempo here at all but possibly speaker and/or sentence.
 
     # (b) Why do I get to categorically different results depending in 
the method I choose (2.1: speaker and sentence are not significant, 2.2 
speaker and sentence are significant)
 
# I'm extremely greatful for any comments and/or help!
 
 

_______________________________________________
R-sig-mixed-models@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models 		 	   		  
	[[alternative HTML version deleted]]

