Problem No. 3.7

t1<-c(3129,3000,2865,2890)
t2<-c(3200,3300,2975,3150)
t3<-c(2800,2900,2985,3050)
t4<-c(2600,2700,2600,2765)
dat<-data.frame(t1,t2,t3,t4)
dat
##     t1   t2   t3   t4
## 1 3129 3200 2800 2600
## 2 3000 3300 2900 2700
## 3 2865 2975 2985 2600
## 4 2890 3150 3050 2765
library(tidyr)
dat<-pivot_longer(dat,c(t1,t2,t3,t4))
dat
## # A tibble: 16 x 2
##    name  value
##    <chr> <dbl>
##  1 t1     3129
##  2 t2     3200
##  3 t3     2800
##  4 t4     2600
##  5 t1     3000
##  6 t2     3300
##  7 t3     2900
##  8 t4     2700
##  9 t1     2865
## 10 t2     2975
## 11 t3     2985
## 12 t4     2600
## 13 t1     2890
## 14 t2     3150
## 15 t3     3050
## 16 t4     2765
aov.model<-aov(value~name,data=dat)
summary(aov.model)
##             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
plot(aov.model)

## hat values (leverages) are all = 0.25
##  and there are no factor predictors; no plot no. 5

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

t1<-rnorm(4,mean=2971,sd=120.55704)
t2<-rnorm(4,mean=3156.25,sd=135.97641)
t3<-rnorm(4,mean=2933.75,sd=108.27242)
t4<-rnorm(4,mean=2666.25,sd=80.97067)
t<-c(t1,t2,t3,t4)
x<-c(rep(1,4),rep(2,4),rep(3,4),rep(4,4))
meanx<-c(rep(mean(t1),4),rep(mean(t2),4),rep(mean(t3),4),rep(mean(t4),4))
res<-t-meanx
qqnorm(res)
qqline(res)

plot(meanx,res,xlab="Predicted Tensile Strength",ylab="residual",
     main="constant variance check")

Answers:-

Testing Hypothesis:-

The hypothesis is given by: H_{0}: The mean tensile strength of cement for four different mixing techniques are the same.

H_{1}: The mean tensile strength of cement for at least one different mixing techniques differ.

As p=0.00048 value is less than 0.05, hence we conclude that we reject the null hypothesis

c)

Using the Fisher LSD method with alpha=0.05 to make comparisons between pairs of means

From the LSD method we can conclude that t4 is significantly different from t1,t2,t3 as it does not lie in the same group at 5% level of significance and the least Significant Difference: 174.4798

The difference between the means of t2 and t1 is greater than 174.4798

The difference between the means of t2 and t4 is greater than 174.4798

The difference between the means of t2 and t3 is greater than 174.4798

The difference between the means of t1 and t3 is lesser than 174.4798

The difference between the means of t3 and t4 is greater than 174.4798

d)

From the normal probability plots of residuals we can conclude that data is normally distributed.

e)

From the residuals vs predicted tensile strength plot we can observe that data is spread evenly across groups.

f)

From the scattered plot we can say that data is evenally scattered

Problem No.3.10

cw15<-c(7,7,15,11,9)
cw20<-c(12,17,12,18,18)
cw25<-c(14,19,19,18,18)
cw30<-c(19,25,22,19,23)
cw35<-c(7,10,11,15,11)
dat<-data.frame(cw15,cw20,cw25,cw30,cw35)
dat
##   cw15 cw20 cw25 cw30 cw35
## 1    7   12   14   19    7
## 2    7   17   19   25   10
## 3   15   12   19   22   11
## 4   11   18   18   19   15
## 5    9   18   18   23   11
library(tidyr)
dat<-pivot_longer(dat,c(cw15,cw20,cw25,cw30,cw35))
dat
## # A tibble: 25 x 2
##    name  value
##    <chr> <dbl>
##  1 cw15      7
##  2 cw20     12
##  3 cw25     14
##  4 cw30     19
##  5 cw35      7
##  6 cw15      7
##  7 cw20     17
##  8 cw25     19
##  9 cw30     25
## 10 cw35     10
## # ... with 15 more rows
aov.model<-aov(value~name,data=dat)
summary(aov.model)
##             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
plot(aov.model)

