spearmanRho {rcompanion} | R Documentation |
Spearman's rho, Kendall's tau, Pearson's r
Description
Calculates Spearmans's rho, Kendall's tau, or Pearson's r with confidence intervals by bootstrap
Usage
spearmanRho(
formula = NULL,
data = NULL,
x = NULL,
y = NULL,
method = "spearman",
ci = FALSE,
conf = 0.95,
type = "perc",
R = 1000,
histogram = FALSE,
digits = 3,
reportIncomplete = FALSE,
...
)
Arguments
formula |
A formula indicating the two paired variables,
e.g. |
data |
The data frame to use. |
x |
If no formula is given, the values for one variable. |
y |
The values for the other variable. |
method |
One of "spearman", "kendall", or "pearson".
Passed to |
ci |
If |
conf |
The level for the confidence interval. |
type |
The type of confidence interval to use.
Can be any of " |
R |
The number of replications to use for bootstrap. |
histogram |
If |
digits |
The number of significant digits in the output. |
reportIncomplete |
If |
... |
Additional arguments passed to the |
Details
This function is a wrapper for stats::cor
with the addition of confidence intervals.
The input should include either formula
and data
;
or x
, and y
.
Currently, the function makes no provisions for NA
values in the data. It is recommended that NA
s be removed
beforehand.
When the returned statistic is close to -1 or close to 1, or with small sample size, the confidence intervals determined by this method may not be reliable, or the procedure may fail.
Value
A single statistic, rho, tau, or r. Or a small data frame consisting of rho, tau, or r, and the lower and upper confidence limits.
Author(s)
Salvatore Mangiafico, mangiafico@njaes.rutgers.edu
References
https://rcompanion.org/handbook/I_10.html
Examples
data(Catbus)
spearmanRho( ~ Steps + Rating, data=Catbus)