BloombergLP::bdlsta::LineFit::fit

Calculate the least-squares line fit coefficients.

Synopsis

Declared in <bdlsta_linefit.h>

void
fit(
    double* alpha,
    double* beta) const;

Description

Calculate line fit coefficients Y = Alpha + Beta * X, and populate the specified alpha (intercept) and beta (slope). The behavior is undefined if 2 > count or all X's are identical.

Parameters

NameDescription
alphareceives the intercept of the fitted line
betareceives the slope of the fitted line