[R] randomization test for a two-way ANOVA

Sebastian Luque spluque at gmail.com
Tue Jul 4 07:38:46 CEST 2006


Hi,

I've looked into ways of implementing this procedure, i.e. repeating the
two-way ANOVA many times, scrambling the order of cases across the
treatments, to produce a distribution of F ratios for each effect.  This
seemed a job for the 'boot' package.  However, I'm not sure I'm doing an
actual randomization test, as opposed to a bootstrap here.  This is how
I've coded the test (using the poisons data):


---<---------------cut here---------------start-------------->---
require(boot)

"boot.lm" <- function(data, i)
{
    mod <- lm(time ~ treat * poison, data=data[i, ])
    anova(mod)["F value"][[1]][-4]      # the F ratios for each effect
}

poisons.boot <- boot(poisons, boot.lm, R=1000, sim="permutation")
---<---------------cut here---------------end---------------->---


Is this the right way to ask for a randomization test using 'boot'?
Thanks in advance.


Cheers,

-- 
Seb



More information about the R-help mailing list