[#BloombergLP-bdlsta-LineFit] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdlsta.adoc[bdlsta]::LineFit :relfileprefix: ../../ :mrdocs: Online calculator for least‐squares line fit. == Synopsis Declared in `<bdlsta_linefit.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- 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 [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bdlsta/LineFit/_04enum.adoc[`Unnamed enum`] | Status codes returned by statistical computations. |=== == Member Functions [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bdlsta/LineFit/2constructor.adoc[`LineFit`] [.small]#[constructor]# | Create an empty `LineFit` object. | xref:BloombergLP/bdlsta/LineFit/add.adoc[`add`] | Add the specified `(xValue, yValue)` point to the data set. | xref:BloombergLP/bdlsta/LineFit/count.adoc[`count`] | Returns the number of elements in the data set. | xref:BloombergLP/bdlsta/LineFit/fit.adoc[`fit`] | Calculate the least‐squares line fit coefficients. | xref:BloombergLP/bdlsta/LineFit/fitIfValid.adoc[`fitIfValid`] | Calculate line fit coefficients when data is sufficient. | xref:BloombergLP/bdlsta/LineFit/variance.adoc[`variance`] | Return the variance of the data set X's. The behavior is undefined unless `2 <= count`. | xref:BloombergLP/bdlsta/LineFit/varianceIfValid.adoc[`varianceIfValid`] | Load variance of the X values into `result` when data is sufficient. | xref:BloombergLP/bdlsta/LineFit/xMean.adoc[`xMean`] | Return the mean of the data set X's. The behavior is undefined unless `1 <= count`. | xref:BloombergLP/bdlsta/LineFit/xMeanIfValid.adoc[`xMeanIfValid`] | Load the mean of the X values into `result` when data is sufficient. | xref:BloombergLP/bdlsta/LineFit/yMean.adoc[`yMean`] | Return the mean of the data set Y's. The behavior is undefined unless `1 <= count`. | xref:BloombergLP/bdlsta/LineFit/yMeanIfValid.adoc[`yMeanIfValid`] | Load the mean of the Y values into `result` when data is sufficient. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#