|
| AlgError | AlgLinearFit1D (int datSz, double *datXA, double *datYA, double *dstA, double *dstB, double *dstSigA, double *dstSigB, double *dstQ) |
| | Computes the least squares best fit straight line (y = a + bx) through the given data, ie linear regression. This function is based on the function fit(): Press W. H., Teukolsky S. A., Vetterling W. T. and Flannery B. P, Numerical Recipies in C, 1992, CUP. More...
|
| |
| AlgError | AlgLinearFitIdx1D (double *datXA, double *datYA, int *idxXA, int *idxYA, int idxASz, double *dstA, double *dstB, double *dstSigA, double *dstSigB, double *dstQ) |
| | Computes the least squares best fit straight line (y = a + bx) through the given data, ie linear regression. More...
|
| |
| AlgError | AlgPolynomialLSq (double *xVec, double *yVec, int vecSz, int polyDeg, double *cVec) |
| | Attempts to fit a polynomial to the given data using a least squares approach. More...
|
| |
| AlgError AlgLinearFit1D |
( |
int |
datSz, |
|
|
double * |
datXA, |
|
|
double * |
datYA, |
|
|
double * |
dstA, |
|
|
double * |
dstB, |
|
|
double * |
dstSigA, |
|
|
double * |
dstSigB, |
|
|
double * |
dstQ |
|
) |
| |
Computes the least squares best fit straight line (y = a + bx) through the given data, ie linear regression. This function is based on the function fit(): Press W. H., Teukolsky S. A., Vetterling W. T. and Flannery B. P, Numerical Recipies in C, 1992, CUP.
- Returns
- Error code.
- Parameters
-
| datSz | Number of elements in given data arrays array. |
| datXA | Data array with 'x' values. |
| datYA | Data array with 'y' values. |
| dstA | Destination ptr for intercept 'a', may be NULL. |
| dstB | Destination ptr for gradient 'b', may be NULL. |
| dstSigA | Destination ptr for std dev of 'a', may be NULL. |
| dstSigB | Destination ptr for std dev of 'b', may be NULL. |
| dstQ | Destination ptr for goodness of fit, may be NULL. |
References ALG_ERR_FUNC, ALG_ERR_NONE, and AlgGammaP().
| AlgError AlgPolynomialLSq |
( |
double * |
xVec, |
|
|
double * |
yVec, |
|
|
int |
vecSz, |
|
|
int |
polyDeg, |
|
|
double * |
cVec |
|
) |
| |
Attempts to fit a polynomial to the given data using a least squares approach.
- Returns
- Error code.
- Parameters
-
| xVec | Data vector x of size vecSz. |
| yVec | Data vector y of size vecSz. |
| vecSz | Size of data vectors. |
| polyDeg | Degree of ploynomial. |
| cVec | Destination vector for the polynomial coefficients, which must have at least polyDeg + 1 elements. |
References AlcFree(), AlcMalloc(), ALG_DBG, ALG_DBG_LVL_1, ALG_DBG_LVL_FN, ALG_ERR_FUNC, ALG_ERR_MALLOC, AlgMatrixGaussSolve(), AlgMatrixRectFree(), AlgMatrixRectNew(), _AlgMatrixRect::array, _AlgMatrix::core, and _AlgMatrix::rect.