1 Assignment on Nested design

  • Model Equation:

    \[ Y_{i,j,k} = \mu +\alpha_i +\beta_{j(i)} + \epsilon_{i,j,k} \\ where, \mu = main\ effect\\ \alpha_i = treatment\ effect\ of\ i \\ \beta_{j(i)} = treatment\ effect\ of\ j\ in\ i\\ \epsilon_{i,j,k} = Random\ effect\ of \ i,j,k \]

  • Data Input to R

library(GAD)
obs <- c(25,19,15,15,19,23,18,35,14,35,38,25,
        30,28,17,16,17,24,21,27,15,21,54,29,
        26,20,14,13,14,21,17,25,20,24,50,33)
batch <- c(rep(seq(1,4),9))
process <- c(rep(c(rep("p1",4),rep("p2",4),rep("p3",4)),3))
dat <- data.frame(process,batch,obs)
  • Hypothesis testing

    \[ Null\ Hypothesis:\ \alpha_i = 0\\ Alternate\ Hypothesis:\ \alpha_i \neq 0\\ \\ Nested\ Null\ Hypothesis:\ \beta_{j(i)} = 0\\ Nested\ Alternate\ Hypothesis:\ \beta_{j(i)} \neq 0 \]

process <- as.fixed(process)
batch <- as.random(batch)
model <- lm(obs ~ process + batch%in%process)
gad(model)
## Analysis of Variance Table
## 
## Response: obs
##               Df  Sum Sq Mean Sq F value    Pr(>F)    
## process        2  676.06  338.03  1.4643    0.2815    
## process:batch  9 2077.58  230.84 12.2031 5.477e-07 ***
## Residual      24  454.00   18.92                      
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
  • Comment: The Nested hypothesis we tested for the model appears to be significant, as we got the p-value = 5.477e-07 which is less than the significant value \(\alpha=0.05\)

2 Complete R Code

library(GAD)
obs <- c(25,19,15,15,19,23,18,35,14,35,38,25,
        30,28,17,16,17,24,21,27,15,21,54,29,
        26,20,14,13,14,21,17,25,20,24,50,33)
batch <- c(rep(seq(1,4),9))
process <- c(rep(c(rep("p1",4),rep("p2",4),rep("p3",4)),3))
dat <- data.frame(process,batch,obs)

process <- as.fixed(process)
batch <- as.random(batch)
model <- lm(obs ~ process + batch%in%process)
gad(model)