\[ y_{ij} = \mu + \tau_{i} + e_{ij} \]
Based on the box plots, the assumption of normality may be questionable for some populations because there is potential skewness. The assumption of equal variance may also be violated because of the differences in the IQRs among these populations.
\(H_0 : \mu_1 = \mu_2 = \mu_3 = \mu_4\)
\(H_1 :\) at least one of \(\mu_i\) different
## Df Sum Sq Mean Sq F value Pr(>F)
## name 3 708.7 236.2 76.29 4e-11 ***
## Residuals 20 61.9 3.1
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Since the p-value is less than 0.05, there is enough evidence to reject \(H_0\). Therefore, at least one treatment mean is significantly different.
However, the model appears to be inadequate because the constant variance assumption is violated. The residual plots show that the variability of the residuals increases as the fitted values increase, especially for Method 4. The Q-Q plot also shows some deviations from normality at the tails.
\(H_0 : \mu_1 = \mu_2 = \mu_3 = \mu_4\)
\(H_1 :\) at least one of \(\mu_i\) different
## [1] "Optimal Lambda: 0.545454545454546"
## Df Sum Sq Mean Sq F value Pr(>F)
## name 3 149.66 49.89 83.69 1.71e-11 ***
## Residuals 20 11.92 0.60
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Since the p-value is less than 0.05, there is enough evidence to reject \(H_0\). Therefore, at least one treatment mean is significantly different.
\(H_0 :\) The four groups have the same distribution.
\(H_1 :\) At least one group has a different distribution.
##
## Kruskal-Wallis rank sum test
##
## data: value by name
## Kruskal-Wallis chi-squared = 21.156, df = 3, p-value = 9.771e-05
Since the p-value is less than 0.05, there is enough evidence to reject $H_0$. Therefore, at least one group has a significantly different distribution.
#data input
method_1 <- c(0.34, 0.12, 1.23, 0.70, 1.75 , 0.12)
method_2 <- c(0.91, 2.94, 2.14, 2.36, 2.86, 4.55)
method_3 <- c(6.31, 8.37, 9.75, 6.09, 9.82, 7.24)
method_4 <- c(17.15, 11.82, 10.97, 17.20, 14.35, 16.82)
boxplot(method_1,method_2,method_3,method_4)
#AOV raw data
library (tidyr)
dat <- data.frame(method_1, method_2, method_3, method_4)
dat<- pivot_longer(dat, cols = c("method_1", "method_2", "method_3", "method_4") )
aov.model <- aov(value ~ name, data = dat)
summary(aov.model)
plot(aov.model)
#aov boxcox
library (MASS)
model <- lm(value ~ name, data = dat)
bc <- boxcox(model, lambda = seq(-2, 2, 0.1))
optimal_lambda <- bc$x[which.max(bc$y)]
print(paste("Optimal Lambda:", optimal_lambda))
dat_transformed <- dat
dat_transformed$value <- (dat_transformed$value^optimal_lambda - 1) / optimal_lambda
aov.model2 <- aov(value ~ name, data = dat_transformed)
summary(aov.model2)
#kruskal-wallace test
kruskal.test(value ~ name, data = dat)