Permutation test for means and variance comparisons.
numeric vector. Sample group X.
numeric vector. Sample group Y.
In the one–sample problem, the function builds all 2^n
possible +/- x_i combinations. For the two–sample problem,
all possible B(n+m,n) samples size
length(x)) and m (=
generated and the permutation distributions for the t-statistics
and F-ratios. p-values are computed based on these
The function returns the number N of different samples generated for the permutation distribution, the observed t-statistic, its p-value, based on both, the parametric and permutation distributions as well as the observed F-ratio and its corresponding p-values. The test may take a long time to generate all the possible combinations. It has been tested for n + m = 22 and n < 12.
The test may take a long time to generate all the possible combinations.
Box G. E. P, Hunter, J. S. and Hunter, W. C. (2005). Statistics for Experimenters II. New York: Wiley.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
library(BHH2) # Permutation test for Tomato Data data(tomato.data) cat("Tomato Data (not paired):\n") attach(tomato.data) a <- pounds[fertilizer=="A"] b <- pounds[fertilizer=="B"] print(round(test <- permtest(b,a),3)) detach() # Permutation test for Boy's Shoes Example data(shoes.data) cat("Shoes Data (paired):\n") attach(shoes.data) x <- matB-matA print(round(test <- permtest(x),3)) detach()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.