Description
CorrelationResult currently contains coefficient and pValue but no confidence interval. Add Fisher z-transformation CI for Pearson and Spearman correlations:
z = arctanh(r), SE = 1/√(n−3)
CI: tanh(z ± z_{α/2} × SE)
This is already planned in SPECIFICATION.md and matches scipy's pearsonr API which provides confidence_interval(). All prerequisites exist: NormalDistribution is already imported in Correlation.kt, and the CorrelationResult constructor is @PublishedApi internal, so adding a field preserves source compatibility.
Example usage
val result = pearsonCorrelation(x, y, confidenceLevel = 0.95)
result.coefficient // 0.87
result.pValue // 0.001
result.confidenceInterval // ConfidenceInterval(lower = 0.72, upper = 0.94)
Related to #50
Description
CorrelationResultcurrently containscoefficientandpValuebut no confidence interval. Add Fisher z-transformation CI for Pearson and Spearman correlations:z = arctanh(r),SE = 1/√(n−3)CI: tanh(z ± z_{α/2} × SE)This is already planned in SPECIFICATION.md and matches scipy's
pearsonrAPI which providesconfidence_interval(). All prerequisites exist:NormalDistributionis already imported inCorrelation.kt, and theCorrelationResultconstructor is@PublishedApi internal, so adding a field preserves source compatibility.Example usage
Related to #50