Q1)Problem 3.23

Ftypes<-c(17.6,18.9,16.3,17.4,20.1,21.6,16.9,15.3,18.6,17.1,19.5,20.3,21.4,23.6,19.4,18.5,20.5,22.3,19.3,21.1,16.9,17.5,18.3,19.8)
z<-c(rep(1,6), rep(2,6), rep(3,6), rep(4,6))
dat<-data.frame(Ftypes,z)
z<-as.factor(dat$z)
boxplot(Ftypes~z)

anv<-aov(Ftypes~z, data = dat)
summary(anv)
##             Df Sum Sq Mean Sq F value Pr(>F)
## z            1   3.67   3.675   0.874   0.36
## Residuals   22  92.48   4.204
plot(anv)

Ftype1<-c(17.6,18.9,16.3,17.4,20.1,21.6)
Ftype2<-c(16.9,15.3,18.6,17.1,19.5,20.3)
Ftype3<-c(21.4,23.6,19.4,18.5,20.5,22.3)
Ftype4<-c(19.3,21.1,16.9,17.5,18.3,19.8)
mean(Ftype1)
## [1] 18.65
mean(Ftype2)
## [1] 17.95
mean(Ftype3)
## [1] 20.95
mean(Ftype4)
## [1] 18.81667

Here we can see that the value of P is greater than alpha hence we failed to reject the null hypothesis

Here we can see that the mean of fluid 3 is the highest hence it has the longest life

From the boxplot we can see that the basic assumption that the variances are equal is unsatisfied

Q2)Problem 3.51

kruskal.test(Ftypes~z, data = dat)
## 
##  Kruskal-Wallis rank sum test
## 
## data:  Ftypes by z
## Kruskal-Wallis chi-squared = 6.2177, df = 3, p-value = 0.1015

As the value of P is 0.1015 which is greater than alpha hence we fail to reject the null hypothesis

Q2)Problem 3.28

materials<-c(110,157,194,178,1,2,4,18,880,1256,5276,4355,495,7040,5307,10050,7,5,29,2)
y<-c(rep(1,4), rep(2,4), rep(3,4), rep(4,4),rep(5,4))
dat1<-data.frame(materials,y)
y<-as.factor(dat1$y)
avn<-aov(materials~y,data = dat1)
plot(avn)

boxplot(materials~y)

##we can see that the variances are not approximately the same hence we need to equate the variance using boxcox
library(MASS)
boxcox(materials~y)

### here we can see that the lambda is near 0 hence we take lambda as 0.1
lambda<-0.1
material<-materials^(lambda)
boxplot(material~y)

nav<-aov(material~y, data = dat1)
summary(nav)
##             Df Sum Sq Mean Sq F value Pr(>F)
## y            1  0.028 0.02821   0.103  0.752
## Residuals   18  4.940 0.27446
plot(nav)

library(agricolae)

b<-LSD.test(avn, "material", console = TRUE)
## 
## Study: avn ~ "material"
## 
## LSD t Test for materials 
## 
## Mean Square Error:  8552889 
## 
## materials,  means and individual ( 95 %) CI
## 
##       materials std r        LCL       UCL   Min   Max
## 1             1  NA 1 -6143.2144  6145.214     1     1
## 2             2   0 2 -4342.6156  4346.616     2     2
## 4             4  NA 1 -6140.2144  6148.214     4     4
## 5             5  NA 1 -6139.2144  6149.214     5     5
## 7             7  NA 1 -6137.2144  6151.214     7     7
## 18           18  NA 1 -6126.2144  6162.214    18    18
## 29           29  NA 1 -6115.2144  6173.214    29    29
## 110         110  NA 1 -6034.2144  6254.214   110   110
## 157         157  NA 1 -5987.2144  6301.214   157   157
## 178         178  NA 1 -5966.2144  6322.214   178   178
## 194         194  NA 1 -5950.2144  6338.214   194   194
## 495         495  NA 1 -5649.2144  6639.214   495   495
## 880         880  NA 1 -5264.2144  7024.214   880   880
## 1256       1256  NA 1 -4888.2144  7400.214  1256  1256
## 4355       4355  NA 1 -1789.2144 10499.214  4355  4355
## 5276       5276  NA 1  -868.2144 11420.214  5276  5276
## 5307       5307  NA 1  -837.2144 11451.214  5307  5307
## 7040       7040  NA 1   895.7856 13184.214  7040  7040
## 10050     10050  NA 1  3905.7856 16194.214 10050 10050
## 
## Alpha: 0.05 ; DF Error: 18
## Critical Value of t: 2.100922 
## 
## Groups according to probability of means differences and alpha level( 0.05 )
## 
## Treatments with the same letter are not significantly different.
## 
##       materials groups
## 10050     10050      a
## 7040       7040     ab
## 5307       5307     ab
## 5276       5276     ab
## 4355       4355     ab
## 1256       1256      b
## 880         880      b
## 495         495      b
## 194         194      b
## 178         178      b
## 157         157      b
## 110         110      b
## 29           29      b
## 18           18      b
## 7             7      b
## 5             5      b
## 4             4      b
## 2             2      b
## 1             1      b

