Q1

a)

\(X_{ijk}=\mu+\alpha_i+\beta_j+\gamma_k+\alpha\beta_{ij}+\beta\gamma_{jk}+\alpha\gamma_{ik}+\alpha\beta\gamma_{ijk}+\epsilon_{ijk}\)

b)

library(GAD)
data=read.csv("https://raw.githubusercontent.com/tmatis12/datafiles/main/PowderProduction.csv")
Ammonium <- as.fixed(data$Ammonium)
Temperature <- as.fixed(data$Temperature)
StirRate <- as.fixed(data$StirRate)
density <- as.numeric(data$Density)
model <- aov(density~Ammonium+Temperature+StirRate+Ammonium*Temperature+Ammonium*StirRate+Temperature*StirRate+Ammonium*Temperature*StirRate, data = data)
summary(model)
##                               Df Sum Sq Mean Sq F value  Pr(>F)   
## Ammonium                       1  44.39   44.39  11.180 0.01018 * 
## Temperature                    1   0.33    0.33   0.083 0.78117   
## StirRate                       1  70.69   70.69  17.804 0.00292 **
## Ammonium:Temperature           1   0.02    0.02   0.005 0.94281   
## Ammonium:StirRate              1  28.12   28.12   7.082 0.02875 * 
## Temperature:StirRate           1  10.13   10.13   2.551 0.14889   
## Ammonium:Temperature:StirRate  1   1.52    1.52   0.383 0.55341   
## Residuals                      8  31.76    3.97                   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

By evaluating all the factors and their interactions, we can see that the only interaction effect with \(\alpha=0.05\) level of significance is the ammonium and the stir rate interaction. Therefore we will repeat the test with only that interaction. Furthermore, temperature’s effect on the density seems to be no significant, thus, we will remove it from the anaysis too.

model1 <- aov(density~Ammonium+StirRate+Ammonium*StirRate, data = data)
summary(model1)
##                   Df Sum Sq Mean Sq F value   Pr(>F)    
## Ammonium           1  44.39   44.39   12.17 0.004472 ** 
## StirRate           1  70.69   70.69   19.38 0.000861 ***
## Ammonium:StirRate  1  28.12   28.12    7.71 0.016751 *  
## Residuals         12  43.76    3.65                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
interaction.plot(data$Ammonium,data$StirRate,data$Density)

While both ammonium, stir rate and their interaction effcts were found to be significant, the interaction plot doesn’t show any interactions.

Q2

Temp <- c(rep(800,6),rep(825,6),rep(850,6))
Pos <- c(rep(1,3),rep(2,3),rep(1,3),rep(2,3),rep(1,3),rep(2,3))
den <- c(570,565,583,528,547,521,1063,1080,1043,988,1026,1004,565,510,590,526,538,532)
dat <- data.frame(den,Pos,Temp)

a)

temp1 <- as.fixed(Temp)
pos1 <- as.fixed(Pos)
model2 <- aov(den~temp1+pos1+temp1*pos1,data = dat)
summary(model2)
##             Df Sum Sq Mean Sq  F value   Pr(>F)    
## temp1        2 945342  472671 1056.117 3.25e-14 ***
## pos1         1   7160    7160   15.998  0.00176 ** 
## temp1:pos1   2    818     409    0.914  0.42711    
## Residuals   12   5371     448                      
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Both effects are significant (\(\alpha<0.05\)) but the interaction is not significant (\(\alpha>0.05\)).

b)

temp2 <- as.random(Temp)
pos2 <- as.random(Pos)
model3 <- aov(den~temp2+pos2+temp2*pos2,data = dat)
gad(model3)
## Analysis of Variance Table
## 
## Response: den
##            Df Sum Sq Mean Sq  F value    Pr(>F)    
## temp2       2 945342  472671 1155.518 0.0008647 ***
## pos2        1   7160    7160   17.504 0.0526583 .  
## temp2:pos2  2    818     409    0.914 0.4271101    
## Residual   12   5371     448                       
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

As these results show, the only effect with a p-value of lower than 0.05 is the temperature.

c)

temp3 <- as.random(Temp)
pos3 <- as.fixed(Pos)
model4 <- aov(den~temp3+pos3+temp3*pos3,data = dat)
gad(model4)
## Analysis of Variance Table
## 
## Response: den
##            Df Sum Sq Mean Sq  F value   Pr(>F)    
## temp3       2 945342  472671 1056.117 3.25e-14 ***
## pos3        1   7160    7160   17.504  0.05266 .  
## temp3:pos3  2    818     409    0.914  0.42711    
## Residual   12   5371     448                      
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

similar to par b, the only signifcant effect with \(\alpha=0.05\) is the temperature.

d)

When we considered each effect to be random, their respetive p-value decreased. since for a random effect the the F value is calculated by dividing the MStr for the given effect by the MS interaction as opposed to MSE, and the MS interaction is lower than the MSE, this result was to be expected.