R Markdown

Question 1:

Null Hypothesis Testing

H0:μ1=μ2=μ3=μ4

Linear Equation

yi,j=μ+τi+βj+ϵi,j

library(GAD)

chemical is a factor (4 levels), bolts is observed (n=4).

chemical<-c(rep(1,4),rep(2,4),rep(3,4),rep(4,4))
chemical
##  [1] 1 1 1 1 2 2 2 2 3 3 3 3 4 4 4 4
obs<-c(73,68,74,71,
       73,67,75,72,
       75,68,78,73,
       73,71,75,75)
obs
##  [1] 73 68 74 71 73 67 75 72 75 68 78 73 73 71 75 75
chemical<-as.fixed(chemical)

Running the Model with Blocked Observations:

model<-lm(obs~chemical)
gad(model)
## $anova
## Analysis of Variance Table
## 
## Response: obs
##           Df  Sum Sq Mean Sq F value Pr(>F)
## chemical   3  14.187  4.7292  0.4739 0.7062
## Residuals 12 119.750  9.9792

P value is 0.7052>0.15 hence we fail to reject Null hypothesis(H0)

Question 2

Null Hypothesis Testing

H0:μ1=μ2=μ3=μ4

Linear Equation

yi,j=μ+τi+ϵi,j

Solution (4 levels), bolts (n=4), sequencing in 4s.

solution<-c(rep(1,4),rep(2,4),rep(3,4),rep(4,4))
solution
##  [1] 1 1 1 1 2 2 2 2 3 3 3 3 4 4 4 4
bolts<-c(seq(1,4),seq(1,4),seq(1,4),seq(1,4))
bolts
##  [1] 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4
obs<-c(73,68,74,71,
       73,67,75,72,
       75,68,78,73,
       73,71,75,75)
obs
##  [1] 73 68 74 71 73 67 75 72 75 68 78 73 73 71 75 75
solution<-as.random(solution)
bolts<-as.random(bolts)
model<-lm(obs~solution+bolts)
gad(model)
## $anova
## Analysis of Variance Table
## 
## Response: obs
##           Df  Sum Sq Mean Sq F value    Pr(>F)    
## solution   3  14.187   4.729  2.7349 0.1057217    
## bolts      3 104.188  34.729 20.0843 0.0002515 ***
## Residuals  9  15.563   1.729                      
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

as.random(bolts) used for unblocked (no blocking) design

P value is 0.105<0.15 hence we rejectNull Hypothesis H0

Question 3

In the first case (with blocking), P = 0.7062 > 0.15, so we failed to reject the null hypothesis—no significant treatment differences. In the second case (without blocking), P = 0.105 < 0.15, so we rejected the null hypothesis—indicating treatment differences. This shows that blocking helped control nuisance variability, reducing the residual mean square from 9.979 (CRD) to 1.729 (RCBD), which increased the F-value and improved test sensitivity.