perm.test {broman} | R Documentation |
Calculates a p-value for a t-test via permutations.
perm.test(x, y, n.perm = NULL, var.equal = TRUE, pval = TRUE)
x |
A numeric vector. |
y |
A second numeric vector. |
n.perm |
Number of permutations to perform. If NULL, all possible permutations are considered, and an exact p-value is calculated. |
var.equal |
A logical variable indicating whether to treat the two population variances as being equal. |
pval |
If TRUE, return just the p-value. If FALSE, return the
actual permutation results (with the observed statistic as an
attribute, |
This calls the function stats::t.test()
to calculate a
t-statistic comparing the vectors x
and y
. Permutations
are perfomed to give an exact or approximate conditional p-value.
If pval=TRUE
, the output is a single number: the P-value
testing for a difference in the distributions of the populations from
which x
and y
were drawn.
If pval=FALSE
, the output is a vector of the t statistics from
the permutations. An attributed "tobs"
contains the t
statistic with the observed data.
stats::t.test()
, paired.perm.test()
x <- c(43.3, 57.1, 35.0, 50.0, 38.2, 61.2)
y <- c(51.9, 95.1, 90.0, 49.7, 101.5, 74.1)
perm.test(x,y)