1.

An article in Quality Progress (May 2011, pp. 42–48) describes the use of factorial experiments to improve a silver powder production process. This product is used in conductive pastes to manufacture a wide variety of products ranging from silicon wafers to elastic membrane switches. We consider powder density (g/cm2)(g/cm2) as the response variable and critical characteristics of this product. The data is shown below.

dafr <- read.csv('https://raw.githubusercontent.com/tmatis12/datafiles/main/PowderProduction.csv')
colnames(dafr) <- c('Ammoinium','stirrate','Temp','Density')

\(y_{ijkl}=\mu+\alpha_{i}+\beta_j+\gamma_k+\alpha\beta_{ij}+\alpha\gamma_{ik}+\beta\gamma_{jk}+\alpha\beta\gamma_{ijk}+\epsilon_{ijkl}\)

We will do a stepwise elimination of factors to arrive at our final ANOVA model. FOr each interation, we are starting with the highest factor interaction and eliminating the nonsignificant ones. Our null hypothesis each time is that each of the factors in the above equation is 0, versus alternative hypothesis that they are not. Our significance level is .05

library(GAD)
dafr$Ammoinium <- as.fixed(dafr$Ammoinium)
dafr$stirrate <- as.fixed(dafr$stirrate)
dafr$Temp <- as.fixed(dafr$Temp)
model <- aov(Density~Ammoinium+stirrate+Temp+Ammoinium*stirrate+Ammoinium*Temp+stirrate*Temp+Ammoinium*stirrate*Temp,dafr)
GAD::gad(model)
## Analysis of Variance Table
## 
## Response: Density
##                         Df Sum Sq Mean Sq F value   Pr(>F)   
## Ammoinium                1 44.389  44.389 11.1803 0.010175 * 
## stirrate                 1 70.686  70.686 17.8037 0.002918 **
## Temp                     1  0.328   0.328  0.0826 0.781170   
## Ammoinium:stirrate       1 28.117  28.117  7.0817 0.028754 * 
## Ammoinium:Temp           1  0.022   0.022  0.0055 0.942808   
## stirrate:Temp            1 10.128  10.128  2.5510 0.148890   
## Ammoinium:stirrate:Temp  1  1.519   1.519  0.3826 0.553412   
## Residual                 8 31.762   3.970                    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

We will eliminate the highest factor interaction (the triple).

model <- aov(Density~Ammoinium+stirrate+Temp+Ammoinium*stirrate+Ammoinium*Temp+stirrate*Temp,dafr)
GAD::gad(model)
## Analysis of Variance Table
## 
## Response: Density
##                    Df Sum Sq Mean Sq F value   Pr(>F)   
## Ammoinium           1 44.389  44.389 12.0037 0.007109 **
## stirrate            1 70.686  70.686 19.1150 0.001792 **
## Temp                1  0.328   0.328  0.0886 0.772681   
## Ammoinium:stirrate  1 28.117  28.117  7.6033 0.022206 * 
## Ammoinium:Temp      1  0.022   0.022  0.0059 0.940538   
## stirrate:Temp       1 10.128  10.128  2.7389 0.132317   
## Residual            9 33.281   3.698                    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

We will eliminate Ammonium:Temp, since is is the least significant out of the two factor interactions.

model <- aov(Density~Ammoinium+stirrate+Temp+Ammoinium*stirrate+stirrate*Temp,dafr)
GAD::gad(model)
## Analysis of Variance Table
## 
## Response: Density
##                    Df Sum Sq Mean Sq F value    Pr(>F)    
## Ammoinium           1 44.389  44.389 13.3287 0.0044560 ** 
## stirrate            1 70.686  70.686 21.2250 0.0009696 ***
## Temp                1  0.328   0.328  0.0984 0.7601850    
## Ammoinium:stirrate  1 28.117  28.117  8.4426 0.0156821 *  
## stirrate:Temp       1 10.128  10.128  3.0412 0.1117751    
## Residual           10 33.303   3.330                      
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

We will eliminate Stirrate:Temp, since is is the least significant out of the two factor interactions.

model <- aov(Density~Ammoinium+stirrate+Temp+Ammoinium*stirrate,dafr)
GAD::gad(model)
## Analysis of Variance Table
## 
## Response: Density
##                    Df Sum Sq Mean Sq F value   Pr(>F)   
## Ammoinium           1 44.389  44.389 11.2425 0.006443 **
## stirrate            1 70.686  70.686 17.9028 0.001410 **
## Temp                1  0.328   0.328  0.0830 0.778613   
## Ammoinium:stirrate  1 28.117  28.117  7.1211 0.021851 * 
## Residual           11 43.431   3.948                    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

