library(agricolae)
MixTechnique<-c(3129,3000,2865,2890,3200,3300,2975,3150,2800,2900,2985,3050,2600,2700,2600,2765)
dat<-c(1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4)
str(dat)
## num [1:16] 1 1 1 1 2 2 2 2 3 3 ...
dat<-as.factor(dat)
str(dat)
## Factor w/ 4 levels "1","2","3","4": 1 1 1 1 2 2 2 2 3 3 ...
z<-cbind.data.frame(MixTechnique,dat)
Z<-aov(MixTechnique~dat)
summary(z)
## MixTechnique dat
## Min. :2600 1:4
## 1st Qu.:2791 2:4
## Median :2938 3:4
## Mean :2932 4:4
## 3rd Qu.:3070
## Max. :3300
a<-LSD.test(MixTechnique,dat,12,12826,console = TRUE)
##
## Study: MixTechnique ~ dat
##
## LSD t Test for MixTechnique
##
## Mean Square Error: 12826
##
## dat, means and individual ( 95 %) CI
##
## MixTechnique std r LCL UCL Min Max
## 1 2971.00 120.55704 4 2847.623 3094.377 2865 3129
## 2 3156.25 135.97641 4 3032.873 3279.627 2975 3300
## 3 2933.75 108.27242 4 2810.373 3057.127 2800 3050
## 4 2666.25 80.97067 4 2542.873 2789.627 2600 2765
##
## Alpha: 0.05 ; DF Error: 12
## Critical Value of t: 2.178813
##
## least Significant Difference: 174.482
##
## Treatments with the same letter are not significantly different.
##
## MixTechnique groups
## 2 3156.25 a
## 1 2971.00 b
## 3 2933.75 b
## 4 2666.25 c
plot(a)
### Testing Hypothesis ### Ho=The Tensile strength of the cement are the same for all mixing techniques ### Ha=At least one mean tensile strength differs ### as P is less than 0.05, Hence we can conclude that we reject the null hypothesis ### c)All pairs of means are significantly greater than 3.74 except for pair (1 and 5),(2 and 3) ### d)from the plots we can see that the data is normally distributed
library(agricolae)
cweight<-c(7,7,15,11,9,12,17,12,18,18,14,19,19,18,18,19,25,22,19,23,7,10,11,15,11)
da<-c(1,1,1,1,1,2,2,2,2,2,3,3,3,3,3,4,4,4,4,4,5,5,5,5,5)
da<-as.factor(da)
db<-cbind.data.frame(cweight,da)
db<-aov(cweight~da)
summary(db)
dt<-LSD.test(cweight,da,20,8.06,console = TRUE)
plot(db)
### As per LSD result we can see that minimu significance difference is 3.745452
### We can see its its normally distributed so we can say model is adequate
library(pwr)
pwr.anova.test(k=4,n=NULL,f=sqrt((5)^2/25),sig.level=0.05,power=0.9)
##
## Balanced one-way analysis of variance power calculation
##
## k = 4
## n = 4.658119
## f = 1
## sig.level = 0.05
## power = 0.9
##
## NOTE: n is number in each group
### The required sample size is 5
### we can see that hypothesis of population means is 0.9 and alpha is o.05 and error variance is 25
pwr.anova.test(k=4, n=NULL,f=sqrt((5)^2/49),sig.level=0.05,power=0.9)
##
## Balanced one-way analysis of variance power calculation
##
## k = 4
## n = 7.998751
## f = 0.7142857
## sig.level = 0.05
## power = 0.9
##
## NOTE: n is number in each group
### The required sample size is 8
pwr.anova.test(k=4, n=NULL,f=sqrt((5)^2/36),sig.level=0.05,power=0.9)
##
## Balanced one-way analysis of variance power calculation
##
## k = 4
## n = 6.180857
## f = 0.8333333
## sig.level = 0.05
## power = 0.9
##
## NOTE: n is number in each group
### The required sample size is 7