A R function for the permutation test for onw-way nested design ANOVA.
This work is inspired by Dr. David C. Howell, University of Vermont. In Dr. Howell’s webpage “Permutation Tests for Factorial ANOVA Designs” (http://www.uvm.edu/~dhowell/StatPages/More_Stuff/Permutation%20Anova/PermTestsAnova.html [access on May 28, 2012]), he described the algorithm of permutation test for a one-way nested design ANOVA by using R language. I followed this algorithm and made a R function to do this test.
Example
dat <- read.csv(textConnection("
trt , unit , obs
1 , 1 , 11
1 , 1 , 9
1 , 1 , 9
1 , 2 , 8
1 , 2 , 7
1 , 2 , 6
1 , 3 , 8
1 , 3 , 10
1 , 3 , 11
2 , 4 , 11
2 , 4 , 8
2 , 4 , 7
2 , 5 , 10
2 , 5 , 14
2 , 5 , 12
2 , 6 , 9
2 , 6 , 10
2 , 6 , 8
"))
## traditional nested ANOVA
mod.2 <- aov(
obs ~ factor(trt) + Error(factor(unit)),
data = dat
)
summary(mod.2) # alternative
## permutation nested ANOVA
nestedPermutationAnova(dat$obs, dat$trt, dat$unit, 499)