d<- read.csv("anova.csv")
summary(d)
## treatment values
## Control:10 Min. : 6.868
## Treat1 :10 1st Qu.:11.357
## Treat2 :10 Median :15.377
## Mean :14.258
## 3rd Qu.:16.961
## Max. :21.518
tapply(d$value,d$treatment,summary)
## $Control
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 6.868 9.072 9.983 11.002 11.979 17.205
##
## $Treat1
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 9.585 12.366 15.513 15.109 16.731 21.518
##
## $Treat2
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 12.43 15.39 16.80 16.66 17.71 20.53
plot(d)
mod<-lm(values~treatment,data=d)
anova (mod)
## Analysis of Variance Table
##
## Response: values
## Df Sum Sq Mean Sq F value Pr(>F)
## treatment 2 171.12 85.559 8.6123 0.001279 **
## Residuals 27 268.23 9.935
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
summary(mod)
##
## Call:
## lm(formula = values ~ treatment, data = d)
##
## Residuals:
## Min 1Q Median 3Q Max
## -5.5240 -1.9359 0.1353 1.2907 6.4087
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 11.0022 0.9967 11.038 1.64e-11 ***
## treatmentTreat1 4.1070 1.4096 2.914 0.007093 **
## treatmentTreat2 5.6614 1.4096 4.016 0.000424 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 3.152 on 27 degrees of freedom
## Multiple R-squared: 0.3895, Adjusted R-squared: 0.3443
## F-statistic: 8.612 on 2 and 27 DF, p-value: 0.001279
TukeyHSD(aov(d$values~d$treatment))
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = d$values ~ d$treatment)
##
## $`d$treatment`
## diff lwr upr p adj
## Treat1-Control 4.106977 0.6120417 7.601913 0.0188187
## Treat2-Control 5.661443 2.1665079 9.156379 0.0011951
## Treat2-Treat1 1.554466 -1.9404693 5.049402 0.5206267
g1<-ggplot(d,aes(x=treatment,y=values)) +stat_summary(fun.y=mean,geom="bar",fill="lightgrey",col="black",width=0.7) +stat_summary(fun.data=mean_cl_normal,geom="errorbar",width=0.3)
g1
ylab="My text for the ylabel. Give name of variable and units"
xlab="My text for the xlabel. Give name of variable and units"
g1 + ylab(ylab) + xlab(xlab)
g1<-ggplot(d,aes(x=treatment,y=values)) + stat_summary(fun.y=mean,geom="point") +stat_summary(fun.data=mean_cl_normal,geom="errorbar")
g1
ylab="My text for the ylabel. Give name of variable and units"
xlab="My text for the xlabel. Give name of variable and units"
g1 + ylab(ylab) + xlab(xlab)