\(y_{ij}=\mu+\tau_i+\epsilon_{ij}\)
\(H_0:\mu_1=\mu_2=\mu_3=\mu_4\)
\(H_1\):at least one \(\mu\) is different
#Inputing and formating the data
M1 <- c(.34,.12,1.23,.70,1.75,.12)
M2 <- c(.91,2.94,2.14,2.36,2.86,4.55)
M3 <- c(6.31,8.37,9.75,6.09,9.82,7.24)
M4 <- c(17.15,11.82,10.97,17.20,14.35,16.82)
dat <- data.frame(cbind(M1,M2,M3,M4))
Stacked_data <- stack(dat)
qqnorm(Stacked_data$values)
As the plot shows a non linear trend, it suggests that the data may not have a normal distribution.
boxplot(dat)
As shown in the box plots, the variance of the four different estimation methods does not seem to be constant.
model <- kruskal.test(values~ind,data = Stacked_data)
print(model)
##
## Kruskal-Wallis rank sum test
##
## data: values by ind
## Kruskal-Wallis chi-squared = 21.156, df = 3, p-value = 9.771e-05
Since the reported p-value is smaller than 0.05 we reject the null hypothesis.
library(MASS)
boxcox(Stacked_data$values~Stacked_data$ind)
Based on box cox results we choose a \(\lambda\) of 0.5.
#lambda=0.5
Stacked_data$values <- Stacked_data$values^0.5
boxplot(Stacked_data$values~Stacked_data$ind)
anova_results <- aov(values~ind,data = Stacked_data)
summary(anova_results)
## Df Sum Sq Mean Sq F value Pr(>F)
## ind 3 32.69 10.898 81.17 2.27e-11 ***
## Residuals 20 2.69 0.134
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
As the p value is extremely small, we can reject the null hypothesis with alpha=0.05.