Question 1

Hypothesis:

Null hypothesis: \(H_0: \mu_{1}=\mu_{2}=\mu_{3}=\mu\)

Alternative hypothesis: \(H_1:\) at least one \(\mu_{i}\) differs

library(GAD)
## Loading required package: matrixStats
## Loading required package: R.methodsS3
## R.methodsS3 v1.8.1 (2020-08-26 16:20:06 UTC) successfully loaded. See ?R.methodsS3 for help.
library(tidyr)
library(dplyr)
## 
## Attaching package: 'dplyr'
## The following object is masked from 'package:matrixStats':
## 
##     count
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
dat<-read.csv("C:/R Activities/Week 7/Homework/4.3_Data.csv",header=TRUE)
dat<-pivot_longer(dat,c(bolt1,bolt2,bolt3,bolt4,bolt5))
colnames(dat)<-c("x","name","value")
Chemical<-as.fixed(dat$x)
Chemical
##  [1] chem1 chem1 chem1 chem1 chem1 chem2 chem2 chem2 chem2 chem2 chem3 chem3
## [13] chem3 chem3 chem3 chem4 chem4 chem4 chem4 chem4
## Levels: chem1 chem2 chem3 chem4
Bolt<-as.random(dat$name)
# result is the same using block as random or fixed
obs<-c(dat$value) 
obs
##  [1] 73 68 74 71 67 73 67 75 72 70 75 68 78 73 68 73 71 75 75 69
model<-lm(obs~Chemical+Bolt)
gad(model)
## Analysis of Variance Table
## 
## Response: obs
##          Df Sum Sq Mean Sq F value    Pr(>F)    
## Chemical  3  12.95   4.317  2.3761    0.1211    
## Bolt      4 157.00  39.250 21.6055 2.059e-05 ***
## Residual 12  21.80   1.817                      
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Since p-value = 0.1211 < \(\alpha\) of 0.15.

He would reject the Null Hypothesis (\(H_0: \mu_{1}=\mu_{2}=\mu_{3}=\mu\))

Q2

model2<-lm(obs~Chemical, data = dat)
gad(model2)
## Analysis of Variance Table
## 
## Response: obs
##          Df Sum Sq Mean Sq F value Pr(>F)
## Chemical  3  12.95  4.3167  0.3863 0.7644
## Residual 16 178.80 11.1750

Since p-value = 0.7644 > \(\alpha\) of 0.15.

He would reject the Null Hypothesis (\(H_0: \mu_{1}=\mu_{2}=\mu_{3}=\mu\))

Q3

Hence, in the first experiment we have RBD that which isolates the variation by the blocks. On the other hand, in the CRD the variation is grouped for the all sample.

Therefore, the conditions are as homogeneous as possible inside the block, between blocks the variance may have a difference.

Analysing the mean square error in the first experiment, MSE=39.250 that is bigger than in the second experiment MSE=11.175 which give us a large f-value for the second experiment too.

Thus, we can conclude the variance implies in a difference in the MSE that implies in a difference between the f-values, making our conclusions been different for \(\alpha\) of 0.15.

Hence the Bolt of cloth represents a significant amount of nuisance variability.

All code

library(GAD)
library(tidyr)
library(dplyr)
dat<-read.csv("C:/R Activities/Week 7/Homework/4.3_Data.csv",header=TRUE)
dat<-pivot_longer(dat,c(bolt1,bolt2,bolt3,bolt4,bolt5))
colnames(dat)<-c("x","name","value")
Chemical<-as.fixed(dat$x)
Chemical
Bolt<-as.random(dat$name)
# result is the same using block as random or fixed
obs<-c(dat$value) 
obs
model<-lm(obs~Chemical+Bolt)
gad(model)
model2<-lm(obs~Chemical, data = dat)
gad(model2)