Answer 3.7

Entering Data

library(tidyr)

MT1 <- c(3129, 3000, 2865, 2890)
MT2 <- c(3200, 3300, 2975, 3150)
MT3 <- c(2800, 2900, 2985, 3050)
MT4 <- c(2600, 2700, 2600, 2765)

TS <- cbind.data.frame(MT1, MT2, MT3, MT4)
MTs <- pivot_longer (data = TS, c(MT1, MT2, MT3, MT4))

MTs$name <- as.factor(MTs$name)
MTs$value <- as.numeric(MTs$value)

MTs.test <- aov(value~name,data=MTs)
summary(MTs.test)
##             Df Sum Sq Mean Sq F value   Pr(>F)    
## name         3 489740  163247   12.73 0.000489 ***
## Residuals   12 153908   12826                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

3.7 (c).

library(agricolae)
LSD.test(MTs.test,"name", alpha = 0.05, console = TRUE)
## 
## Study: MTs.test ~ "name"
## 
## LSD t Test for value 
## 
## Mean Square Error:  12825.69 
## 
## name,  means and individual ( 95 %) CI
## 
##       value       std r      LCL      UCL  Min  Max
## MT1 2971.00 120.55704 4 2847.624 3094.376 2865 3129
## MT2 3156.25 135.97641 4 3032.874 3279.626 2975 3300
## MT3 2933.75 108.27242 4 2810.374 3057.126 2800 3050
## MT4 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.
## 
##       value groups
## MT2 3156.25      a
## MT1 2971.00      b
## MT3 2933.75      b
## MT4 2666.25      c

Comparisons between pairs of means:

MT2 vs. MT1 = 3156.25 - 2971.00 = 185.25 > 174.48

MT2 vs. MT3 = 3156.25 - 2933.75 = 222.5 > 174.48

MT2 vs. MT4 = 3156.25 - 2666.25 = 490 > 174.48

MT1 vs. MT3 = 2971.00 - 2933.75 = 37.25 < 174.48

MT1 vs. MT4 = 2971.00 - 2666.25 = 304.75 > 174.48

MT3 vs. MT4 = 2933.75 - 2666.25 = 267.5 > 174.48

Therefore, we see that the mean of MT2 is different than that of MT1, MT3, MT4; Mean of MT1 is similar to MT3 but different to MT2 & MT4; Mean of MT4 is different to MT1, MT2, MT3.

Plots:

plot(MTs.test)

3.7 (d).

We see that the NPP of the residuals is normally distributed.

3.7 (e).

We see that the residuals versus the predicted tensile strength plot looks fairly rectangular, and conclude that the variances are constant.

3.7 (f).

library("car")
## Loading required package: carData
scatterplot(value~name, data = MTs, ylab = "Tensile Strength", xlab = "Mixing Technique")

The above plot shows the sample average for each treatment and the 95% confidence interval on the treatment mean.

Answer 3.10

library(dplyr)

Entering Data

CWP15 <- c(7, 7, 15, 11, 9)
CWP20 <- c(12, 17, 12, 18, 18)
CWP25 <- c(14, 19, 19, 18, 18)
CWP30 <- c(19, 25, 22, 19, 23)
CWP35 <- c(7, 10, 11, 15, 11)

CWP <- cbind.data.frame(CWP15, CWP20, CWP25, CWP30, CWP35)
CWPs <- pivot_longer(data = CWP, c(CWP15, CWP20, CWP25, CWP30, CWP35))

CWPs$name <- as.factor(CWPs$name)
CWPs$value <- as.numeric(CWPs$value)

CWPs.test <- aov(value~name,data=CWPs)
summary(CWPs.test)
##             Df Sum Sq Mean Sq F value   Pr(>F)    
## name         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

3.10 (b).

LSD.test(CWPs.test,"name", alpha = 0.05, console = TRUE)
## 
## Study: CWPs.test ~ "name"
## 
## LSD t Test for value 
## 
## Mean Square Error:  8.06 
## 
## name,  means and individual ( 95 %) CI
## 
##       value      std r       LCL      UCL Min Max
## CWP15   9.8 3.346640 5  7.151566 12.44843   7  15
## CWP20  15.4 3.130495 5 12.751566 18.04843  12  18
## CWP25  17.6 2.073644 5 14.951566 20.24843  14  19
## CWP30  21.6 2.607681 5 18.951566 24.24843  19  25
## CWP35  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.
## 
##       value groups
## CWP30  21.6      a
## CWP25  17.6      b
## CWP20  15.4      b
## CWP35  10.8      c
## CWP15   9.8      c

Therefore, we see that the mean of 30% cotton is different than that of 25%, 20%, 35%, 15% ; The mean of 25% cotton is similar to that of 20% but different to 30%, 35%, 15% ; The mean of 35% cotton is similar to that of 15% but different to 30%, 25%, 20%.

Plots:

plot(CWPs.test)

3.10 (c).

We conclude that the NPP is normally distributed and the residuals versus the predicted tensile strength plot looks fairly rectangular, and hence the variances are constant.

Answer 3.44

Suppose that four normal populations have means of u1=50, u2=60, u3=50, and u4=60. How many observations 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 a reasonable estimate of the error variance (sigma sqared) is = 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

The value of n = 2.17 ; Therefore, we can see that we will require approximately 3 samples from each group.

Answer 3.45

3.45 (a).

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

The value of n = 2.51 ; The sample number slightly increased, we can see that we will still require approximately 3 samples from each group.

3.45 (b).

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

The value of n = 2.93 ; The sample number slightly increased further, we can see that we will still require approximately 3 samples from each group.

3.45 (c).

We conclude that as the value of our estimate of the experimental error variance is increased, we will have to also increase the sample size in order to maintain the same power of the test.

3.45 (d).

The recommendations I would make for using this general approach to choosing n in practice is that it’s good to find out the sample sizes for different values of variances. We have clearly seen how an increase in variance will result in an increase in the sample size of the populations. However, one should also have a highest value for the variance estimate which should not be exceeded as per the experiment considerations.