kstats-correlation covers two related tasks: measuring the strength of association between variables, and modeling a linear relationship. The module is split into two sections reflecting this distinction.
Correlation
Pearson Correlation
Measures the strength and direction of the linear association between two numeric variables. The coefficient ranges from -1 (perfect negative) to +1 (perfect positive).Spearman Correlation
Applies Pearson correlation to the ranks of the data. Measures monotonic association — whether the variables tend to increase together, regardless of linearity.Kendall Tau
Counts concordant and discordant pairs to measure ordinal association. More robust than Spearman for small samples and heavy ties.Point-Biserial Correlation
Measures the association between a binary variable (coded as 0/1 integers) and a continuous variable. Equivalent to Pearson correlation when one variable is dichotomous.Partial Correlation
Measures the association between two variables after controlling for a third variable. Removes the effect of the confounding variable.Correlation and Covariance Matrices
For multi-variable analysis, build pairwise matrices. Each cell contains the correlation (or covariance) between variables and .Choosing a Correlation Method
Math details
Math details
Pearson:Spearman: Pearson correlation applied to ranks.Kendall tau-b:where = concordant pairs, = discordant pairs, = pairs tied only on X, = pairs tied only on Y.Partial correlation:
Regression
Simple Linear Regression
Fits the line to the data using ordinary least squares. The result includes the slope, intercept, goodness-of-fit (), standard errors, residuals, and a prediction function.Math details
Math details
API Reference
Full API Reference
Browse all correlation functions, result types, and parameter overloads in the Dokka-generated reference.