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.
Declared in <bdlsta_linefit.h>
class LineFit;
| Name | Description |
|---|---|
Unnamed enum | Status codes returned by statistical computations. |
| Name | Description |
|---|---|
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 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. |
fitIfValid | 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. |
variance | Return the variance of the data set X's. The behavior is undefined unless 2 <= count. |
varianceIfValid | Load into the specified result, the variance of the data set X's. Return 0 on success, and a non-zero value otherwise. Specifically, e_INADEQUATE_DATA is returned if 2 > count. |
xMean | Return the mean of the data set X's. The behavior is undefined unless 1 <= count. |
xMeanIfValid | Load into the specified result, the mean of the data set X's. Return 0 on success, and a non-zero value otherwise. Specifically, e_INADEQUATE_DATA is returned if 1 > count. |
yMean | Return the mean of the data set Y's. The behavior is undefined unless 1 <= count. |
yMeanIfValid | Load into the specified result, the mean of the data set Y's. Return 0 on success, and a non-zero value otherwise. Specifically, e_INADEQUATE_DATA is returned if 1 > count. |