[R] R: Error with glht function: Error in mcp2matrix(model, linfct = linfct) : Variable(s) 'Type' have been specified in 'linfct' but cannot be found in 'model'!

1,263 views
Skip to first unread message

angelo...@virgilio.it

unread,
Jun 22, 2012, 9:11:20 AM6/22/12
to r-h...@r-project.org
Hello everybody,
problem solved, there was a typo.

I wrote Type instead of Material


Best




----Messaggio originale----

Da: angelo...@virgilio.it

Data: 22-giu-2012 11.05

A: <r-h...@r-project.org>

Ogg: Error with glht function: Error in mcp2matrix(model, linfct = linfct) : Variable(s) 'Type' have been specified in 'linfct' but cannot be found in 'model'!



Dear list members,
I get the following error when using the glht function to perform a post hoc analysis for an ANOVA with repeated measures:


require(nlme)
lme_H2H_musicians = lme(H2H ~ Emotion*Material, data=musicians, random = ~1|Subject)
require(multcomp)
summary(glht(lme_H2H_musicians, linfct=mcp(Type = "Tukey")), test = adjusted(type = "bonferroni"))
Error in mcp2matrix(model, linfct = linfct) :
Variable(s) 'Type' have been specified in 'linfct' but cannot be found in 'model'!



I don´t understand why I get this error, but at the same time I am not an expert at all of R.

I can give you some details more about the experimental design I use and what I want to do with the analysis,
so maybe there is a problem with the model I am trying to use, and I need some advices.


I performed an experiment where some musicians had to walk with 5 different emotions
(sad, tender, neutral, happy, aggressive) while listening to 4 types of
sounds (metal, wood, gravel, snow) and I want to see if the sound affects the walking pace.
I measured for each walk the average time between steps (H2H, i.e. heel-to-heel)
Each trial was repeated twice.

The table in .csv format can be downloaded here: https://dl.dropbox.com/u/3288659/Results_data_R.csv


The ANOVA that I performed before the post hoc test is the following:

aov_H2H_musicians = aov(H2H ~ Emotion*Material + Error(Subject/(Emotion*Material)), data=musicians)
summary(aov_H2H_musicians)




Thanks in advance

All the best




[[alternative HTML version deleted]]

Reply all
Reply to author
Forward
0 new messages