Perform permutation tests for observations
from specified data and for specified statistics.
USAGE:
permutationTest(data, statistic, B = 999, ...,
resampleColumns, ...
alternative = "two.sided",
combine = F,
combinationFunction = combinePValues.Fisher)
REQUIRED ARGUMENTS:
data
data to be bootstrapped. May be a vector, matrix, or data frame.
statistic
statistic to be bootstrapped;
a function or expression that returns a vector or matrix.
It may be a function which accepts data as the first argument;
other arguments may be passed using
args.stat.
Or it may be an expression such as
mean(x,trim=.2).
If
data is given by name (e.g.
data=x) then use that name
in the expression,
otherwise (e.g.
data=air[,4]) use the name
data in the expression.
If
data is a data frame, the expression may involve variables
in the data frame.
For examples see
.
OPTIONAL ARGUMENTS:
B
number of random permutations to use. With the default value
of
B=999, p-values are multiples of 1/1000.
resampleColumns
numerical, logical, or character, for subscripting columns of the data.
If supplied, then only those columns of the data are resampled. This
is useful for permutation tests; for example, for a permutation test
of the correlation between two variables, permute only one of them.
...
additional arguments, which are passed to
.
For more detail on these arguments see
alternative
one of "two.sided", "greater", or "less".
May be a vector of the same length as the result of calling
statistic.
combine
numerical, logical, or character vector, indicating which components
of the result
to use for computing combined p-values.
Or this may be a list, each of whose elements indicate a set of
variables to use.
combinationFunction
a function which combined p-values;
see help for
combinePValues.Fisher for specifications
VALUE:
an object of class "permutationTest" which inherits from "resamp"
DETAILS:
This is implemented as a front end to
,
using
as the sampler.
REFERENCES:
Pesarin, F. (2001),
Multivariate Permutation Tests with Applications to Biostatistics,
Wiley, Chichester, UK.
(Describes nonparametric combination methodology.)
We wish to thank Dr. Luigi Salmaso for help designing and testing
this function.
SEE ALSO:
,
,
. The latter two are for permutation tests comparing two groups.
More details on arguments, see
. Note that
calls
, so many of the arguments are common.
Combination of p-values for multivariate statistics:
,
,
,
.
Print, summarize, plot:
,
,
,
,
Description of a "permutationTest" object, extract parts:
,
,
,
.
Modify a "permutationTest" object:
.
For an annotated list of functions in the package, including other high-level resampling functions, see:
.
EXAMPLES:
# Test significance of a correlation
y <- rnorm(30); x <- 1:30
plot(x,y); abline(lm(y ~ x))
obj <- permutationTest(y, cor(y, x))
obj
print(obj, digits=2)
plot(obj)