perm.test {jmuOutlier} | R Documentation |
Permutation Test
Description
Performs one-sample and two-sample permutation tests on vectors of data.
Usage
perm.test(x, y = NULL, alternative = c("two.sided", "less", "greater"), mu = 0,
paired = FALSE, all.perms = TRUE, num.sim = 20000, plot = FALSE, stat = mean, ...)
Arguments
x |
A (non-empty) numeric vector of data values. |
y |
An optional numeric vector data values. |
alternative |
A character string specifying the alternative hypothesis, and
must be one of |
mu |
A number indicating the null value of the location parameter (or the difference in location parameters if performing a two-sample test). |
paired |
Logical, indicating whether or not a two-sample test should be paired, and is ignored for a one-sample test. |
all.perms |
Logical. The exact p-value is attempted when |
num.sim |
The upper limit on the number of permutations generated. |
plot |
Logical. If |
stat |
Function, naming the test statistic, such as |
... |
Optional arguments to |
Details
A paired test using data x
and nonNULL y
is
equivalent to a one-sample test using data x-y
.
The output states more details about the permutation test, such as one-sample or two-sample,
and whether or not the p.value
calculated was based on all permutations.
Value
alternative |
Same as the input. |
mu |
Same as the input. |
p.value |
The p-value of the permutation test. |
Note
The formulas computed within perm.test
are based on the textbook by Higgins (2004).
Author(s)
Steven T. Garren, James Madison University, Harrisonburg, Virginia, USA
References
Higgins, J. J. (2004) Introduction to Modern Nonparametric Statistics.
Examples
# One-sample test
print( x <- rnorm(10,0.5) )
perm.test( x, stat=median )
# Two-sample unpaired test
print( y <- rnorm(13,1) )
perm.test( x, y )