covariance
Calculates covariance for two same-length arrays using Arith decimal arithmetic.
API Reference
Signature
Parameters
Returns
Returns sum((x - meanX) * (y - meanY)) / denominator.
Throws
- Throws if either input is not a non-empty array.
- Throws if the arrays have different lengths.
- Throws if any value is non-finite.
- Throws if
sample: trueis used with fewer than two pairs. - Throws if
options.sampleis not boolean when provided.
Agent Contract
Agent Notes
- Population covariance is the default.
- Use
{ sample: true }for sample covariance.