library(lme4) lex = read.table(file.path(pfad, "lex.txt")) head(lex) names(lex) str(lex) par(mfrow=c(1,2)) boxplot(rt ~ Lang, ylab = "Reaktionszeit", data = lex) with(lex, interaction.plot(Length, Lang, rt)) mm = lmer(rt ~ Lang * Length + (1|Subj) + (1|Word), data = lex) # benötigen wir (1|Word) # entweder mm2 = update(mm, ~ . -(1|Word)) # oder # mm2 = lmer(rt ~ Lang * Length + (1|Subj), data = lex) anova(mm, mm2) # benötigen wir (1|Subj) anova(mm, update(mm, ~ . -(1|Subj))) # fixed factors anova(mm) # Ist die Interaktion signifikant? mm3 = lmer(rt ~ Lang + Length + (1|Subj) + (1|Word), data = lex) # oder mm3 = update(mm, ~ . -(Lang:Length)) anova(mm, mm3) # Gibt es einen Haupteffekt für Lang? mm4 = update(mm3, ~ . - Lang) anova(mm3, mm4) mm5 = update(mm3, ~ . - Length) anova(mm3, mm5) ########## asp = read.table(file.path(pfad, "asp.txt")) ######################### beide = factor(with(asp, paste(Kons, Bet, sep="."))) e = lmer(d ~ beide + (1|Wort) + (1|Vpn), data = asp) library(multcomp) summary(glht(e, linfct = mcp(beide = "Tukey")))