## S3 method for class 'default':
perm.test(x, y, paired=FALSE, alternative=c("two.sided", "less", "greater"),
mu=0, exact=NULL, conf.int=FALSE, conf.level=0.95, tol=NULL, ...)
## S3 method for class 'formula':
perm.test(formula, data, subset, na.action, \dots)
"two.sided"
(default), "greater"
or
"less"
. You can specify just the initial letter.tol
. This might not be plhs ~ rhs
where lhs
is a numeric variable giving the data values and rhs
a factor
with two levels giving the corresponding groups.NA
s. Defaults to
getOption("na.action")
."htest"
containing the following components:mu
.conf.int = TRUE
.)x
or y
are passed to this function
the following applies: if exact
is true (i.e. the sample size is
less than 50 observations) and tol
is not given, the scores are
mapped into ${1,\dots,N}$, see pperm
for the details.
Otherwise the p-values are computed using tol
. If the sample size
exceeds $50$ observations, the usual normal approximation is used. P-values are computed according to the StatXact-manual, see
pperm
.
For (in principle) continuous variables the confidence sets represent the "largest shift in location being consistent with the observations". For discrete variables with only a few categories they are hard to interpret. In the case of binary data (e.g. success / failure) the confidence sets can be interpreted as the differences of two success-rates covered by the data. For a detailed description see R"ohmel (1996).
Confidence intervals are only available for independent samples. When the
sample sizes are unbalanced, length(x)
needs to be smaller than
length(y)
.
Cyrus R. Mehta & Nitin R. Patel (2001), StatXact-5 for Windows. Manual, Cytel Software Cooperation, Cambridge, USA
# Example from Gardner & Altman (1989), p. 30
# two treatments A and B, 1 means improvement, 0 means no improvement
# confidence sets cf. R\"ohmel (1996)
A <- c(rep(1, 61), rep(0, 19))
B <- c(rep(1, 45), rep(0, 35))
perm.test(A, B, conf.int=TRUE, exact=TRUE)
# one-sample AIDS data (differences only), Methta and Patel (2001),
# Table 8.1 page 181
data(sal)
attach(sal)
ppdiff <- pre - post
detach(sal)
# p-values in StatXact == 0.0011 one-sided, 0.0021 two.sided, page 183
perm.test(ppdiff)
perm.test(ppdiff, alternative="less")
perm.test(ppdiff, exact=FALSE)
Run the code above in your browser using DataLab