test_diff#
- mqr.inference.correlation.test_diff(x1, y1, x2, y2, H0_corr1=0.0, H0_corr2=0.0, alternative='two-sided', method='fisher-z')#
Hypothesis test on the difference of two Pearson correlations.
- Null-hypothesis
corr(x1, y1) - corr(x2, y2) == H0_corr1 - H0_corr2
- Parameters:
- x1, y1array_like
First pair of samples.
- x2, y2array_like
Second pair of samples whose correlation will be subtracted from the correlation of the first pair to form the difference.
- H0_corr1, H0_corr2float, optional
Null-hypothesis difference is H0_corr1 - H0_corr2.
- alternative{‘both’, ‘less’, ‘greater’}, optional
Sense of alternative hypothesis.
- method{‘fisher-z’}, optional
Type of statistic; only ‘fisher-z’ is implemented.
- Returns:
- Raises:
- ValueError
Lengths of x1 and y1 are different, or lengths of x2 and y2 are different.
Notes
Uses Fisher’s z-transform, see [1].
Note that the alternatives mean “less” or “greater” on the real number line, not in absolute value.
References
[1]Asuero, A. G., Sayago, A., & González, A. G. (2006). The correlation coefficient: An overview. Critical reviews in analytical chemistry, 36(1), 41-59.