library(pwr)
library(tidyr)
power.anova.test(group = 4, n = NULL, between.var = sd(c(18,18,20,20)), within.var = 3.5, sig.level = 0.05, power = 0.8)
##
## Balanced one-way analysis of variance power calculation
##
## groups = 4
## n = 12.03864
## between.var = 1.154701
## within.var = 3.5
## sig.level = 0.05
## power = 0.8
##
## NOTE: n is number in each group
power.anova.test(group = 4, n = NULL, between.var = sd(c(18,18.67,19.33,20)), within.var = 3.5, sig.level = 0.05, power = 0.8)
##
## Balanced one-way analysis of variance power calculation
##
## groups = 4
## n = 15.80543
## between.var = 0.8598062
## within.var = 3.5
## sig.level = 0.05
## power = 0.8
##
## NOTE: n is number in each group
power.anova.test(group = 4, n = NULL, between.var = sd(c(18,19,19,20)), within.var = 3.5, sig.level = 0.05, power = 0.8)
##
## Balanced one-way analysis of variance power calculation
##
## groups = 4
## n = 16.58844
## between.var = 0.8164966
## within.var = 3.5
## sig.level = 0.05
## power = 0.8
##
## NOTE: n is number in each group
Life<- c(17.6, 18.9, 16.3, 17.4, 20.1, 21.6, 16.9, 15.3, 18.6, 17.1, 19.5, 20.3, 21.4, 23.6, 19.4, 18.5, 20.5, 22.3, 19.3, 21.1, 16.9, 17.5, 18.3, 19.8)
Type<-c(1,1,1,1,1,1,2,2,2,2,2,2,3,3,3,3,3,3,4,4,4,4,4,4)
Type<-as.factor(Type)
dat<-cbind(Life, Type)
dat<-data.frame(dat)
dat$Type<-as.factor(dat$Type)
str(dat)
## 'data.frame': 24 obs. of 2 variables:
## $ Life: num 17.6 18.9 16.3 17.4 20.1 21.6 16.9 15.3 18.6 17.1 ...
## $ Type: Factor w/ 4 levels "1","2","3","4": 1 1 1 1 1 1 2 2 2 2 ...
aov.model<-aov(Life~Type,data=dat)
summary(aov.model)
## Df Sum Sq Mean Sq F value Pr(>F)
## Type 3 30.16 10.05 3.047 0.0525 .
## Residuals 20 65.99 3.30
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
plot(aov.model)
TukeyHSD(aov.model, cnf.level = 0.9)
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = Life ~ Type, data = dat)
##
## $Type
## diff lwr upr p adj
## 2-1 -0.7000000 -3.63540073 2.2354007 0.9080815
## 3-1 2.3000000 -0.63540073 5.2354007 0.1593262
## 4-1 0.1666667 -2.76873407 3.1020674 0.9985213
## 3-2 3.0000000 0.06459927 5.9354007 0.0440578
## 4-2 0.8666667 -2.06873407 3.8020674 0.8413288
## 4-3 -2.1333333 -5.06873407 0.8020674 0.2090635
plot(TukeyHSD(aov.model))
COMMENT:
Based on the plot, we have determined that Fluid 2 and Fluid 3 differ significantly.