Last chance! 50% off unlimited learning
Sale ends in
perm.anova(formula, nest.f2 = c("fixed", "random"), data, nperm = 999)
response ~ factor(s)
(see Details)."fixed"
(default) or "random"
.formula
. By default the variables are taken from environment(formula)
."anova"
.response ~ factor1 + factor2
for 2 fixed factors without interaction
response ~ factor1 * factor2
for 2 fixed factors with interaction
response ~ factor1 / factor2
for 2 fixed factors with factor2 nested into factor1 (if factor2 is a random factor, argument nest.f2
must be changed from "fixed"
(default) to "random"
)
response ~ factor1 | factor2
for 1 fixed factor (factor1) and 1 blocking (random) factor (factor2).
For 3 factors, the formula can only be:
response ~ factor1 + factor2 | factor3
or
response ~ factor1 * factor2 | factor3
. The 2 factors are here fixed and crossed inside each level of the third, blocking (random), factor.
The function deals with the limitted floating point precision, which can bias calculation of p-values based on a discrete test statistic distribution.set.seed(1203)
response <- c(rnorm(12),rpois(12,0.5),rnorm(12,2,1))
fact1 <- gl(3,12,labels=LETTERS[1:3])
fact2 <- gl(3,1,36,labels=letters[1:3])
fact3 <- gl(6,6,labels=letters[1:6])
block <- gl(2,6,36,labels=letters[1:2])
# Not enough permutations here but faster to run
# 2 crossed fixed factors with interaction
perm.anova(response~fact1*fact2,nperm=49)
# 2 nested fixed factors
perm.anova(response~fact1/fact2,nperm=49)
# 2 nested factors, fact2 being random
perm.anova(response~fact1/fact3,nest.f2="random",nperm=49)
# 1 fixed factor and 1 blocking (random) factor
perm.anova(response~fact1|block,nperm=49)
Run the code above in your browser using DataLab