t1 <- c(3129,3000,2865,2890)
t2 <- c(3200,3300,2975,3150)
t3 <- c(2800,2900,2985,3050)
t4 <- c(2600,2700,2600,2765)
t <- c(t1,t2,t3,t4)
#Null Hypothesis (H0): μ1 = μ2 = μ3 = μ4 #Alternative Hypothesis (Ha): atleast on μ must be different
group <- c(rep(1,4),rep(2,4),rep(3,4),rep(4,4))
group <- as.factor(group)
model1 <- cbind(t,group)
model1 <- aov(t~group)
summary(model1)
## Df Sum Sq Mean Sq F value Pr(>F)
## group 3 489740 163247 12.73 0.000489 ***
## Residuals 12 153908 12826
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
lsd_test <- c(T*sqrt(2*12826/4))
plot(lsd_test)
#d)
mts <- c(rep(mean(t1),4),rep(mean(t2),4),rep(mean(t3),4),rep(mean(t4),4))
residual<- t-mts
qqnorm(residual)
#e)
plot(mts,residual,main="Residuals vs Tensail Strength")
#b)
ob1<- c(7,7,15,11,9)
ob2<- c(12,17,12,18,18)
ob3<- c(14,19,19,18,18)
ob4<- c(19,25,22,19,23)
ob5<- c(7,10,11,15,11)
ob<- c(ob1,ob2,ob3,ob4,ob5)
group2<- c(rep(15,5),rep(20,5),rep(25,5),rep(30,5),rep(35,5))
group2<- as.factor(group2)
str(group2)
## Factor w/ 5 levels "15","20","25",..: 1 1 1 1 1 2 2 2 2 2 ...
model2<- cbind(ob,group2)
model2<- aov(ob~group2)
model2
## Call:
## aov(formula = ob ~ group2)
##
## Terms:
## group2 Residuals
## Sum of Squares 475.76 161.20
## Deg. of Freedom 4 20
##
## Residual standard error: 2.839014
## Estimated effects may be unbalanced
summary(model2)
## Df Sum Sq Mean Sq F value Pr(>F)
## group2 4 475.8 118.94 14.76 9.13e-06 ***
## Residuals 20 161.2 8.06
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
t1<-2.086
lsd_test2 <- c(t1*sqrt(2*8.06/5))
plot(lsd_test2)
plot(model2)