View source: R/correlation_measures.R
prec_cor | R Documentation |
prec_cor
returns the sample size or the precision for the given
pearson, spearman, or kendall correlation coefficient.
prec_cor(
r,
n = NULL,
conf.width = NULL,
conf.level = 0.95,
method = c("pearson", "kendall", "spearman"),
...
)
r |
desired correlation coefficient. |
n |
sample size. |
conf.width |
precision (the full width of the confidence interval). |
conf.level |
confidence level. |
method |
Exactly one of |
... |
other options to uniroot (e.g. |
Exactly one of the parameters n
or conf.width
must be passed as NULL,
and that parameter is determined from the other.
Sample size or precision is calculated according to formula 2 in Bonett and
Wright (2000). The use of pearson is only recommended, if n \ge 25
. The
pearson correlation coefficient assumes bivariate normality. If the
assumption of bivariate normality cannot be met, spearman or kendall should
be considered.
n is rounded up to the next whole number using ceiling
.
uniroot
is used to solve n.
Object of class "presize", a list of arguments (including the computed one) augmented with method and note elements.
Bonett DG, and Wright TA (2000) Sample size requirements for estimating Pearson, Kendall and Spearman correlations Psychometrika 65:23-28. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1007/BF02294183")}
# calculate confidence interval width...
# Pearson correlation coefficient
prec_cor(r = 0.5, n = 100)
# Kendall rank correlation coefficient (tau)
prec_cor(r = 0.5, n = 100, method = "kendall")
# Spearman's rank correlation coefficient
prec_cor(r = 0.5, n = 100, method = "spearman")
# calculate N required for a given confidence interval width...
# Pearson correlation coefficient
prec_cor(r = 0.5, conf.width = .15)
# Kendall rank correlation coefficient (tau)
prec_cor(r = 0.5, conf.width = .15, method = "kendall")
# Spearman's rank correlation coefficient
prec_cor(r = 0.5, conf.width = .15, method = "spearman")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.