permtest {BHH2} | R Documentation |
Permutation test for means and variance comparisons.
permtest(x, y = NULL)
x |
numeric vector. Sample group X. |
y |
numeric vector. Sample group Y. |
In the one–sample problem, the function builds all 2^n
possible \pm x_i
combinations. For the two–sample problem,
all possible B(n+m,n)
samples size
n
(=length(x)
) and m
(=length(y)
) are
generated and the permutation distributions for the t-statistics
and F-ratios. p-values are computed based on these
distributions.
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.
Ernesto Barrios
Box G. E. P, Hunter, J. S. and Hunter, W. C. (2005). Statistics for Experimenters II. New York: Wiley.
onet.permutation
and towt.permutation
of DAAG package, and perm.test
of the exactRankTests.
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()