## hat values (leverages) are all = 0.2
##  and there are no factor predictors; no plot no. 5

library(agricolae)
a<-LSD.test(aov.model,"name",20,8.06,console = TRUE)
## 
## Study: aov.model ~ "name"
## 
## LSD t Test for value 
## 
## Mean Square Error:  8.06 
## 
## name,  means and individual ( 95 %) CI
## 
##      value      std r       LCL      UCL Min Max
## cw15   9.8 3.346640 5  7.151566 12.44843   7  15
## cw20  15.4 3.130495 5 12.751566 18.04843  12  18
## cw25  17.6 2.073644 5 14.951566 20.24843  14  19
## cw30  21.6 2.607681 5 18.951566 24.24843  19  25
## cw35  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
## cw30  21.6      a
## cw25  17.6      b
## cw20  15.4      b
## cw35  10.8      c
## cw15   9.8      c
plot(a)

cw15<-rnorm(5,mean=9.8,sd=3.346640)
cw20<-rnorm(5,mean=15.4,sd=3.130495)
cw25<-rnorm(5,mean=17.6,sd=2.073644)
cw30<-rnorm(5,mean=21.6,sd=2.607681)
cw35<-rnorm(5,mean=10.8,sd=2.863564)
cw<-c(cw15,cw20,cw25,cw30,cw35)
x<-c(rep(1,5),rep(2,5),rep(3,5),rep(4,5))
meanx<-c(rep(mean(cw15),5),rep(mean(cw20),5),rep(mean(cw25),5),rep(mean(cw30),5),rep(mean(cw35),5))
res<-cw-meanx
qqnorm(res)
qqline(res)

plot(meanx,res,xlab="Predicted Tensile Strength",ylab="residual",
     main="constant variance check")

Answers:-

The hypothesis is given by: H_{0}: The mean of observations of cotton percentage is same.

H_{1}: The mean observations of cotton percentage for at least one mean differ.

b)

Using the Fisher LSD method to make comparisons between pairs of means

From the LSD method we can conclude that the there is significance difference in means of cw30,cw25 and cw20,and cw35,cw35 and Minimum Significant Difference is 3.745452.

The difference between the means of group 4 and 3 is greater than 3.3.745452

The difference between the means of group 2 and 4 is greater than 3.3.745452

The difference between the means of group 5 and 4 is greater than 3.3.745452

The difference between the means of group 1 and 4 is greater than 3.3.745452

The difference between the means of group 5 and 1 is lesser than 3.3.745452

The difference between the means of group 3 and 2 is lesser than 3.3.745452

c)

From the residuals form this experiment, we can conclude that model is adequate as it meets the normality.

Question 3.44

The hypothesis is given by: H_{0}: The means of observations is same.

H_{1}: at least one mean differ.

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

Answer:-

From the results of variance power calculation, 5 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 and alpha= 0.05 and that a reasonable estimate of the error variance is 25.

Question 3.45

a

The hypothesis is given by:

H_{0}: The means of observations is same.

H_{1}: at least one mean differ.

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

Answer:-

a

From the results of variance power calculation, 7 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 and alpha= 0.05 and that a reasonable estimate of the error variance is 36.

b

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

Answer:-

From the results of variance power calculation, 8 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 and alpha= 0.05 and that a reasonable estimate of the error variance is 49

c

From above results of variance power calculation, we can conclude that sample size has slightly positive correlation with increase in estimate of variance.

d

When we don’t have the prior estimate of variance, we will generate sample sizes for a range of possible variances to see what effect this has on the size of the experiment.