The linear effect equation is:
\(Y_{ij} =\mu+\tau_{ij}+\epsilon_{ij}\)
where,
\(\mu\) = means, \(\tau\) = effect, \(\epsilon\) = error
The required hypothesis is :
\(H\_{0}:\tau\_{i}=0\) \(H_{0}:\tau_{i} \neq 0\)
model<- c(0.34, 0.12, 1.23, 0.70, 1.75,.12,0.91, 2.94, 2.14, 2.36, 2.86, 4.55, 6.31, 8.37, 9.75, 6.09, 9.82, 7.24, 17.15, 11.82, 10.97, 17.20, 14.35, 16.82)
factor<-c(rep(1,6), rep(2,6), rep(3,6), rep(4,6))
df<-data.frame(model,factor)
df
## model factor
## 1 0.34 1
## 2 0.12 1
## 3 1.23 1
## 4 0.70 1
## 5 1.75 1
## 6 0.12 1
## 7 0.91 2
## 8 2.94 2
## 9 2.14 2
## 10 2.36 2
## 11 2.86 2
## 12 4.55 2
## 13 6.31 3
## 14 8.37 3
## 15 9.75 3
## 16 6.09 3
## 17 9.82 3
## 18 7.24 3
## 19 17.15 4
## 20 11.82 4
## 21 10.97 4
## 22 17.20 4
## 23 14.35 4
## 24 16.82 4
boxplot(model~factor)
The sample size is too small to conduct a reasonable test for normality.
From the boxplot we obtained as a result, we can see that the variance is not constant.
aov.model<-aov(model~factor, data=df)
summary(aov.model)
## Df Sum Sq Mean Sq F value Pr(>F)
## factor 1 672.0 672.0 149.9 2.7e-11 ***
## Residuals 22 98.6 4.5
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
plot(aov.model)
From the plots, we can conclude that the residuals are not normally distributed and the data does not have constant variance.
library(MASS)
boxcox(model~factor, data=df)
model2<-(sqrt(model)-1)/0.5
df2<-data.frame(model2,factor)
aov.model<-aov(model2~factor, data=df2)
summary(aov.model)
## Df Sum Sq Mean Sq F value Pr(>F)
## factor 1 130.1 130.12 251.2 1.62e-13 ***
## Residuals 22 11.4 0.52
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
plot(aov.model)
After transformation variance among different estimation methods has become much more stable.
kruskal.test(model~factor, data=df)
##
## Kruskal-Wallis rank sum test
##
## data: model by factor
## Kruskal-Wallis chi-squared = 21.156, df = 3, p-value = 9.771e-05
Since the p-value is less than that of the alpha(0.05), we reject Ho.
model<- c(0.34, 0.12, 1.23, 0.70, 1.75,.12,0.91, 2.94, 2.14, 2.36, 2.86, 4.55, 6.31, 8.37, 9.75, 6.09, 9.82, 7.24, 17.15, 11.82, 10.97, 17.20, 14.35, 16.82)
factor<-c(rep(1,6), rep(2,6), rep(3,6), rep(4,6))
df<-data.frame(model,factor)
df
boxplot(model~factor)
aov.model<-aov(model~factor, data=df)
summary(aov.model)
plot(aov.model)
library(MASS)
boxcox(model~factor, data=df)
model2<-(sqrt(model)-1)/0.5
df2<-data.frame(model2,factor)
aov.model<-aov(model2~factor, data=df2)
summary(aov.model)
plot(aov.model)
kruskal.test(model~factor, data=df)