scipy.stats._result_classes.PearsonRResult.confidence_interval#

PearsonRResult.confidence_interval(confidence_level=0.95)[source]#

The confidence interval for the correlation coefficient.

Compute the confidence interval for the correlation coefficient statistic with the given confidence level.

The confidence interval is computed using the Fisher transformation F(r) = arctanh(r) [1]. When the sample pairs are drawn from a bivariate normal distribution, F(r) approximately follows a normal distribution with standard error 1/sqrt(n - 3), where n is the length of the original samples along the calculation axis. When n <= 3, this approximation does not yield a finite, real standard error, so we define the confidence interval to be -1 to 1.

Parameters
confidence_levelfloat

The confidence level for the calculation of the correlation coefficient confidence interval. Default is 0.95.

Returns
cinamedtuple

The confidence interval is returned in a namedtuple with fields low and high.

References

1

“Pearson correlation coefficient”, Wikipedia, https://en.wikipedia.org/wiki/Pearson_correlation_coefficient