Rosario Garcia Gil
2014-Jun-25 10:04 UTC
[R] Duncan test: 2-way ANOVA without repetition, but with multiple subjects
Hello I have a question on how to perform a Duncan test after I set a model like this (see below). The data consist of a dependent variable (PHt) and two dependent variables (REGION (3 levels) AND MANAGEMENT (3 levels)). MANAGEMENT N P S REGION A 196 196 196 V 196 196 196 H 196 196 196 196 is the number of trees on which PHt was estimated, but we cannot consider them as repetitions, they are subjects. Therefore, only one repetition per REGION*MANAGEMENT factor. I set a two way ANOVA without repetition. Although within model <- aov(PHt~REGION*MANAGEMENT+Error(subject_f/(REGION*MANAGEMENT)),data=obsHETf) Then I try to run a Duncan test for REGION and also for MANAGEMENT. I get this error message. Error in as.data.frame.default(x[[i]], optional = TRUE, stringsAsFactors = stringsAsFactors) : cannot coerce class "c("aovlist", "listof")" to a data.frame Is there anyone who could give me a clue on what it is wrong? Maybe it isnot correct to call for a Duncan.test() for such type of model? If I fit only the mean (mean of the 196 observations) within each REGION*MANAGEMENT factor, then Duncan.test() works as expected. The model then looks as simple as this. model <- aov(PHt~REGION+MANAGEMENT,data=obsHET) Thanks in advance. R. [[alternative HTML version deleted]]
Richard M. Heiberger
2014-Jun-25 19:24 UTC
[R] Duncan test: 2-way ANOVA without repetition, but with multiple subjects
You didn't say which package Duncan.test is in. glht has the ability. glht, and probably any other package's test, cannot work with aovlist objects. They require aov objects. That means you must rewrite your Error() statement into the main model. Please see the entire maiz example in ?mmc to see how to rewrite your model. ## install.packages("HH") ## if necessary require(HH) ?mmc On Wed, Jun 25, 2014 at 6:04 AM, Rosario Garcia Gil <M.Rosario.Garcia at slu.se> wrote:> Hello > > I have a question on how to perform a Duncan test after I set a model like this (see below). > > The data consist of a dependent variable (PHt) and two dependent variables (REGION (3 levels) AND MANAGEMENT (3 levels)). > > > MANAGEMENT > N P S > REGION A 196 196 196 > V 196 196 196 > H 196 196 196 > > 196 is the number of trees on which PHt was estimated, but we cannot consider them as repetitions, they are subjects. Therefore, only one repetition per REGION*MANAGEMENT factor. > > I set a two way ANOVA without repetition. Although within > > model <- aov(PHt~REGION*MANAGEMENT+Error(subject_f/(REGION*MANAGEMENT)),data=obsHETf) > > Then I try to run a Duncan test for REGION and also for MANAGEMENT. I get this error message. > > Error in as.data.frame.default(x[[i]], optional = TRUE, stringsAsFactors = stringsAsFactors) : > cannot coerce class "c("aovlist", "listof")" to a data.frame > > Is there anyone who could give me a clue on what it is wrong? Maybe it isnot correct to call for a Duncan.test() for such type of model? > > If I fit only the mean (mean of the 196 observations) within each REGION*MANAGEMENT factor, then Duncan.test() works as expected. The model then looks as simple as this. > > model <- aov(PHt~REGION+MANAGEMENT,data=obsHET) > > Thanks in advance. > R. > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.