Problem 1

PART A: Write the model equation for a full factorial model

\(Yijkl = \mu +\alpha i+\beta j+\gamma k+\alpha \beta ij+\alpha \gamma ik+\beta \gamma jk+\alpha \beta \gamma ijk+\varepsilon ijkl\)

where i = 2, 30 (Ammonium)

and j = 100,150 (Stir Rate)

and k = 8, 40 (Temperature)

and l = 1, 2 (Replicates)

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

dat1<-read.csv("https://raw.githubusercontent.com/tmatis12/datafiles/main/PowderProduction.csv")
library(GAD)
## Loading required package: matrixStats
## Loading required package: R.methodsS3
## R.methodsS3 v1.8.2 (2022-06-13 22:00:14 UTC) successfully loaded. See ?R.methodsS3 for help.
dat1$Ammonium<-as.fixed(dat1$Ammonium)
dat1$StirRate<-as.fixed(dat1$StirRate)
dat1$Temperature<-as.fixed(dat1$Temperature)
model11<-aov(Density~Ammonium+StirRate+Temperature+Ammonium*StirRate+Ammonium*Temperature+StirRate*Temperature+Ammonium*StirRate*Temperature,data = dat1)
gad(model11)
## 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   
## Residual                       8 31.762   3.970                    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Hypothesis: Null Hypothesis:abyijk = 0 for aall ijk

            Alternative Hypothesis =abyijk NE 0 for some ijk

           

#As we can see That three factor interaction P value is greater than 0.05.Therefore we fail to reject Null Hypothesis and we claim that there is no three factor interaction

         

             #Lets test two factor hypothesis

            Null Hypothesis: aijk for all ik

            Alternate Hypothesis :ayik NE 0

Problem 2

Entering the data

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

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

library(GAD)
dat2$Pos<-as.fixed(dat2$Pos)
dat2$Temp<-as.fixed(dat2$Temp)
model2<-aov(response~Pos+Temp+Pos*Temp,data = dat2)
gad(model2)
## Analysis of Variance Table
## 
## Response: response
##          Df Sum Sq Mean Sq  F value   Pr(>F)    
## Pos       1   7160    7160   15.998 0.001762 ** 
## Temp      2 945342  472671 1056.117 3.25e-14 ***
## Pos:Temp  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 values are as follows:

Pos = 0.001762

Temp = 3.25e-14

Pos-Temp Interaction = 0.427

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

dat2$Pos<-as.random(dat2$Pos)
dat2$Temp<-as.random(dat2$Temp)
model3<-aov(response~Pos+Temp+Pos*Temp,data = dat2)
gad(model3)
## Analysis of Variance Table
## 
## Response: response
##          Df Sum Sq Mean Sq  F value    Pr(>F)    
## Pos       1   7160    7160   17.504 0.0526583 .  
## Temp      2 945342  472671 1155.518 0.0008647 ***
## Pos:Temp  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 values are as follows:

Pos = 0.05265

Temp = 0.0008647

Pos-Temp Interaction = 0.427

PART C:

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

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

The P values are as follows:

Pos = 0.05265

Temp = 3.25e-14

Pos-Temp Interaction = 0.427

PART D:

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

The interaction’s p-values remain constant across parts a, b, and c at 0.4271. It’s interesting to note that while the p-value for temperature increases in part b, it decreases in parts a and c (where temperature is fixed in a and random in a) (when Temperature is random). The same thing happens for Position, which has a smaller p-value in part a than it does in parts b and c (part b is random, and part c is fixed).

Regardless of whether it was a random or fixed effect, the Temperature variable is significant in all cases.

When the temperature and the Position variable were fixed effects (part a), the Position variable was significant, but not when it was random in (part a and part c)