Answer 4.3

Stating Hypothesis:

  • Null Hypothesis

    \(H_o : \mu_1 = \mu_2 = \mu_3 =\mu_i\)

  • Alternative Hypothesis:

    \(Ha\) : atleast one \(\mu_i\) differs

As we know it has fixed effects hence we can write our hypothesis as,

  • Null Hypothesis:

    \(H_o : \tau_i=0\) for all i

  • Alternative Hypothesis:

    \(H_a\) : \(\tau_i \neq 0\) for some i

Linear Effects:

\(y_{ij} = \mu + \tau_i + \epsilon_{ij}\)

Where \(\mu\) is the grand mean

Where \(\tau_i\) is the fixed effects for treatment i

Where \(\epsilon_{ij}\) is the random error

TensileStrengths <- c(73,68,74,71,67,73,67,75,72,70,75,68,78,73,68,73,71,75,75,69)
Chemical <- c(rep(1,5),rep(2,5),rep(3,5),rep(4,5))
Bolt <- c(seq(1,5),seq(1,5),seq(1,5),seq(1,5))
Bolt<-as.fixed(Bolt)
Chemical<-as.fixed(Chemical)
model1 <- lm(TensileStrengths~Chemical+Bolt)
gad(model1)
## Analysis of Variance Table
## 
## Response: TensileStrengths
##          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

The p-value of the chemicals is = 0.1211 > alpha = 0.05. Hence, we fail to reject the Null Hypothesis and conclude that there is no difference among chemical types.

Answer 4.16

We know that \(\tau_i\) = \(\mu_i\) - \(\mu\) ; and \(\beta_i\) = \(\mu_j\) - \(\mu\)

Tau1 <- mean(TensileStrengths[1:5])-mean(TensileStrengths)
Tau1
## [1] -1.15
Tau2 <- mean(TensileStrengths[6:10])-mean(TensileStrengths)
Tau2
## [1] -0.35
Tau3 <- mean(TensileStrengths[11:15])-mean(TensileStrengths)
Tau3
## [1] 0.65
Tau4 <- mean(TensileStrengths[16:20])-mean(TensileStrengths)
Tau4
## [1] 0.85
Beta1 <- mean(c(73,73,75,73))-mean(TensileStrengths)
Beta1
## [1] 1.75
Beta2 <- mean(c(68,67,68,71))-mean(TensileStrengths)
Beta2
## [1] -3.25
Beta3 <- mean(c(74,75,78,75))-mean(TensileStrengths)
Beta3
## [1] 3.75
Beta4 <- mean(c(71,72,73,75))-mean(TensileStrengths)
Beta4
## [1] 1
Beta5 <- mean(c(67,70,68,69))-mean(TensileStrengths)
Beta5
## [1] -3.25

\(\tau_i\) Values:

  • \(\tau_1\) = -1.15

  • \(\tau_2\) = -0.35

  • \(\tau_3\) = 0.65

  • \(\tau_4\) = 0.85

\(\beta_i\) Values:

  • \(\beta_1\) = 1.75

  • \(\beta_2\) = -3.25

  • \(\beta_3\) = 3.75

  • \(\beta_4\) = 1

  • \(\beta_5\) = -3.25

Answer 4.22

Null Hypothesis: The ingredients have no effect on the reaction time of a chemical process; \(\tau_i\) = 0

Alternative Hypothesis: The ingredients have an effect on the reaction time of a chemical process; \(\tau_i \neq 0\)

Observations <-  c(8,7,1,7,3,11,2,7,3,8,4,9,10,1,5,6,8,6,6,10,4,2,3,8,8)
Ingredients <- c("A","B","D","C","E","C","E","A","D","B","B","A","C","E","D","D","C","E","B","A","E","D","B","A","C")
Batch <- c(rep(1,5), rep(2,5), rep(3,5), rep(4,5), rep(5,5))
Days <- c(rep(seq(1,5),5))

dat <- cbind(Observations, Ingredients, Batch, Days)
dat <- as.data.frame(dat)

dat$Ingredients <- as.fixed(dat$Ingredients)
dat$Batch <- as.fixed(dat$Batch)
dat$Days <- as.fixed(dat$Days)

model2 <- aov(Observations~Batch+Days+Ingredients, data = dat)
summary(model2)
##             Df Sum Sq Mean Sq F value   Pr(>F)    
## Batch        4  15.44    3.86   1.235 0.347618    
## Days         4  12.24    3.06   0.979 0.455014    
## Ingredients  4 141.44   35.36  11.309 0.000488 ***
## Residuals   12  37.52    3.13                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

As we can see from the anova test on the Latin Square model, since the P-value = 0.000488 < alpha = 0.05, we reject the null hypothesis and conclude that at least one of the means differs. The factor of interest here is ingredients. The P-values for Batch & Days is much greater than alpha, and they are recognized as blocks as they are a nuisance and not the subjects we are studying on. Hence, the ingredients do have an effect on the reaction time.

All R Code:

TensileStrengths <- c(73,68,74,71,67,73,67,75,72,70,75,68,78,73,68,73,71,75,75,69)
Chemical <- c(rep(1,5),rep(2,5),rep(3,5),rep(4,5))
Bolt <- c(seq(1,5),seq(1,5),seq(1,5),seq(1,5))
Bolt<-as.fixed(Bolt)
Chemical<-as.fixed(Chemical)
model1 <- lm(TensileStrengths~Chemical+Bolt)
gad(model1)

Tau1 <- mean(TensileStrengths[1:5])-mean(TensileStrengths)
Tau1
Tau2 <- mean(TensileStrengths[6:10])-mean(TensileStrengths)
Tau2
Tau3 <- mean(TensileStrengths[11:15])-mean(TensileStrengths)
Tau3
Tau4 <- mean(TensileStrengths[16:20])-mean(TensileStrengths)
Tau4

Beta1 <- mean(c(73,73,75,73))-mean(TensileStrengths)
Beta1
Beta2 <- mean(c(68,67,68,71))-mean(TensileStrengths)
Beta2
Beta3 <- mean(c(74,75,78,75))-mean(TensileStrengths)
Beta3
Beta4 <- mean(c(71,72,73,75))-mean(TensileStrengths)
Beta4
Beta5 <- mean(c(67,70,68,69))-mean(TensileStrengths)
Beta5

Observations <-  c(8,7,1,7,3,11,2,7,3,8,4,9,10,1,5,6,8,6,6,10,4,2,3,8,8)
Ingredients <- c("A","B","D","C","E","C","E","A","D","B","B","A","C","E","D","D","C","E","B","A","E","D","B","A","C")
Batch <- c(rep(1,5), rep(2,5), rep(3,5), rep(4,5), rep(5,5))
Days <- c(rep(seq(1,5),5))

dat <- cbind(Observations, Ingredients, Batch, Days)
dat <- as.data.frame(dat)

dat$Ingredients <- as.fixed(dat$Ingredients)
dat$Batch <- as.fixed(dat$Batch)
dat$Days <- as.fixed(dat$Days)

model2 <- aov(Observations~Batch+Days+Ingredients, data = dat)
summary(model2)