Monte Carlo Method for
Assessing Correlations
quantpsy.org
An interactive tool for creating confidence intervals for correlation coefficients
© 2010-2024,
Kristopher J. Preacher

Monte Carlo method for assessing correlations: An interactive tool for creating confidence intervals for correlation coefficients
Kristopher J. Preacher (Vanderbilt University)

How to cite this page

This web utility may be cited in APA style in the following manner:

Preacher, K. J. (2012, November). Monte Carlo method for assessing correlations: An interactive tool for creating confidence intervals for correlation coefficients [Computer software]. Available from http://quantpsy.org/.

If the Rweb server is not working

The code generated by this utility can be pasted directly into an R console window. R (a free, open-source statistical computing environment) may be obtained here: http://cran.r-project.org/.

Correlation coefficients

Correlation coefficients quantify the degree of linear association between two variables. They range between -1 and +1, with 0 indicating the lack of a linear association.

Monte Carlo Method

The Monte Carlo Method is a very general method for determining distributional properties of statistics and for obtaining confidence intervals (CIs). The method used here relies on the assumption that the parameter of interest has a normal sampling distribution. This calculator transforms correlation coefficients using Fisher's z' transformation, a normalizing transformation: (z' = ½ln((1+r)/(1-r))). Using the supplied r and the associated sample size (N), random draws from a normal distribution with mean z' and variance 1/(N-3) are simulated. This procedure is repeated a very large number of times. Quantiles from the resulting distributon of z' are converted back to correlations using the inverse transformation r = (exp(2z'-1)/(exp(2z'+1)) and used as a CI around the z'-transformed observed correlation. In addition to the Monte Carlo CI and histogram, a more precise interval is obtained using the formula z' ± zcritSE, where SE is the approximate standard error of the Fisher-transformed correlation, 1/sqrt(N-3). The Monte Carlo CI merely approximates the more precise Fisher CI. Thus, the Fisher CI can be reported, and the Monte Carlo histogram can be used to illustrate sampling properties of correlation coefficients.

Uses for these confidence intervals

The user may elect to use this procedure to test a null hypothesis about the population correlation (ρ). If the null hypothesized value of ρ (usually 0) falls outside the interval, the null hypothesis of zero correlation is rejected. Alternatively, a null distribution of ρ can be generated by setting r to 0; the null hypothesis is rejected if the observed r falls outside the interval.

Description of numbers needed

r = the sample correlation coefficient.
N = the sample size.

To conduct the simulation

Enter the r and N values into the cells below as well as the desired level of confidence (from 1% to 99%) and the number of repetitions for the simulation (minimum is 100, but many thousands are recommended). The program will generate R code that can be submitted to Rweb to generate a histogram of the sampling distribution of r and estimate a CI for the correlation. You may also request that the simulated values of r used to generate the histogram and confidence interval be outputted, but in this case the code should be run with R rather than submitted to Rweb (Rweb servers do not usually permit use of the "write" function). Note that if this option is selected, the histogram will appear after the column of values. The code is editable should you wish to make a change in the simulation or the output. For example, you could change the number of repetitions, the number of columns in the histogram showing the distribution of the correlation, or the title of the histogram.

Input:
r
n
Confidence %
Repetitions
Output simulated r values?

References

Cohen, J., Cohen, P., West, S. G., & Aiken, L. S. (2003). Applied multiple regression/correlation analysis for the behavioral sciences (3rd ed.). Mahwah, NJ: Lawrence Erlbaum Associates.

Original version posted November, 2012.