This function computes the confidence interval for a given correlation and its sample size. This is useful to obtain confidence intervals for correlations reported in papers when informing power analyses.
confIntR(r, N, conf.level = 0.95, plot = FALSE)
The observed correlation coefficient.
The sample size of the sample where the correlation was computed.
The desired confidence level of the confidence interval.
Whether to show a plot.
The confidence interval(s) in a matrix with two columns. The left
column contains the lower bound, the right column the upper bound. The
rownames() are the observed correlations, and the
colnames() are 'lo' and 'hi'. The confidence level and sample
size are stored as attributes. The results are returned like this to make it
easy to access single correlation coefficients from the resulting object
(see the examples).
Bonett, D. G., Wright, T. A. (2000). Sample size requirements for estimating Pearson, Kendall and Spearman correlations. Psychometrika, 65, 23-28.
Bonett, D. G. (2014). CIcorr.R and sizeCIcorr.R https://people.ucsc.edu/~dgbonett/psyc181.html
Moinester, M., & Gottfried, R. (2014). Sample size estimation for correlations with pre-specified confidence interval. The Quantitative Methods of Psychology, 10(2), 124-130. https://www.tqmp.org/RegularArticles/vol10-2/p124/p124.pdf
Peters, G. J. Y. & Crutzen, R. (forthcoming) An easy and foolproof method for establishing how effective an intervention or behavior change method is: required sample size for accurate parameter estimation in health psychology.
### To request confidence intervals for one correlation confIntR(.3, 100); #> lo hi #> 0.3 0.1100677 0.4687942 #> attr(,"r") #>  0.3 #> attr(,"N") #>  100 #> attr(,"conf.level") #>  0.95 ### The lower bound of a single correlation confIntR(.3, 100); #>  0.1100677 ### To request confidence intervals for multiple correlations: confIntR(c(.1, .3, .5), 250); #> lo hi #> 0.1 -0.02436935 0.2213211 #> 0.3 0.18273439 0.4088496 #> 0.5 0.40079576 0.5876152 #> attr(,"r") #>  0.1 0.3 0.5 #> attr(,"N") #>  250 #> attr(,"conf.level") #>  0.95 ### The upper bound of the correlation of .5: confIntR(c(.1, .3, .5), 250)['0.5', 'hi']; #>  0.5876152