|
TPCCLIB
|
Regression line fitting. More...
#include "tpcclibConfig.h"#include <stdio.h>#include <stdlib.h>#include <math.h>#include "tpcextensions.h"#include "tpclinopt.h"Go to the source code of this file.
Functions | |
| int | fitLine (double *x, double *y, const int n, double *m, double *c) |
| int | fitLinePearson (double *x, double *y, const int n, double *m, double *msd, double *c, double *csd, double *d, double *dsd, double *r, double *ysd) |
| int | highestSlope (double *x, double *y, const int n, const int slope_n, double x_start, double *m, double *yi, double *xi, double *xh) |
| int fitLine | ( | double * | x, |
| double * | y, | ||
| const int | n, | ||
| double * | m, | ||
| double * | c ) |
Calculate regression line slope (m) and y axis intercept (c).
| x | Pointer to an array of x axis values. NaN's and infinite values are ignored. |
| y | Pointer to an array of y axis values. NaN's and infinite values are ignored. |
| n | The number of samples (length of x[] and y[]). |
| m | Pointer where calculated slope is written; enter NULL if not needed. |
| c | Pointer where calculated y axis intercept is written; enter NULL if not needed. |
Definition at line 23 of file regression.c.
Referenced by highestSlope().
| int fitLinePearson | ( | double * | x, |
| double * | y, | ||
| const int | n, | ||
| double * | m, | ||
| double * | msd, | ||
| double * | c, | ||
| double * | csd, | ||
| double * | d, | ||
| double * | dsd, | ||
| double * | r, | ||
| double * | ysd ) |
Calculate regression line slope (m), y axis intercept (c), their SDs, and Pearson's correlation coefficient (r).
| x | Pointer to an array of x axis values. NaN's and infinite values are ignored. |
| y | Pointer to an array of y axis values. NaN's and infinite values are ignored. |
| n | The number of samples (length of x[] and y[]). |
| m | Pointer where calculated slope is written; enter NULL if not needed. |
| msd | Pointer where SD of slope is written; enter NULL if not needed. |
| c | Pointer where calculated y axis intercept is written; enter NULL if not needed. |
| csd | Pointer where SD of y axis intercept is written; enter NULL if not needed. |
| d | Pointer where calculated x axis intercept is written; enter NULL if not needed. |
| dsd | Pointer where SD of x axis intercept is written; enter NULL if not needed. |
| r | Pointer where Pearson's correlation coefficient is written; enter NULL if not needed. |
| ysd | Pointer where residual variance of y values is written; enter NULL if not needed. |
Definition at line 72 of file regression.c.
| int highestSlope | ( | double * | x, |
| double * | y, | ||
| const int | n, | ||
| const int | slope_n, | ||
| double | x_start, | ||
| double * | m, | ||
| double * | yi, | ||
| double * | xi, | ||
| double * | xh ) |
Find the regression line with the highest slope for x,y data.
| x | Pointer to an array of x axis values. NaN's and infinite values are ignored. Data must be sorted by increasing x, and overlapping x values may cause problem. |
| y | Pointer to an array of y axis values. NaN's and infinite values are ignored. Data is not modified. |
| n | The number of samples (length of x[] and y[]). |
| slope_n | The number of samples used to fit the line; must be at least 2. |
| x_start | Estimation start x value, samples with smaller x are ignored; can usually be set to zero. |
| m | Pointer where calculated max slope is written; NULL if not needed. |
| yi | Pointer where calculated y axis intercept is written; NULL if not needed. |
| xi | Pointer where calculated x axis intercept is written; NULL if not needed. This could be used as an estimate of radioactivity appearance time in TAC data, but you must then check that the max slope m is positive. |
| xh | Pointer where the place (x) of the highest slope is written; NULL if not needed. |
Definition at line 179 of file regression.c.