Gromacs
2018.8
|
Declares simple statistics toolbox.
Typedefs | |
typedef struct gmx_stats * | gmx_stats_t |
Abstract container type. | |
Functions | |
gmx_stats_t | gmx_stats_init () |
Initiate a data structure. More... | |
void | gmx_stats_free (gmx_stats_t stats) |
Destroy a data structure. More... | |
int | gmx_stats_remove_outliers (gmx_stats_t stats, double level) |
Remove outliers from a straight line, where level in units of sigma. Level needs to be larger than one obviously. More... | |
int | gmx_stats_add_point (gmx_stats_t stats, double x, double y, double dx, double dy) |
Add a point to the data set. More... | |
int | gmx_stats_add_points (gmx_stats_t stats, int n, real *x, real *y, real *dx, real *dy) |
Add a series of datapoints at once. The arrays dx and dy may be NULL in that case zero uncertainties will be assumed. More... | |
int | gmx_stats_get_point (gmx_stats_t stats, real *x, real *y, real *dx, real *dy, real level) |
Delivers data points from the statistics. More... | |
int | gmx_stats_get_ab (gmx_stats_t stats, int weight, real *a, real *b, real *da, real *db, real *chi2, real *Rfit) |
Fit the data to y = ax + b, possibly weighted, if uncertainties have been input. da and db may be NULL. More... | |
int | gmx_stats_get_a (gmx_stats_t stats, int weight, real *a, real *da, real *chi2, real *Rfit) |
Fit the data to y = ax, possibly weighted, if uncertainties have have been input. da and db may be NULL. More... | |
int | gmx_stats_get_corr_coeff (gmx_stats_t stats, real *R) |
Get the correlation coefficient. More... | |
int | gmx_stats_get_rmsd (gmx_stats_t stats, real *rmsd) |
Get the root mean square deviation. More... | |
int | gmx_stats_get_npoints (gmx_stats_t stats, int *N) |
Get the number of points. More... | |
int | gmx_stats_get_average (gmx_stats_t stats, real *aver) |
Computes and returns the average value. More... | |
int | gmx_stats_get_sigma (gmx_stats_t stats, real *sigma) |
Computes and returns the standard deviation. More... | |
int | gmx_stats_get_error (gmx_stats_t stats, real *error) |
Computes and returns the standard error. More... | |
int | gmx_stats_get_ase (gmx_stats_t stats, real *aver, real *sigma, real *error) |
Pointers may be null, in which case no assignment will be done. More... | |
int | gmx_stats_dump_xy (gmx_stats_t stats, FILE *fp) |
Dump the x, y, dx, dy data to a text file. More... | |
int | gmx_stats_make_histogram (gmx_stats_t stats, real binwidth, int *nbins, int ehisto, int normalized, real **x, real **y) |
Make a histogram of the data present. More... | |
const char * | gmx_stats_message (int estats) |
Return message belonging to error code. More... | |
int | lsq_y_ax (int n, real x[], real y[], real *a) |
Fit a straight line y=ax thru the n data points x, y, return the slope in *a. More... | |
int | lsq_y_ax_b (int n, real x[], real y[], real *a, real *b, real *r, real *chi2) |
Fit a straight line y=ax+b thru the n data points x, y. More... | |
int | lsq_y_ax_b_xdouble (int n, double x[], real y[], real *a, real *b, real *r, real *chi2) |
Fit a straight line y=ax+b thru the n data points x, y. More... | |
int | lsq_y_ax_b_error (int n, real x[], real y[], real dy[], real *a, real *b, real *da, real *db, real *r, real *chi2) |
Fit a straight line y=ax+b thru the n data points x, y. More... | |
int gmx_stats_add_point | ( | gmx_stats_t | stats, |
double | x, | ||
double | y, | ||
double | dx, | ||
double | dy | ||
) |
Add a point to the data set.
[in] | stats | The data structure |
[in] | x | The x value |
[in] | y | The y value |
[in] | dx | The error in the x value |
[in] | dy | The error in the y value |
int gmx_stats_add_points | ( | gmx_stats_t | stats, |
int | n, | ||
real * | x, | ||
real * | y, | ||
real * | dx, | ||
real * | dy | ||
) |
Add a series of datapoints at once. The arrays dx and dy may be NULL in that case zero uncertainties will be assumed.
[in] | stats | The data structure |
[in] | n | Number of points |
[in] | x | The array of x values |
[in] | y | The array of y values |
[in] | dx | The error in the x value |
[in] | dy | The error in the y value |
int gmx_stats_dump_xy | ( | gmx_stats_t | stats, |
FILE * | fp | ||
) |
Dump the x, y, dx, dy data to a text file.
[in] | stats | The data structure |
[in] | fp | File pointer |
void gmx_stats_free | ( | gmx_stats_t | stats | ) |
Destroy a data structure.
stats | The data structure |
int gmx_stats_get_a | ( | gmx_stats_t | stats, |
int | weight, | ||
real * | a, | ||
real * | da, | ||
real * | chi2, | ||
real * | Rfit | ||
) |
Fit the data to y = ax, possibly weighted, if uncertainties have have been input. da and db may be NULL.
[in] | stats | The data structure |
[in] | weight | type of weighting |
[out] | a | slope |
[out] | da | sigma in a |
[out] | chi2 | normalized quality of fit |
[out] | Rfit | correlation coefficient |
int gmx_stats_get_ab | ( | gmx_stats_t | stats, |
int | weight, | ||
real * | a, | ||
real * | b, | ||
real * | da, | ||
real * | db, | ||
real * | chi2, | ||
real * | Rfit | ||
) |
Fit the data to y = ax + b, possibly weighted, if uncertainties have been input. da and db may be NULL.
[in] | stats | The data structure |
[in] | weight | type of weighting |
[out] | a | slope |
[out] | b | intercept |
[out] | da | sigma in a |
[out] | db | sigma in b |
[out] | chi2 | normalized quality of fit |
[out] | Rfit | correlation coefficient |
int gmx_stats_get_ase | ( | gmx_stats_t | stats, |
real * | aver, | ||
real * | sigma, | ||
real * | error | ||
) |
Pointers may be null, in which case no assignment will be done.
[in] | stats | The data structure |
[out] | aver | Average value |
[out] | sigma | Standard deviation |
[out] | error | Standard error |
int gmx_stats_get_average | ( | gmx_stats_t | stats, |
real * | aver | ||
) |
Computes and returns the average value.
[in] | stats | The data structure |
[out] | aver | Average value |
int gmx_stats_get_corr_coeff | ( | gmx_stats_t | stats, |
real * | R | ||
) |
Get the correlation coefficient.
[in] | stats | The data structure |
[out] | R | the correlation coefficient between the data (x and y) as input to the structure. |
int gmx_stats_get_error | ( | gmx_stats_t | stats, |
real * | error | ||
) |
Computes and returns the standard error.
[in] | stats | The data structure |
[out] | error | Standard error |
int gmx_stats_get_npoints | ( | gmx_stats_t | stats, |
int * | N | ||
) |
Get the number of points.
[in] | stats | The data structure |
[out] | N | number of data points |
Delivers data points from the statistics.
Should be used in a while loop. Variables for either pointer may be NULL, in which case the routine can be used as an expensive point counter. Return the data points one by one. Return estatsOK while there are more points, and returns estatsNOPOINTS when the last point has been returned. If level > 0 then the outliers outside level*sigma are reported only.
[in] | stats | The data structure |
[out] | x | The array of x values |
[out] | y | The array of y values |
[out] | dx | The error in the x value |
[out] | dy | The error in the y value |
[in] | level | sigma level (see above) |
int gmx_stats_get_rmsd | ( | gmx_stats_t | stats, |
real * | rmsd | ||
) |
Get the root mean square deviation.
[in] | stats | The data structure |
[out] | rmsd | the root mean square deviation between x and y values. |
int gmx_stats_get_sigma | ( | gmx_stats_t | stats, |
real * | sigma | ||
) |
Computes and returns the standard deviation.
[in] | stats | The data structure |
[out] | sigma | Standard deviation |
gmx_stats_t gmx_stats_init | ( | ) |
Initiate a data structure.
int gmx_stats_make_histogram | ( | gmx_stats_t | stats, |
real | binwidth, | ||
int * | nbins, | ||
int | ehisto, | ||
int | normalized, | ||
real ** | x, | ||
real ** | y | ||
) |
Make a histogram of the data present.
Uses either binwidth to determine the number of bins, or nbins to determine the binwidth, therefore one of these should be zero, but not the other. If *nbins = 0 the number of bins will be returned in this variable. ehisto should be one of ehistoX or ehistoY. If normalized not equal to zero, the integral of the histogram will be normalized to one. The output is in two arrays, *x and *y, to which you should pass a pointer. Memory for the arrays will be allocated as needed. Function returns one of the estats codes.
[in] | stats | The data structure |
[in] | binwidth | For the histogram |
[in] | nbins | Number of bins |
[in] | ehisto | Type (see enum above) |
[in] | normalized | see above |
[out] | x | see above |
[out] | y | see above |
const char* gmx_stats_message | ( | int | estats | ) |
Return message belonging to error code.
[in] | estats | error code |
int gmx_stats_remove_outliers | ( | gmx_stats_t | stats, |
double | level | ||
) |
Remove outliers from a straight line, where level in units of sigma. Level needs to be larger than one obviously.
[in] | stats | The data structure |
[in] | level | The sigma level |
Fit a straight line y=ax thru the n data points x, y, return the slope in *a.
[in] | n | number of points |
[in] | x | data points x |
[in] | y | data point y |
[out] | a | slope |
Fit a straight line y=ax+b thru the n data points x, y.
[in] | n | number of points |
[in] | x | data points x |
[in] | y | data point y |
[out] | a | slope |
[out] | b | intercept |
[out] | r | correlation coefficient |
[out] | chi2 | quality of fit |
int lsq_y_ax_b_error | ( | int | n, |
real | x[], | ||
real | y[], | ||
real | dy[], | ||
real * | a, | ||
real * | b, | ||
real * | da, | ||
real * | db, | ||
real * | r, | ||
real * | chi2 | ||
) |
Fit a straight line y=ax+b thru the n data points x, y.
[in] | n | number of points |
[in] | x | data points x |
[in] | y | data point y |
[in] | dy | uncertainty in data point y |
[out] | a | slope |
[out] | b | intercept |
[out] | da | error in slope |
[out] | db | error in intercept |
[out] | r | correlation coefficient |
[out] | chi2 | quality of fit |
Fit a straight line y=ax+b thru the n data points x, y.
[in] | n | number of points |
[in] | x | data points x |
[in] | y | data point y |
[out] | a | slope |
[out] | b | intercept |
[out] | r | correlation coefficient |
[out] | chi2 | quality of fit |