library(GAD)
## Warning: package 'GAD' was built under R version 4.2.2
## 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.
Position<-c(rep(1,9),rep(2,9))
temp<-c(800,825,850)
temp<-rep(temp,6)
obs<-c(570,1063,565,
565,1080,510,
583,1043,590,
528,988,526,
547,1026,538,
521,1004,532)
dat<-data.frame(Position,temp,obs)
########Question A
dat$Position<-as.fixed(dat$Position)
dat$temp<-as.fixed(dat$temp)
model<-aov(obs~Position+temp+Position*temp,data = dat)
gad(model)
## Analysis of Variance Table
##
## Response: obs
## 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
#########Question B
dat$Position<-as.random(dat$Position)
dat$temp<-as.random(dat$temp)
model2<-aov(obs~Position+temp+Position*temp,data = dat)
gad(model2)
## Analysis of Variance Table
##
## Response: obs
## 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
## Residual 12 5371 448
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
###############Question C
dat$Position<-as.fixed(dat$Position)
dat$temp<-as.random(dat$temp)
model3<-lm(obs~Position+temp+Position*temp,data = dat)
gad(model3)
## Analysis of Variance Table
##
## Response: obs
## 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
## Residual 12 5371 448
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Conclusion
Therefore the P values are 0.01762,0.0526583,0.0526
By the above values we can say that for part A and part B they are differed and for Part B and Part C they are quiet similar