Q3.7)

Q1)3.7 ) c)

MTest <- c("1","1","1","1","2","2","2","2","3","3","3","3","4","4","4","4")
Tstrn <- c(3129,3000,2865,2890,3200,3300,2975,3150,2800,2900,2985,3050,2600,2700,2600,2765)
dat1 <- cbind(MTest,Tstrn)
dat1 <- as.data.frame(dat1)
dat1$Tstrn <- as.numeric(dat1$Tstrn)
dat1$MTest <- as.factor(dat1$MTest)
first.model <- aov(Tstrn~MTest,data=dat1)
summary(first.model)
##             Df Sum Sq Mean Sq F value   Pr(>F)    
## MTest        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(first.model,"MTest",console = TRUE)
## 
## Study: first.model ~ "MTest"
## 
## LSD t Test for Tstrn 
## 
## Mean Square Error:  12825.69 
## 
## MTest,  means and individual ( 95 %) CI
## 
##     Tstrn       std r      LCL      UCL  Min  Max
## 1 2971.00 120.55704 4 2847.624 3094.376 2865 3129
## 2 3156.25 135.97641 4 3032.874 3279.626 2975 3300
## 3 2933.75 108.27242 4 2810.374 3057.126 2800 3050
## 4 2666.25  80.97067 4 2542.874 2789.626 2600 2765
## 
## Alpha: 0.05 ; DF Error: 12
## Critical Value of t: 2.178813 
## 
## least Significant Difference: 174.4798 
## 
## Treatments with the same letter are not significantly different.
## 
##     Tstrn groups
## 2 3156.25      a
## 1 2971.00      b
## 3 2933.75      b
## 4 2666.25      c

Answer -:µ1 and µ3 are similar ,

µ2 differs from µ1 , µ3 and µ4 ,

µ4 differ from µ1 , µ2 and µ3

Q3.7)d) Construct a normal probability plot of the residuals.What conclusion would you draw about the validity of the normality assumption?

Q3.7)e) Plot the residuals versus the predicted tensile strength.Comment on the plot

plot(first.model)

Answer Q3.7)d) The normal probability plot of residuals looks fairly normal and , and we can draw a conclusion out of it that Construct a normal probability plot of the residuals.What conclusion would you draw about the validity of normality is true.

Answer Q3.7)e) The residuals versus the predicted tensile strength plot looks almost rectangular , which indicates of constant variance. As in Analysis of variance we intrepret constant variance by seeing that the plot minimum and maximum points of all treatments must be in a straight line

Q3.7)f) Prepare a scatter plot of the results to aid the interpretation of the results of this experiment.

library("car")
## Loading required package: carData
scatterplot(Tstrn ~ MTest, data = dat1, smoother = FALSE, grid = FALSE, frame = FALSE)

Sample average for each treatment and the 95% confidence interval on the treatment mean.

Q3.10)

CWP <- c("15","15","15","15","15","20","20","20","20","20","25","25","25","25","25","30","30","30","30","30","35","35","35","35","35")
Obs <- c(7,7,15,11,9,12,17,12,18,18,14,19,19,18,18,19,25,22,19,23,7,10,11,15,11)
dat2 <- cbind(CWP,Obs)
dat2 <- as.data.frame(dat2)
dat2$CWP <- as.factor(dat2$CWP)
dat2$Obs <- as.numeric(dat2$Obs)
str(dat2)
## 'data.frame':    25 obs. of  2 variables:
##  $ CWP: Factor w/ 5 levels "15","20","25",..: 1 1 1 1 1 2 2 2 2 2 ...
##  $ Obs: num  7 7 15 11 9 12 17 12 18 18 ...

Q3.10)b)