##a)all five material doesnt have the same mean effect failure time as in boxplot we can see that material 4 differs a lot from the others ##b) from Above table of LSD we can see that the treatments with the same letters are the same

Q3) Problem 3.29

method<-c(31,10,21,4,1,62,40,24,30,35,53,27,120,97,68)
dat2<-c(rep(1,5), rep(2,5), rep(3,5))
cmb<-data.frame(method,dat2)
dat2<-as.factor(cmb$dat2)
library(MASS)
boxplot(method~dat2)

### here we can see that the variances are unequal hence we need to do the boxcox
boxcox(method~dat2)

## we can see that lambda is less than 0.5 hence we take lambda as 0.4
lambda<-0.4
methods<-method^lambda
boxplot(methods~dat2)

methods1<-log(method)
boxplot<-(methods1~dat2)
anva<-aov(methods~dat2, data = cmb)
library(agricolae)
LSD.test(anva, "methods", console = TRUE)
## 
## Study: anva ~ "methods"
## 
## LSD t Test for methods 
## 
## Mean Square Error:  1.010105 
## 
## methods,  means and individual ( 95 %) CI
## 
##                   methods std r        LCL      UCL      Min      Max
## 1                1.000000  NA 1 -1.1712564 3.171256 1.000000 1.000000
## 1.74110112659225 1.741101  NA 1 -0.4301553 3.912358 1.741101 1.741101
## 2.51188643150958 2.511886  NA 1  0.3406301 4.683143 2.511886 2.511886
## 3.37977444523543 3.379774  NA 1  1.2085181 5.551031 3.379774 3.379774
## 3.56520491593201 3.565205  NA 1  1.3939485 5.736461 3.565205 3.565205
## 3.73719281884655 3.737193  NA 1  1.5659364 5.908449 3.737193 3.737193
## 3.89805984091619 3.898060  NA 1  1.7268035 6.069316 3.898060 3.898060
## 3.9495232751503  3.949523  NA 1  1.7782669 6.120780 3.949523 3.949523
## 4.14598014312126 4.145980  NA 1  1.9747238 6.317237 4.145980 4.145980
## 4.37344829577311 4.373448  NA 1  2.2021919 6.544705 4.373448 4.373448
## 4.89452270907168 4.894523  NA 1  2.7232663 7.065779 4.894523 4.894523
## 5.21142720534249 5.211427  NA 1  3.0401708 7.382684 5.211427 5.211427
## 5.40758761965103 5.407588  NA 1  3.2363312 7.578844 5.407588 5.407588
## 6.23316600928143 6.233166  NA 1  4.0619096 8.404422 6.233166 6.233166
## 6.78691638054318 6.786916  NA 1  4.6156600 8.958173 6.786916 6.786916
## 
## Alpha: 0.05 ; DF Error: 13
## Critical Value of t: 2.160369 
## 
## least Significant Difference: 3.07062 
## 
## Treatments with the same letter are not significantly different.
## 
##                   methods groups
## 6.78691638054318 6.786916      a
## 6.23316600928143 6.233166     ab
## 5.40758761965103 5.407588    abc
## 5.21142720534249 5.211427    abc
## 4.89452270907168 4.894523    abc
## 4.37344829577311 4.373448   abcd
## 4.14598014312126 4.145980   abcd
## 3.9495232751503  3.949523  abcde
## 3.89805984091619 3.898060  abcde
## 3.73719281884655 3.737193  abcde
## 3.56520491593201 3.565205   bcde
## 3.37977444523543 3.379774   bcde
## 2.51188643150958 2.511886    cde
## 1.74110112659225 1.741101     de
## 1                1.000000      e
qqnorm(method)
qqline(method)

a)No All methods does not have the same effect on the mean particle count

from above LSD table we can see that treatments with the same letters are same

There are no pottential concerns as we can see from normal probability plot the data seems to be normally distributed