Factorial Designs in R

Problem 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. The experiment considers powder density (\(g/cm^2\)) as the response variable and critical characteristics of this product. The data is shown below.

Silver Powder Production Process
Ammonium (%) Stir Rate (RMP) Temperateure (C) Density
2 100 8 14.68
2 100 8 15.18
30 100 8 15.12
30 100 8 17.48
2 150 8 7.54
2 150 8 6.66
30 150 8 12.46
30 150 8 12.62
2 100 40 10.95
2 100 40 17.68
30 100 40 12.65
30 100 40 15.96
2 150 40 8.03
2 150 40 8.84
30 150 40 14.96
30 150 40 14.96

Ammonium, Stir Rate, and Temperature are factors with fixed effects, each with two levels, and the design is replicated twice.

Part A

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}+\epsilon_{ijkl}\]

Part B

What factors are deemed significant, using \(\alpha=.05%\) as a guide. Report final p-values of significant factors and interaction plots if necessary.

#read in data and set to fixed
library(GAD)
## Loading required package: matrixStats
## Loading required package: R.methodsS3
## R.methodsS3 v1.8.1 (2020-08-26 16:20:06 UTC) successfully loaded. See ?R.methodsS3 for help.
csvData <- read.csv("https://raw.githubusercontent.com/tmatis12/datafiles/main/PowderProduction.csv")
csvData$Ammonium <- as.fixed(csvData$ï..Ammonium)
csvData$StirRate <- as.fixed(csvData$StirRate)
csvData$Temperature <- as.fixed(csvData$Temperature)

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

Based on the p values from gad, the interaction of stir rate and ammonium percent is signifcant at the \(\alpha = .05\) level. Furthermore, their main effects are significant but we do not consider those since we have the interaction effect.

interaction.plot(csvData$StirRate,csvData$Ammonium,csvData$Density)

The interaction plot shows the lines are not parallel, which confirms the result of the interaction between ammonium and stir rate being significant.

Problem 2

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

Baked Density by Firing Temperature and Furnace Position
800 C 825 C 850 C
1 570 1063 565
1 565 1080 510
1 583 1043 590
2 528 988 526
2 547 1026 538
2 521 1004 532
position <- c(rep(1,9),rep(2,9))
temperatures<-c(800,825,850)
temperature <- rep(temperatures,6)
response <- c(570,1063,565,
              565,1080,510,
              583,1043,590,
              528,988,526,
              547,1026,538,
              521,1004,532)
data.frame(position,temperature,response)
##    position temperature response
## 1         1         800      570
## 2         1         825     1063
## 3         1         850      565
## 4         1         800      565
## 5         1         825     1080
## 6         1         850      510
## 7         1         800      583
## 8         1         825     1043
## 9         1         850      590
## 10        2         800      528
## 11        2         825      988
## 12        2         850      526
## 13        2         800      547
## 14        2         825     1026
## 15        2         850      538
## 16        2         800      521
## 17        2         825     1004
## 18        2         850      532

Part A

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

#Fixed Model
position <- as.fixed(position)
temperature <- as.fixed(temperature)
model_f <- aov(response~position+temperature+position*temperature)
gad(model_f)
## Analysis of Variance Table
## 
## Response: response
##                      Df Sum Sq Mean Sq  F value   Pr(>F)    
## position              1   7160    7160   15.998 0.001762 ** 
## temperature           2 945342  472671 1056.117 3.25e-14 ***
## position:temperature  2    818     409    0.914 0.427110    
## Residual             12   5371     448                      
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

The p-vales are as follows:
position p-value = 0.001762
temperature p-value = 3.25e-14
position-temperature interaction p-value = 0.427110
position and temperature are significant at \(\alpha = 0.05\)

Part B

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

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

The p-vales are as follows:
position p-value = 0.0526584
temperature p-value = 0.0008647
position-temperature interaction p-value = 0.427110
temperature is significant at \(\alpha = 0.05\)

Part C

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

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

position p-value = 0.05266
temperature p-value = 3.25e-14
position-temperature interaction p-value = 0.42711
temperature is significant at \(\alpha = 0.05\)

Part D

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

In all Models shown above, the degrees of freedom, sum of squares, and expected mean square are the same.

Using the Fixed Effects Model (part a) as the basis of analysis;

\[F_0=MS_A/MS_{E}\] \[F_0=MS_B/MS_{E}\] \[F_0=MS_{AB}/MS_{E}\]

The Random Effects Model (part b), shows variations in the F & P values for both Position and Temperature with the interaction values the same, as shown below.

\[F_0=MS_A/MS_{AB}\] \[F_0=MS_B/MS_{AB}\] \[F_0=MS_{AB}/MS_{E}\]

The Mixed Effects Model (part c), shows variations in the F & P value for position with all other values the same, as shown below.

\[F_0=MS_A/MS_{AB}\] \[F_0=MS_B/MS_{E}\] \[F_0=MS_{AB}/MS_{E}\]

In all cases, temperature is a significant factor at \(\alpha = 0.05\). In cases b) and c), position is not a significant factor at \(\alpha = 0.05\). In all cases a), b) and c), the interaction effect is not significant.

All Code Used

Below you will find a block containing all of the code used to generate this document

printData <- read.csv("https://raw.githubusercontent.com/tmatis12/datafiles/main/PowderProduction.csv")
tablenames <- c("Ammonium (%)","Stir Rate (RMP)","Temperateure (C)","Density")
knitr::kable(printData,
 caption = "Silver Powder Production Process", col.names = tablenames)

library(GAD)
csvData <- read.csv("https://raw.githubusercontent.com/tmatis12/datafiles/main/PowderProduction.csv")
csvData$Ammonium <- as.fixed(csvData$ï..Ammonium)
csvData$StirRate <- as.fixed(csvData$StirRate)
csvData$Temperature <- as.fixed(csvData$Temperature)
aov11 <- aov(csvData$Density~csvData$Ammonium+
               csvData$StirRate+csvData$Temperature+csvData$Ammonium*csvData$StirRate+
               csvData$Ammonium*csvData$Temperature+csvData$StirRate*csvData$Temperature+
               csvData$Ammonium*csvData$StirRate*csvData$Temperature)
gad(aov11)

interaction.plot(csvData$StirRate,csvData$Ammonium,csvData$Density)

position <- c(rep(1,9),rep(2,9))
temperatures<-c(800,825,850)
temperature <- rep(temperatures,6)
response <- c(570,1063,565,
              565,1080,510,
              583,1043,590,
              528,988,526,
              547,1026,538,
              521,1004,532)
data.frame(position,temperature,response)

#Fixed Model
position <- as.fixed(position)
temperature <- as.fixed(temperature)
model_f <- aov(response~position+temperature+position*temperature)
gad(model_f)

#Random Model
position <- as.random(position)
temperature <- as.random(temperature)
model_r <- aov(response~position+temperature+position*temperature)
gad(model_r)

#Mixed Model
position <- as.fixed(position)
temperature <- as.random(temperature)
model_m <- aov(response~position+temperature+position*temperature)
gad(model_m)