BloombergLP::bdlsta::LineFit

Online calculator for least-squares line fit.

Synopsis

Declared in <bdlsta_linefit.h>

class LineFit;

Description

This class provides an efficient online algorithm for calculating linear square line fit. The class also calculates the mean for the X's and Y's, and variance for the X's. These are byproducts of calculating the line fit. The online algorithm is detailed in the implementation notes.

Enums

NameDescription
Unnamed enum Status codes returned by statistical computations.

Member Functions

NameDescription
LineFit [constructor]Create an empty LineFit object.
add Add the specified (xValue, yValue) point to the data set.
count Returns the number of elements in the data set.
fit Calculate the least-squares line fit coefficients.
fitIfValid Calculate line fit coefficients when data is sufficient.
variance Return the variance of the data set X's. The behavior is undefined unless 2 <= count.
varianceIfValid Load variance of the X values into result when data is sufficient.
xMean Return the mean of the data set X's. The behavior is undefined unless 1 <= count.
xMeanIfValid Load the mean of the X values into result when data is sufficient.
yMean Return the mean of the data set Y's. The behavior is undefined unless 1 <= count.
yMeanIfValid Load the mean of the Y values into result when data is sufficient.