f1 <- c(17.6,18.9,16.3,17.4,20.1,21.6)
f2 <- c(16.9,15.3,18.6,17.1,19.5,20.3)
f3 <- c(21.4,23.6,19.4,18.5,20.5,22.3)
f4 <- c(19.3,21.1,16.9,17.5,18.3,19.8)
life <- c(f1,f2,f3,f4)
types <- c(rep(1,6),rep(2,6),rep(3,6),rep(4,6))
types <- as.factor(types)
fluid <- cbind(life,types)
fluid <- as.data.frame(fluid)
model <- aov(life~types)
summary(model)
## Df Sum Sq Mean Sq F value Pr(>F)
## types 3 30.17 10.05 3.047 0.0525 .
## Residuals 20 65.99 3.30
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
a <- mean(f1)
b <- mean(f2)
c <- mean(f3)
d <- mean(f4)
plot(model)
#H0:μ1=μ2=μ3=μ4 #Ha: at least one μi is not equal. ##a)p=0.0525 is greater than alpha0.05, we fail to reject null hypothesis. ##b) f3 has the highest mean. ##c)the plots, shows our data follows normal distribution and has constant variance. #Q-3.51
kruskal.test
## function (x, ...)
## UseMethod("kruskal.test")
## <bytecode: 0x0000000012e11638>
## <environment: namespace:stats>
#p-value = 0.1015 its greater than alpha. we fail to reject null hypothesis.we can say variance are stable. # Q-3.28
m1 <- c(110,157,194,178)
m2 <- c(1,2,4,18)
m3 <- c(880,1256,5276,4355)
m4 <- c(495,7040,5307,10050)
m5 <- c(7,5,29,2)
m <- c(rep(1,4),rep(2,4),rep(3,4),rep(4,4),rep(5,4))
time <- c(m1,m2,m3,m4,m5)
m <- as.factor(m)
model_1 <- cbind(time,m)
model_1 <- as.data.frame(model_1)
model_1 <- aov(time~m)
summary(model_1)
## Df Sum Sq Mean Sq F value Pr(>F)
## m 4 103191489 25797872 6.191 0.00379 **
## Residuals 15 62505657 4167044
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
plot(model_1)
library(MASS)
boxcox(time~m)
time <- log(time)
model_3 <- aov(time~m)
plot(model_3)
# maximum value is near to zero, so we take lambda=0. use log to transform. #H0:μ1=μ2=μ3=μ4=μ5 #Ha: at least one μi is not equal. ### a)p-value is less than alpha(0.05), so we reject the Null Hypothesis(H0) ### b) the graph shows the plots are normally distributed. ### c) P-value is less than the alpha. we reject null hypothesis (H0) From the graph, we can say that our data is approximately normal.
#Q-3.29
c1<- c(31,10,21,4,1)
c2<- c(62,40,24,30,35)
c3<- c(53,27,120,97,68)
c <- c(c1,c2,c3)
m <- c(rep(1,5),rep(2,5),rep(3,5))
m <- as.factor(m)
expriment <- cbind(c,m)
expriment <- as.data.frame(expriment)
model_4 <- aov(c~m)
summary(model_4)
## Df Sum Sq Mean Sq F value Pr(>F)
## m 2 8964 4482 7.914 0.00643 **
## Residuals 12 6796 566
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
plot(model_4)
library(MASS)
boxcox(c~m)
d<- c^0.5
dt <- cbind(d,m)
dt <- as.data.frame(dt)
model_5 <- aov(d~m)
summary(model_5)
## Df Sum Sq Mean Sq F value Pr(>F)
## m 2 63.90 31.95 9.84 0.00295 **
## Residuals 12 38.96 3.25
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
plot(model_5)
## As maximum value is near to 0.5. Therefore consider lambda equal to 0.5 and perform transformation. ## After transformation variance are not equal, so parametric test should be used. #H0:μ1=μ2=μ3=μ4=μ5 #Ha: at least one μi is not equal. ### a)p-value is less than alpha(0.05), so we reject the Null Hypothesis(H0) ### b) the graph shows the plots are normally distributed. and plot shows it has unequal variences ###c)## After transformation variance are not equal, so parametric test should be performed