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.
response <- c(570,1063,565,
565,1080,510,
583,1043,590,
528,988,526,
547,1026,538,
521,1004,532)
temp <- rep(seq(1,3),6)
pos <- c(rep(1,9),rep(2,9))
pos
## [1] 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2
data.frame(temp,pos,response)
## temp pos response
## 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
temp <- as.fixed(temp)
pos <- as.fixed(pos)
exp <- aov(response~temp+pos+temp*pos)
GAD::gad(exp)
## Analysis of Variance Table
##
## Response: response
## 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
# 2-a
# p-value of temp 3.25e-14
# p-value of pos 0.001762
# p-value of interaction 0.427110
temp <- as.random(temp)
pos <- as.random(pos)
exp <- aov(response~temp+pos+temp*pos)
GAD::gad(exp)
## Analysis of Variance Table
##
## Response: response
## 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
# 2-b
# p-value of temp 0.0008647
# p-value of pos 0.0526583
# p-value of interaction 0.427110
temp <- as.random(temp)
pos <- as.fixed(pos)
exp <- aov(response~temp+pos+temp*pos)
GAD::gad(exp)
## Analysis of Variance Table
##
## Response: response
## 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
# 2-c
# p-value of temp 3.25e-14
# p-value of pos 0.05266
# p-value of interaction 0.42711
# 2-d
# The interaction p-values has not changed in any case,
# By comparing a and b parts, p-values of both temp and postion(factors) has changed.
# By comparing b and c parts, p-values of temp has changed