[R] Randomization of a two-way ANOVA?

Greg Snow Greg.Snow at imail.org
Mon Dec 1 19:31:31 CET 2008


This really depends on the question(s) that you are asking.

If you want a simultaneous test of all your factors, then you can randomly permute the response many times and see where the original f-stat (or others) falls in the distribution of the randomized stats.

If you want to test the interaction, then fit the full model and save the f-stat for the interaction term.  Fit the model without the interaction and save the residuals and fitted values, permute the residuals and add them back to the fitted values, then analyze this with the full model and save the f-stat.  Repeate and see how the f-stat (or other stat) of the original fit compares to the permuted stats.

For combinations of other questions, just do the same as above but with the full and reduced model that matches the question(s) of interest.

You could also do bootstrapping as a randomization test, there are a couple of packages that help with that (but it is also easy without the packages), but for testing, I prefer the permutation test.

Hope this helps,

--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at imail.org
801.408.8111


> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of Joe Ratster
> Sent: Sunday, November 30, 2008 1:22 PM
> To: r-help at r-project.org
> Subject: [R] Randomization of a two-way ANOVA?
>
>
> Hello list,
>
> I wish to perform a randomization test on the F-statistics of a 2 way
> ANOVA
> but have not been able to find out how to do so - is there a package  /
> function that can perform this that I am unaware of?
>
> FactorA has 6 levels (0,1,2,3,4,5) whereas FactorB has 3 (1,2,3). A
> sample:
>
> Resp.   FactorA FactorB
> 2       0       2
> 3       1       2
> 1       2       2
> 0       3       2
> 0       4       2
> 0       5       2
> 4       0       1
> 6       1       1
> 1       2       1
> 0       3       1
> 1       4       1
> 0       5       1
> 2       0       2
> 3       1       2
> 1       2       2
> 2       3       2
> 1       4       2
> 0       5       2
> 3       0       1
> 3       1       1
> 1       2       1
> 0       3       1
> 0       4       1
> 7       1       3
> 2       2       3
> 0       3       3
> 1       4       3
> 0       5       3
> 1       0       3
>
> Also, is the F-statistic an appropriate test-statistic for the
> randomization
> test when it is computed using non-normal data?
>
> Any insight into this issue would be much appreciated.
> Thanks.
>
> --
> View this message in context: http://www.nabble.com/Randomization-of-a-
> two-way-ANOVA--tp20761769p20761769.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-
> guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list