scipy.stats._result_classes.PearsonRResult.confidence_interval#
- PearsonRResult.confidence_interval(confidence_level=0.95, method=None)[source]#
The confidence interval for the correlation coefficient.
Compute the confidence interval for the correlation coefficient
statistic
with the given confidence level.If method is not provided, 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)
, wheren
is the length of the original samples along the calculation axis. Whenn <= 3
, this approximation does not yield a finite, real standard error, so we define the confidence interval to be -1 to 1.If method is an instance of BootstrapMethod, the confidence interval is computed using
scipy.stats.bootstrap
with the provided configuration options and other appropriate settings. In some cases, confidence limits may be NaN due to a degenerate resample, and this is typical for very small samples (~6 observations).- Parameters:
- confidence_levelfloat
The confidence level for the calculation of the correlation coefficient confidence interval. Default is 0.95.
- methodBootstrapMethod, optional
Defines the method used to compute the confidence interval. See method description for details.
New in version 1.11.0.
- 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