second.model <- aov(Obs~CWP,data=dat2)
summary(second.model)
##             Df Sum Sq Mean Sq F value   Pr(>F)    
## CWP          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
LSD.test(second.model,"CWP",console=TRUE)
## 
## Study: second.model ~ "CWP"
## 
## LSD t Test for Obs 
## 
## Mean Square Error:  8.06 
## 
## CWP,  means and individual ( 95 %) CI
## 
##     Obs      std r       LCL      UCL Min Max
## 15  9.8 3.346640 5  7.151566 12.44843   7  15
## 20 15.4 3.130495 5 12.751566 18.04843  12  18
## 25 17.6 2.073644 5 14.951566 20.24843  14  19
## 30 21.6 2.607681 5 18.951566 24.24843  19  25
## 35 10.8 2.863564 5  8.151566 13.44843   7  15
## 
## Alpha: 0.05 ; DF Error: 20
## Critical Value of t: 2.085963 
## 
## least Significant Difference: 3.745452 
## 
## Treatments with the same letter are not significantly different.
## 
##     Obs groups
## 30 21.6      a
## 25 17.6      b
## 20 15.4      b
## 35 10.8      c
## 15  9.8      c

Answer 3.10)b) We drew conclusion from above fishers test that

mean of 30% different to 25%,20%,35% and 15%

mean of 25% is similar to mean 20% but different to 30%,35% and 15%

mean of 20% is similar to mean 25% but different to 30%,35% and 15%

mean of 35% is similar to mean 15% but different to 20%,25% and 30%

mean of 15% is similar to mean 35% but different to 20%,25% and 30%

Q3.10)c) Analyze the residuals from this experiment and comment on model adequacy.

plot(second.model)

Answer 3.10)c) There is nothing unsual in the Normality and residual to fitted values plot

We can conclude from above plots that the residuals are normally distributed as they fall in a straight line

And from residual to fitted values plot we can see that points fairly lie in rectangular shape , which accepts the assumptions of constant variance

Q3.44)

Q3.44) Suppose that four normal populations have means of mean1= 50,mean2 =60, mean3= 60,mean4=50, and mean4=60. How many obseravations should be taken from each population so that the probability of rejecting the null hypothesis of equal population means is at least 0.90? Assume that alpha 0.05 and that areasonable estimate of the error variance is sigma^2= 25

library(pwr)
pwr.anova.test(k=4,n=NULL,f=sqrt(((10)^2)/25) ,sig.level = 0.05 , power=0.90)
## 
##      Balanced one-way analysis of variance power calculation 
## 
##               k = 4
##               n = 2.170367
##               f = 2
##       sig.level = 0.05
##           power = 0.9
## 
## NOTE: n is number in each group

Answer Q3.44) from power analysis we can see that we will require 2.17 that is after rounding up , we will have to take 3 samples from each group

Q3.45)

Q3.45)a) How would your answer change if a reasonable estimate of the experimental error variance

pwr.anova.test(k=4,n=NULL,f=sqrt(((10)^2)/36) ,sig.level = 0.05 , power=0.90)
## 
##      Balanced one-way analysis of variance power calculation 
## 
##               k = 4
##               n = 2.518782
##               f = 1.666667
##       sig.level = 0.05
##           power = 0.9
## 
## NOTE: n is number in each group

Answer 3.45)a) It did increase the sample number , but as it is 2.5 and it will be round up to 3 samples per group

Q3.45)b) How would your answer change if a reasonable estimate of the experimental error variance were 49

pwr.anova.test(k=4,n=NULL,f=sqrt(((10)^2)/49) ,sig.level = 0.05 , power=0.90)
## 
##      Balanced one-way analysis of variance power calculation 
## 
##               k = 4
##               n = 2.939789
##               f = 1.428571
##       sig.level = 0.05
##           power = 0.9
## 
## NOTE: n is number in each group

Answer 3.45b) It did increase the sample number , but as it is 2.93 and it will be round up to 3 samples per group

Q3.45)c)Can you draw any conclusions about the sensitivity of your answer in this particular situation about how yourestimate of  affects the decision about sample size?

Answer 3.45c) We can see that the As our estimate of variability increases the sample size will increase to attain the same power of the test

Q3.45)d) Can you make any recommendations about how we should use this general approach to choosing n in practice?

Answer 3.45)d) Basically best practise is to make a estimation of variance, for eg you must tell my varinace must not be greater than “x” value . As variance effects sample size per group . And also correct method for choosing n for a Anova is always using power analysis , by taking in consideration the Power (Power is the probability of rejecting the null hypothesis when, in fact, it is false) , effect size = (Sqrt((Diff mean)^2/Variance)) and no of groups.