Home   >   User Resources   >   Online Help   >   apaCorrel.ConfidenceIntervals
 

 

Function index Version 3.0.0

apaCorrel.ConfidenceIntervals(X, Y, ConfidenceLevel, nSamples)

Excel=apaCorrel.ConfidenceIntervals(X, Y, ConfidenceLevel, nSamples)

Result

Calculates a two-sided confidence interval for the Pearson correlation coefficient of two series by resampling.

Syntax

X: r x 1 data vector containing a first time series

Y: r x 1 data vector containing a second time series

ConfidenceLevel: confidence level strictly between 0 and 1, e.g. 0.95

nSamples: number of resampled datasets

Remarks

The output is a 2 x 1 vector: the lower bound in the first row and the upper bound in the second row.

Observation pairs (X(t), Y(t)) are drawn with replacement to form nSamples datasets of r observations. The bounds are the (1 − ConfidenceLevel)/2 and (1 + ConfidenceLevel)/2 percentiles of the resampled correlations. Resampled datasets in which one series is constant are skipped.

The Pearson correlation is the same with sample (denominator n − 1) and population (denominator n) moments, as the denominators cancel.

X and Y must have the same number of observations (at least 3). The function is volatile and the results change with each recalculation.