permTestCor: Permutation test for the correlation of two variables.
Description
Hypothesis test for a correlation of two variables. The null hypothesis is
that the population correlation is 0.
Usage
permTestCor(x, ...)
# S3 method for default
permTestCor(x, y, B = 999, alternative = "two.sided",
plot.hist = TRUE, legend.loc = "topright", plot.qq = FALSE,
x.name = deparse(substitute(x)), y.name = deparse(substitute(y)),
...)
# S3 method for formula
permTestCor(formula, data, subset, ...)
Value
Returns invisibly a vector of the correlations obtained by the
randomization.
Arguments
x
a numeric vector.
...
further arguments to be passed to or from methods.
y
a numeric vector.
B
the number of resamples to draw (positive integer greater than 2).
alternative
alternative hypothesis. Options are "two.sided",
"less" or "greater".
plot.hist
a logical value. If TRUE, plot the distribution of
the correlations obtained from each resample.
legend.loc
location of the legend on the histogram. Options are
"topright", "topleft", "bottomleft" and
"bottomright".
plot.qq
a logical value. If TRUE, plot the normal
quantile-quantile plot of the correlations obtained from each resample.
x.name
Label for variable x
y.name
Label for variable y
formula
a formula y ~ x where x, y are numeric vectors.
data
a data frame that contains the variables given in the formula.
subset
an optional expression indicating what observations to use.
Methods (by class)
default: Permutation test for the correlation of two variables.
formula: Permutation test for the correlation of two variables.
Author
Laura Chihara
Details
Perform a permutation test to test \(latex\), where
\(latex\)is the population correlation. The rows of the second
variable are permuted and the correlation is re-computed.
The mean and standard error of the permutation distribution is printed as
well as a P-value.