We will eliminate Temp now, since our last remaining two factor interaction is significant, we are now checking the main effects. Temp can be eliminated, even as a main effect, since it is not significant and it is not part of any significant higher order interactions.

model <- aov(Density~Ammoinium+stirrate+Ammoinium*stirrate,dafr)
GAD::gad(model)
## Analysis of Variance Table
## 
## Response: Density
##                    Df Sum Sq Mean Sq F value    Pr(>F)    
## Ammoinium           1 44.389  44.389 12.1727 0.0044721 ** 
## stirrate            1 70.686  70.686 19.3841 0.0008612 ***
## Ammoinium:stirrate  1 28.117  28.117  7.7103 0.0167511 *  
## Residual           12 43.759   3.647                      
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

All of our remaining factors are significant, therefore this is our optimal model.

interaction.plot(dafr$Ammoinium,dafr$stirrate,dafr$Density,xlab='Ammonium',ylab='Density',trace.label='Stir Rate')

This shows our interaction plot between Ammonium and Stir Rate. Since the two lines are clearly not parallell, we can see the interaction here.

2.

A full factorial experiment was conducted to determine whether either firing temperature or furnace position affects the baked density of a carbon anode.

dat = c(570,    1063,   565 ,565,   1080    ,510    ,583    ,1043,  590 ,528,   988,    526 ,547    ,1026,  538,    521 ,1004,  532)
position <- as.fixed(c(rep(1,9),rep(2,9)))
Temp <- as.fixed(c(rep(c(800,825,850),6)))

a)

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

model <- aov(dat~position+Temp+position*Temp)
GAD::gad(model)
## Analysis of Variance Table
## 
## Response: dat
##               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    
## Residual      12   5371     448                      
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Our pvalues for our main effects are both under .05 and thus significant. Our interaction is not significant however.

b)

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

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

Here we find that our Position factor is no longer significant when seen as a random instead of fixed. Our interaction remains the same(not significant) and Temperature is slightly less significant but is still well below our alpha of .05.

c)

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

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

So our Temperature value is back to our original p-value found in part a(and is significant), while our position factor is not significant now. Our interaction still stays the same and is not significant.

d)

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

Our interaction pvalues do not change, regardless of fixed,mixed, or random. In a mixed model, the p values of those that are fixed are the same p values gotten in the random effects model, while those factors that are random have the same p values as gotten in a fixed model.

All Code:

dafr <- read.csv('https://raw.githubusercontent.com/tmatis12/datafiles/main/PowderProduction.csv')
colnames(dafr) <- c('Ammoinium','stirrate','Temp','Density')

library(GAD)
dafr$Ammoinium <- as.fixed(dafr$Ammoinium)
dafr$stirrate <- as.fixed(dafr$stirrate)
dafr$Temp <- as.fixed(dafr$Temp)
model <- aov(Density~Ammoinium+stirrate+Temp+Ammoinium*stirrate+Ammoinium*Temp+stirrate*Temp+Ammoinium*stirrate*Temp,dafr)
GAD::gad(model)

model <- aov(Density~Ammoinium+stirrate+Temp+Ammoinium*stirrate+Ammoinium*Temp+stirrate*Temp,dafr)
GAD::gad(model)

model <- aov(Density~Ammoinium+stirrate+Temp+Ammoinium*stirrate+stirrate*Temp,dafr)
GAD::gad(model)

model <- aov(Density~Ammoinium+stirrate+Temp+Ammoinium*stirrate,dafr)
GAD::gad(model)

model <- aov(Density~Ammoinium+stirrate+Ammoinium*stirrate,dafr)
GAD::gad(model)

interaction.plot(dafr$Ammoinium,dafr$stirrate,dafr$Density,xlab='Ammonium',ylab='Density',trace.label='Stir Rate')


dat = c(570,    1063,   565 ,565,   1080    ,510    ,583    ,1043,  590 ,528,   988,    526 ,547    ,1026,  538,    521 ,1004,  532)
position <- as.fixed(c(rep(1,9),rep(2,9)))
Temp <- as.fixed(c(rep(c(800,825,850),6)))

model <- aov(dat~position+Temp+position*Temp)
GAD::gad(model)

model <- aov(dat~as.random(position)+as.random(Temp)+as.random(position)*as.random(Temp))
GAD::gad(model)

model <- aov(dat~position+as.random(Temp)+position*as.random(Temp))
GAD::gad(model)