Question 1

  1. Write the model equation for a full factorial model.

\[ Y_{ijkl} = \mu + \alpha_i + \beta_j + \gamma_k + (\alpha\beta){ij} + (\alpha\gamma){ik} + (\beta\gamma)_{jk} + (\alpha\beta\gamma)_{ijk} + \varepsilon_{ijkl}\]

\(Y_{ijkl}\): Powder density

\(\mu\): grand average

\(\alpha_i\): Ammonium effect

\(\beta_j\): Stir Rate effect

\(\gamma_k\):temperature effect

\((\alpha\beta)_{ij}\): ammonium and stir rate interaction

\((\alpha\gamma)_{ik}\): ammonium and temperature interaction

\((\beta\gamma)_{jk}\):stir rate and temperature interaction

\((\alpha\beta\gamma)_{ijk}\): interaction between 3 factors

\(\varepsilon_{ijkl}\):random error

  1. What factors are deemed significant, using α=.05 as a guide.  Report final p-values of significant factors (and interaction plots if necessary). 
library(GAD)
ammonium<-c(2,2,30,30,2,2,30,30,2,2,30,30,2,2,30,30)
stirrate<-c(100,100,100,100,150,150,150,150,100,100,100,100,150,150,150,150)
temperature<-c(8,8,8,8,8,8,8,8,40,40,40,40,40,40,40,40)
density<-c(14.68,15.18,15.12,17.48,7.54,6.66,12.46,12.62,10.95,17.68,12.65,15.96,8.03,8.84,14.96,14.96)
ammonium<-as.fixed(ammonium)

stirrate<-as.fixed(stirrate)

temperature<-as.fixed(temperature)




model<-aov(density~ammonium*stirrate*temperature)

GAD::gad(model)
## $anova
## Analysis of Variance Table
## 
## Response: density
##                               Df Sum Sq Mean Sq F value   Pr(>F)   
## ammonium                       1 44.389  44.389 11.1803 0.010175 * 
## stirrate                       1 70.686  70.686 17.8037 0.002918 **
## temperature                    1  0.328   0.328  0.0826 0.781170   
## ammonium:stirrate              1 28.117  28.117  7.0817 0.028754 * 
## ammonium:temperature           1  0.022   0.022  0.0055 0.942808   
## stirrate:temperature           1 10.128  10.128  2.5510 0.148890   
## ammonium:stirrate:temperature  1  1.519   1.519  0.3826 0.553412   
## Residuals                      8 31.762   3.970                    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
interaction.plot(stirrate, ammonium, density)

interaction.plot(x.factor=stirrate,trace.factor = ammonium,response=density,xlab="Stir Rate (RPM)",ylab="Mean Density",trace.label="Ammonium(%)",type="b")

the following effects are significant in the full model:

1- ammonium, p-value=0.010175 < alpha =0.05

2- stirrate, p-value=0.002918 < alpha=0.05

3-the interaction between ammonium and stirrate, p-value=0.028754 < alpha=0.05

Question 2

  1. Assume that both Temperature and Position are fixed effects.  Report p-values
library(GAD)
position<-c(rep(1,9),rep(2,9))
temp<-rep(seq(1,3),6)
bakeddensity<-c(570,1063,565,565,1080,510,583,1043,590,528,988,526,547,1026,538,521,1004,532)

temp<-as.fixed(temp)
position<-as.fixed(position)

model<-aov(bakeddensity~position+temp+position*temp)
GAD::gad(model)
## $anova
## Analysis of Variance Table
## 
## Response: bakeddensity
##               Df Sum Sq Mean Sq  F value   Pr(>F)    
## position       1   7160    7160   15.998 0.001762 ** 
## temp           2 945342  472671 1056.117 3.25e-14 ***
## position:temp  2    818     409    0.914 0.427110    
## Residuals     12   5371     448                      
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
  1. when both the position and temperature are fixed, p-value for position = 0.001762 , p-value for temperature = 3.25e-14, and for their interaction the p-value= 0.427110. At alpha=0.05, the position and temperature are significant because their p-value< 0.05 and the interaction is not significant because the p-value> 0.05.

  2. Assume that both Temperature and Position are random effects.  Report p-values 

library(GAD)
position<-c(rep(1,9),rep(2,9))
temp<-rep(seq(1,3),6)
bakeddensity<-c(570,1063,565,565,1080,510,583,1043,590,528,988,526,547,1026,538,521,1004,532)

temp<-as.random(temp)
position<-as.random(position)

model<-aov(bakeddensity~position+temp+position*temp)
GAD::gad(model)
## $anova
## Analysis of Variance Table
## 
## Response: bakeddensity
##               Df Sum Sq Mean Sq  F value    Pr(>F)    
## position       1   7160    7160   17.504 0.0526583 .  
## temp           2 945342  472671 1155.518 0.0008647 ***
## position:temp  2    818     409    0.914 0.4271101    
## Residuals     12   5371     448                       
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
  1. when both the position and temp are random, p-value for position = 00.0526583 , p-value for temp = 0.0008647, and for their interaction the p-value= 0.4271101. At alpha=0.05, the position is not signiificant because p-vale > 0.05, and temperature is significant because p-value< 0.05 and the interaction is not significant because the p-value> 0.05.

  2. assume the Position effect is fixed and the Temperature effect is random.  Report p-values

library(GAD)
position<-c(rep(1,9),rep(2,9))
temp<-rep(seq(1,3),6)
bakeddensity<-c(570,1063,565,565,1080,510,583,1043,590,528,988,526,547,1026,538,521,1004,532)

temp<-as.random(temp)
position<-as.fixed(position)

model<-aov(bakeddensity~position+temp+position*temp)
GAD::gad(model)
## $anova
## Analysis of Variance Table
## 
## Response: bakeddensity
##               Df Sum Sq Mean Sq  F value   Pr(>F)    
## position       1   7160    7160   17.504  0.05266 .  
## temp           2 945342  472671 1056.117 3.25e-14 ***
## position:temp  2    818     409    0.914  0.42711    
## Residuals     12   5371     448                      
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
  1. when position effect is fixed, the p-value = 0.05266 and the position is not significant because p-value > 0.05 , when temperature effect is random the p-value= 3.25e-14 and the temperature effect is significant because p-value<0.05. the interaction effect is not significant because p-value=0.42711> 0.05.

  2. Comment on similarities and/or differences between the p-values in parts a,b,c.   

The position p-value is the same in parts (b) and (c), while the temperature p-value is the same in parts (a) and (c). the interaction p-value is the same in all three parts. the differences occur because the models use different denominators in the F-tests.