cor_to_ci {correlation} | R Documentation |
Convert correlation to p-values and CIs
Description
Get statistics, p-values and confidence intervals (CI) from correlation coefficients.
Usage
cor_to_ci(cor, n, ci = 0.95, method = "pearson", correction = "fieller", ...)
cor_to_p(cor, n, method = "pearson")
Arguments
cor |
A correlation matrix or coefficient. |
n |
The sample size (number of observations). |
ci |
Confidence/Credible Interval level. If |
method |
A character string indicating which correlation coefficient is
to be used for the test. One of |
correction |
Only used if method is 'spearman' or 'kendall'. Can be 'fieller' (default; Fieller et al., 1957), 'bw' (only for Spearman) or 'none'. Bonett and Wright (2000) claim their correction ('bw') performs better, though the Bishara and Hittner (2017) paper favours the Fieller correction. Both are generally very similar. |
... |
Additional arguments (e.g., |
Value
A list containing a p-value and the statistic or the CI bounds.
References
Bishara, A. J., & Hittner, J. B. (2017). Confidence intervals for correlations when data are not normal. Behavior research methods, 49(1), 294-309.
Examples
cor.test(iris$Sepal.Length, iris$Sepal.Width)
cor_to_p(-0.1175698, n = 150)
cor_to_p(cor(iris[1:4]), n = 150)
cor_to_ci(-0.1175698, n = 150)
cor_to_ci(cor(iris[1:4]), n = 150)
cor.test(iris$Sepal.Length, iris$Sepal.Width, method = "spearman", exact = FALSE)
cor_to_p(-0.1667777, n = 150, method = "spearman")
cor_to_ci(-0.1667777, ci = 0.95, n = 150)
cor.test(iris$Sepal.Length, iris$Sepal.Width, method = "kendall", exact = FALSE)
cor_to_p(-0.07699679, n = 150, method = "kendall")