0.0.1 Answer (a)

0.0.2 Linear effect equation:

\(Y_i\) = \(\mu\) + \(\tau_i\) + \(\epsilon_ij\)

0.0.3 Hypothesis :

\(H_0: \mu_1 = \mu_2 = \mu_3 = \mu_4\)

\(H_a:\) any of the mean is not equal

0.0.4 Answer (b)

m1 <- c(0.34,0.12,1.23,0.70,1.75,0.12)
m2 <- c(0.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<- c(m1,m2,m3,m4)
qqnorm(dat)
qqline(dat)

0.0.5 The data are not normally distributed. Now we will check for the boxplot.

dat<- data.frame(m1,m2,m3,m4)
boxplot(dat, xlab = "methods", ylab = "Observations")

0.0.6 The variances for all 4 populations are not same.

0.0.7 Answer (c)

library(tidyr)
dat<-pivot_longer(dat,c(m1,m2,m3,m4))

library(MASS)
kruskal.test(value~name,data = dat)
## 
##  Kruskal-Wallis rank sum test
## 
## data:  value by name
## Kruskal-Wallis chi-squared = 21.156, df = 3, p-value = 9.771e-05

0.0.7.1 P-value is less than the \(\alpha\). Therefore, we reject the null hypothesis.

0.0.8 Answer (d)

m1 <- c(0.34,0.12,1.23,0.70,1.75,0.12)
m2 <- c(0.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) 
dat1<- c(m1,m2,m3,m4)

library(MASS)
x<-c(rep("met1",6),rep("met2",6),rep("met3",6),rep("met4",6))
boxcox(dat1~x)

dat1<-dat1^(0.5)
boxcox(dat1~x)

anova_Test<- aov(dat1~x)
summary(anova_Test)
##             Df Sum Sq Mean Sq F value   Pr(>F)    
## x            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

0.0.8.1 P-value is less than the \(\alpha\). Therefore, we reject the null hypothesis.

# Complete R Code

It is a good idea to include this at the end of every RMarkdown document

m1 <- c(0.34,0.12,1.23,0.70,1.75,0.12)
m2 <- c(0.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<- c(m1,m2,m3,m4)
qqnorm(dat)
qqline(dat)

dat<- data.frame(m1,m2,m3,m4)
boxplot(dat, xlab = "methods", ylab = "Observations")


library(tidyr)
?pivot_longer
dat<-pivot_longer(dat,c(m1,m2,m3,m4))
#colnames(dat,"Methods","Observations")
library(MASS)
kruskal.test(value~name,data = dat)

m1 <- c(0.34,0.12,1.23,0.70,1.75,0.12)
m2 <- c(0.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) 
dat1<- c(m1,m2,m3,m4)


?boxcox
library(MASS)
x<-c(rep("met1",6),rep("met2",6),rep("met3",6),rep("met4",6))
boxcox(dat1~x)

dat1<-dat1^(0.5)
boxcox(dat1~x)

anova_Test<- aov(dat1~x)
summary(anova_Test)