ci_cor | R Documentation |
This function calculates CIs for a population correlation coefficient.
For Pearson correlation, "normal" CIs are available (by stats::cor.test()
).
Also bootstrap CIs are supported (by default "bca", and the only option for
rank correlations).
ci_cor(
x,
y = NULL,
probs = c(0.025, 0.975),
method = c("pearson", "kendall", "spearman"),
type = c("normal", "bootstrap"),
boot_type = c("bca", "perc", "norm", "basic"),
R = 9999L,
seed = NULL,
...
)
x |
A numeric vector or a |
y |
A numeric vector (only used if |
probs |
Lower and upper probabilities, by default |
method |
Type of correlation coefficient, one of "pearson" (default), "kendall", or "spearman". For the latter two, only bootstrap CIs are supported. |
type |
Type of CI. One of "normal" (the default) or "bootstrap" (the only option for rank-correlations). |
boot_type |
Type of bootstrap CI. Only used for |
R |
The number of bootstrap resamples. Only used for |
seed |
An integer random seed. Only used for |
... |
Further arguments passed to |
An object of class "cint", see ci_mean()
for details.
ci_cor(iris[1:2])
ci_cor(iris[1:2], type = "bootstrap", R = 999) # Use larger R
ci_cor(iris[1:2], method = "spearman", type = "bootstrap", R = 999) # Use larger R
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.