#-----------------------------------------------------------------------------------
## Nested Model with no intercept
#-----------------------------------------------------------------------------------
data(Table1.2)
Table1.2$Batch <- factor(x = Table1.2$Batch)
Exam2.B.5.lm1 <- lm(formula = Y ~ 0 + Batch + Batch/X, data = Table1.2)
DesignMatrix.lm1 <- model.matrix (object = Exam2.B.5.lm1)
DesignMatrix.lm1
#-----------------------------------------------------------------------------------
## Interaction Model with intercept
#-----------------------------------------------------------------------------------
Exam2.B.5.lm2 <-lm(formula = Y ~ Batch + X + Batch*X, data = Table1.2)
DesignMatrix.lm2 <- model.matrix (object = Exam2.B.5.lm2)
DesignMatrix.lm2
#-----------------------------------------------------------------------------------
## Interaction Model with no intercept
#-----------------------------------------------------------------------------------
Exam2.B.5.lm3 <- lm(formula = Y ~ 0 + Batch + Batch*X, data = Table1.2)
DesignMatrix.lm3 <- model.matrix(object = Exam2.B.5.lm3)
DesignMatrix.lm3
#-----------------------------------------------------------------------------------
## Interaction Model with intercept but omitting X term as main effect
#-----------------------------------------------------------------------------------
Exam2.B.5.lm4 <- lm(formula = Y ~ Batch + Batch*X, data = Table1.2)
DesignMatrix.lm4 <- model.matrix(object = Exam2.B.5.lm4)
DesignMatrix.lm4
Run the code above in your browser using DataLab