|
TPCCLIB
|
Pearson's correlation coefficient and regression line. More...
#include "libtpcmodel.h"Go to the source code of this file.
Functions | |
| int | pearson (double *x, double *y, int nr, double *k, double *kSD, double *b, double *bSD, double *r, double *ySD) |
| int | pearson2 (double *x, double *y, char *is, int nr, double *k, double *kSD, double *b, double *bSD, double *r, double *ySD) |
| int | pearson3 (double *x, double *y, int nr, double *k, double *kSD, double *b, double *bSD, double *r, double *ySD) |
| int | pearson4 (double *x, double *y, int nr, double start, double end, double *k, double *kSD, double *b, double *bSD, double *r, double *ySD) |
| Calculate slope and intercept of a line and Pearson's correlation coefficient. | |
| int | best_pearson (double *x, double *y, int nr, int min_nr, int *first, int *last, double *k, double *kSD, double *b, double *bSD, double *r, double *ySD) |
| int | mean (double *x, double *y, int nr, double *xmean, double *xsd, double *ymean, double *ysd) |
| int | regr_line (double *x, double *y, int n, double *m, double *c) |
| int | highest_slope (double *x, double *y, int n, int slope_n, double *m, double *c, double *xi, double *xh) |
| int | highest_slope_after (double *x, double *y, int n, int slope_n, double x_start, double *m, double *c, double *xi, double *xh) |
Pearson's correlation coefficient and regression line.
Definition in file pearson.c.
| int best_pearson | ( | double * | x, |
| double * | y, | ||
| int | nr, | ||
| int | min_nr, | ||
| int * | first, | ||
| int * | last, | ||
| double * | k, | ||
| double * | kSD, | ||
| double * | b, | ||
| double * | bSD, | ||
| double * | r, | ||
| double * | ySD ) |
Find the best linear fit to double data (x[], y[]) with nr points.
Data may contain NaN's, which are not used.
| x | Data x values |
| y | Data y values |
| nr | Number of data sample values |
| min_nr | Minimum nr of data points to use |
| first | Index [0..last-2] of the first point to use initially, and after fitting |
| last | Index [first+1..nr-1] of the last point to use initially, and after fitting |
| k | slope |
| kSD | S.D. of slope |
| b | y axis intercept |
| bSD | S.D. of y axis intercept |
| r | Pearson's correlation coefficient, r |
| ySD | Residual variance of y values |
Definition at line 252 of file pearson.c.
| int highest_slope | ( | double * | x, |
| double * | y, | ||
| int | n, | ||
| int | slope_n, | ||
| double * | m, | ||
| double * | c, | ||
| double * | xi, | ||
| double * | xh ) |
Finds the regression line with the highest slope for x,y data.
| x | An array of x axis values |
| y | An array of y axis values |
| n | The number of values in x and y arrays |
| slope_n | The number of samples used to fit the line |
| m | Pointer where calculated slope is written; NULL if not needed |
| c | 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 |
| xh | Pointer where the place (x) of the highest slope is written; NULL if not needed |
Definition at line 424 of file pearson.c.
Referenced by dftFixPeak().
| int highest_slope_after | ( | double * | x, |
| double * | y, | ||
| int | n, | ||
| int | slope_n, | ||
| double | x_start, | ||
| double * | m, | ||
| double * | c, | ||
| double * | xi, | ||
| double * | xh ) |
Finds the regression line with the highest slope for x,y data after specified x.
| x | An array of x axis values. |
| y | An array of y axis values. |
| n | The number of values in x and y arrays. |
| slope_n | The number of samples used to fit the line. |
| x_start | Estimation start x value, samples with smaller x are ignored; can usually be set to zero. |
| m | Pointer where calculated slope is written; NULL if not needed. |
| c | 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. |
| xh | Pointer where the place (x) of the highest slope is written; NULL if not needed. |
Definition at line 475 of file pearson.c.
| int mean | ( | double * | x, |
| double * | y, | ||
| int | nr, | ||
| double * | xmean, | ||
| double * | xsd, | ||
| double * | ymean, | ||
| double * | ysd ) |
Calculates the mean and SD of data. Data (y data) may contain NaN's.
| x | Data x values |
| y | Data y values |
| nr | Number of data sample values |
| xmean | Calculated x mean |
| xsd | Calculated SD of x mean |
| ymean | Calculated y mean |
| ysd | Calculated SD of y mean |
Definition at line 341 of file pearson.c.
Referenced by dftMeanTAC(), doubleMatchRel(), imgsegmClusterExpand(), least_trimmed_square(), mertwiRandomExponential(), noiseSD4SimulationFromDFT(), and resMean().
| int pearson | ( | double * | x, |
| double * | y, | ||
| int | nr, | ||
| double * | k, | ||
| double * | kSD, | ||
| double * | b, | ||
| double * | bSD, | ||
| double * | r, | ||
| double * | ySD ) |
Calculate slope and intercept of a line and Pearson's correlation coefficient.
| x | data x values |
| y | data y values |
| nr | number of data sample values |
| k | slope |
| kSD | S.D. of slope |
| b | y axis intercept |
| bSD | S.D. of y axis intercept |
| r | Pearson's correlation coefficient, r |
| ySD | Residual variance of y values |
Definition at line 14 of file pearson.c.
Referenced by best_logan_regr(), best_pearson(), dft_end_line(), extrapolate_monoexp(), pearson2(), pearson3(), and pearson4().
| int pearson2 | ( | double * | x, |
| double * | y, | ||
| char * | is, | ||
| int | nr, | ||
| double * | k, | ||
| double * | kSD, | ||
| double * | b, | ||
| double * | bSD, | ||
| double * | r, | ||
| double * | ySD ) |
Calculate slope and intercept of a line and Pearson's correlation coefficient.
Array char is[] specifies whether single (x,y) points are used in the fit.
| x | data x values |
| y | data y values |
| is | Switch values: 0=do not use this point |
| nr | number of data sample values |
| k | slope |
| kSD | S.D. of slope |
| b | y axis intercept |
| bSD | S.D. of y axis intercept |
| r | Pearson's correlation coefficient, r |
| ySD | Residual variance of y values |
Definition at line 109 of file pearson.c.
| int pearson3 | ( | double * | x, |
| double * | y, | ||
| int | nr, | ||
| double * | k, | ||
| double * | kSD, | ||
| double * | b, | ||
| double * | bSD, | ||
| double * | r, | ||
| double * | ySD ) |
Calculate slope and intercept of a line and Pearson's correlation coefficient.
Data points may contain NaN's.
| x | data x values |
| y | data y values |
| nr | number of data sample values |
| k | slope |
| kSD | S.D. of slope |
| b | y axis intercept |
| bSD | S.D. of y axis intercept |
| r | Pearson's correlation coefficient, r |
| ySD | Residual variance of y values |
Definition at line 154 of file pearson.c.
| int pearson4 | ( | double * | x, |
| double * | y, | ||
| int | nr, | ||
| double | start, | ||
| double | end, | ||
| double * | k, | ||
| double * | kSD, | ||
| double * | b, | ||
| double * | bSD, | ||
| double * | r, | ||
| double * | ySD ) |
Calculate slope and intercept of a line and Pearson's correlation coefficient.
Data points may contain NaN's. Fit start and end times are specified.
| x | data x values |
| y | data y values |
| nr | number of data sample values |
| start | fit start time |
| end | fit end time |
| k | slope |
| kSD | S.D. of slope |
| b | y axis intercept |
| bSD | S.D. of y axis intercept |
| r | Pearson's correlation coefficient, r |
| ySD | Residual variance of y values |
Definition at line 198 of file pearson.c.
| int regr_line | ( | double * | x, |
| double * | y, | ||
| int | n, | ||
| double * | m, | ||
| double * | c ) |
Calculates regression line slope (m) and y axis intercept.
Data (x and y data) may contain NaN's.
| x | An array of x axis values. |
| y | An array of y axis values. |
| n | The number of values in x and y arrays. |
| m | Pointer where calculated slope is written. |
| c | Pointer where calculated y axis intercept is written. |
Definition at line 387 of file pearson.c.
Referenced by highest_slope(), and highest_slope_after().