How to perform a mean comparison in R, with a treatment factor, that have 3 levels? -
can please me understand how perform comparison of means in r? treatment factor has 3 levels , want compare mean of yield @ each level of treatment factor significance
how write argument make r understand should compare mean.yield when treatment=75 (is factor, not numeric) mean.yield when treatment=100 , when treatment=125?
you can all-pairwise comparison using multcomp
package.
library(multcomp) mydata <- data.frame(treatment=c("75", "100", "125","75", "100", "125","75", "100", "125"), mean.yield=c(10,20,30,20,25,27,3,15,12)) immer.aov <- aov(mean.yield ~ treatment, data = mydata) immer.mc <- glht(immer.aov, linfct = mcp(treatment = "tukey")) summary(immer.mc)
simultaneous tests general linear hypotheses multiple comparisons of means: tukey contrasts fit: aov(formula = mean.yield ~ treatment, data = mydata) linear hypotheses: estimate std. error t value pr(>|t|) 125 - 100 == 0 3.000 6.515 0.460 0.892 75 - 100 == 0 -9.000 6.515 -1.381 0.407 75 - 125 == 0 -12.000 6.515 -1.842 0.235 (adjusted p values reported -- single-step method)
for more details , options please check out package documentation , this resource.
Comments
Post a Comment