Provides permutation tests for two and three way designs, using permutations of of the response vector with respect to factor levels. One way permutation tests are provided by MC.test
, and the function oneway_test
in coin
.
perm.fact.test(Y, X1, X2, X3 = NA, perm = 100, method = "a")
A dataframe is returned describing initial F test statistics for main effects and interactions, degrees of freedom, and permutation P-values.
A vector of response data. A quantitative vector.
A vector of factor levels describing factor one.
A vector of factor levels describing factor two.
If necessary, a vector of factor levels describing factor three.
Number of permutations.
Either "a"
or "b"
, see below.
Ken Aho
Manly (1997) describes five factorial permutation methods which allow testing of interactions. None of these should be considered to be extensively tested or strongly supported by the statistical literature. (a) In the first method observations are randomly allocated to factorial treatments preserving the sample size for each treatment. Permutation distributions of the F statistics for A, B, and AB are used for statistical tests. (b) In the second method observations are randomized as above but permutation distributions of MSA, MSB and MSAB are obtained. (c) Edgington (1995) recommended a restricted randomization procedure where observations within a main effect are randomized while holding other effects constant. Either mean squares or F statistics can be used to create permutation distributions. Edgington emphasized that testing interactions with this method are not possible, but that by randomizing over all AB combinations (as in alternative "a" above) provides a test statistic sensitive to interactions. (d) Still and White (1981) recommended a restricted testing procedure (as in (c) above) but recommended testing interactions after "subtracting" main effects. (e) Ter Braak (1992) recommended replacing observations by their residuals from the initial linear model. These are then permuted, assuming that sample sizes were equal to original sample sizes across interactions of treatments. Permutation distributions of the F statistics for A, B, and AB are then used for statistical tests. Manly (1997) recommends methods a, b, d, or e. Methods a and b are currently implemented.
Edgington, E. S. (1995) Randomization Tests, 3rd edition. Marcel Dekker, New York.
Manly, B. F. J. (1997) Randomization and Monte Carlo Methods in Biology, 2nd edition. Chapman and Hall, London.
Still, A. W., and A. P. White (1981) The approximate randomization test as an alternative to the F test in analysis of variance. British Journal of Mathematics and Statistical Psychology. 34: 243-252.
Ter Braak, C. F. J. (1992) Permutation versus bootstrap significance tests in multiple regression and ANOVA. In Jockel, K. J. (ed). Bootstrapping and Related Techniques. Springer-Verlag, Berlin.
MC.test
lizard<-data.frame(ants=c(13,242,105,8,59,20,515,488,88,18,44,21,182,21,7,24,312,68,
460,1223,990,140,40,27),size=factor(c(rep(1,12),rep(2,12))),
month=factor(rep(rep(c(1,2,3,4),each=3),2)))
attach(lizard)
perm.fact.test(ants,month,size,perm=100, method = "b")
Run the code above in your browser using DataLab