BloombergLP::bdlsta::LineFit::fitIfValid

Calculate line fit coefficients when data is sufficient.

Synopsis

Declared in <bdlsta_linefit.h>

int
fitIfValid(
    double* alpha,
    double* beta) const;

Description

Calculate line fit coefficients Y = Alpha + Beta * X, and populate the specified alpha (intercept) and beta (slope). Return 0 on success, and non-zero otherwise. The computations is unsuccessful if 2 > count or all X's are identical.

Return Value

0 on success, and a non-zero value otherwise

Parameters

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