Reading the Data:
temp<-c(rep(seq(1,3),6))
pos<-c(rep(1,9),rep(2,9))
obs<-c(570,1063,565,565,1080,510,583,1043,590,528,988,526,547,1026,538,521,1004,532)
dat<-data.frame(temp,pos,obs)
dat
## temp pos obs
## 1 1 1 570
## 2 2 1 1063
## 3 3 1 565
## 4 1 1 565
## 5 2 1 1080
## 6 3 1 510
## 7 1 1 583
## 8 2 1 1043
## 9 3 1 590
## 10 1 2 528
## 11 2 2 988
## 12 3 2 526
## 13 1 2 547
## 14 2 2 1026
## 15 3 2 538
## 16 1 2 521
## 17 2 2 1004
## 18 3 2 532
PART A: Temp and Position Fixed
Hypothesis:
Null:
\[\alpha_{i}= 0\space\space\forall\space"i"\]
\[ \beta_{j}=0\space\forall"j" \]
\[ (\alpha\beta)_{ij}=0\space\forall"ij" \]
Alternate:
\[\alpha_{i}\neq 0\space\space\exists\space"i"\]
\[ \beta_{j}\neq0\space\exists"j" \]
\[ (\alpha\beta)_{ij}\neq0\space\exists"ij" \]
library(GAD)
temp<-as.fixed(temp)
pos<-as.fixed(pos)
model<-aov(obs~temp+pos+temp*pos)
GAD::gad(model)
## Analysis of Variance Table
##
## Response: obs
## Df Sum Sq Mean Sq F value Pr(>F)
## temp 2 945342 472671 1056.117 3.25e-14 ***
## pos 1 7160 7160 15.998 0.001762 **
## temp:pos 2 818 409 0.914 0.427110
## Residual 12 5371 448
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
P-Val Temp = 3.25e-14
p-val position = 0.001762
p-val interaction = 0.427
PART B: Temp and Position ARE Random
library(GAD)
temp<-as.random(temp)
pos<-as.random(pos)
model<-aov(obs~temp+pos+temp*pos)
GAD::gad(model)
## Analysis of Variance Table
##
## Response: obs
## Df Sum Sq Mean Sq F value Pr(>F)
## temp 2 945342 472671 1155.518 0.0008647 ***
## pos 1 7160 7160 17.504 0.0526583 .
## temp:pos 2 818 409 0.914 0.4271101
## Residual 12 5371 448
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
P-Val Temp = 0.0008647
p-val position = 0.0526
p-val interaction = 0.427
PART C: Temp is Random and Position is fixed
temp<-as.random(temp)
pos<-as.fixed(pos)
model<-aov(obs~temp+pos+temp*pos)
GAD::gad(model)
## Analysis of Variance Table
##
## Response: obs
## Df Sum Sq Mean Sq F value Pr(>F)
## temp 2 945342 472671 1056.117 3.25e-14 ***
## pos 1 7160 7160 17.504 0.05266 .
## temp:pos 2 818 409 0.914 0.42711
## Residual 12 5371 448
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
P-Val Temp = 3.25e-14
p-val position = 0.0526
p-val interaction = 0.427
PART D: Comment:
--The P-Value of Temperature and Interaction remains same in Part A and B i.e. when temp & Pos are fixed Vs Temp is Random and Pos is fixed.Whereas P-val of position remains same in part b and c i.e. when temp and position are random VS Temp random and Position fixed