|
SDDS ToolKit Programs and Libraries for C and Python
|
Computes statistical measures such as median, percentiles, average, and middle values.
This file contains functions to compute median, percentiles, averages, and the middle value of datasets. See also the find_XX() routines in rowmedian.c which return the position of the median and other statistics.
Definition in file median.c.
#include "mdb.h"Go to the source code of this file.
Functions | |
| long | compute_median (double *value, double *x, long n) |
| Computes the median of an array of doubles. | |
| long | compute_percentile (double *value, double *x, long n, double percentile) |
| Computes a specific percentile of an array of doubles. | |
| long | compute_percentiles (double *position, double *percent, long positions, double *x, long n) |
| Computes multiple percentiles of an array of doubles. | |
| long | compute_percentiles_flagged (double *position, double *percent, long positions, double *x, int32_t *keep, int64_t n) |
| Computes multiple percentiles of an array of doubles, considering only flagged elements. | |
| long | compute_average (double *value, double *data, int64_t n) |
| Computes the average of an array of doubles. | |
| long | compute_middle (double *value, double *data, long n) |
| Computes the middle value between the minimum and maximum of an array of doubles. | |
| long | approximate_percentiles (double *position, double *percent, long positions, double *x, long n, long bins) |
| Approximates multiple percentiles of an array of doubles using histogram bins. | |
| long approximate_percentiles | ( | double * | position, |
| double * | percent, | ||
| long | positions, | ||
| double * | x, | ||
| long | n, | ||
| long | bins ) |
Approximates multiple percentiles of an array of doubles using histogram bins.
| position | Pointer to the array to store the computed percentile positions. |
| percent | Pointer to the array of percentiles to compute (each value between 0-100). |
| positions | Number of percentiles to compute. |
| x | Pointer to the array of doubles. |
| n | Number of elements in the array. |
| bins | Number of histogram bins to use for approximation. |
Definition at line 187 of file median.c.
| long compute_average | ( | double * | value, |
| double * | data, | ||
| int64_t | n ) |
Computes the average of an array of doubles.
| value | Pointer to store the computed average value. |
| data | Pointer to the array of doubles. |
| n | Number of elements in the array. |
Definition at line 144 of file median.c.
| long compute_median | ( | double * | value, |
| double * | x, | ||
| long | n ) |
Computes the median of an array of doubles.
| value | Pointer to store the computed median value. |
| x | Pointer to the array of doubles. |
| n | Number of elements in the array. |
Definition at line 29 of file median.c.
| long compute_middle | ( | double * | value, |
| double * | data, | ||
| long | n ) |
Computes the middle value between the minimum and maximum of an array of doubles.
| value | Pointer to store the computed middle value. |
| data | Pointer to the array of doubles. |
| n | Number of elements in the array. |
Definition at line 165 of file median.c.
| long compute_percentile | ( | double * | value, |
| double * | x, | ||
| long | n, | ||
| double | percentile ) |
Computes a specific percentile of an array of doubles.
| value | Pointer to store the computed percentile value. |
| x | Pointer to the array of doubles. |
| n | Number of elements in the array. |
| percentile | The desired percentile to compute (0-100). |
Definition at line 56 of file median.c.
| long compute_percentiles | ( | double * | position, |
| double * | percent, | ||
| long | positions, | ||
| double * | x, | ||
| long | n ) |
Computes multiple percentiles of an array of doubles.
| position | Pointer to the array to store the computed percentile values. |
| percent | Pointer to the array of percentiles to compute (each value between 0-100). |
| positions | Number of percentiles to compute. |
| x | Pointer to the array of doubles. |
| n | Number of elements in the array. |
Definition at line 84 of file median.c.
| long compute_percentiles_flagged | ( | double * | position, |
| double * | percent, | ||
| long | positions, | ||
| double * | x, | ||
| int32_t * | keep, | ||
| int64_t | n ) |
Computes multiple percentiles of an array of doubles, considering only flagged elements.
| position | Pointer to the array to store the computed percentile values. |
| percent | Pointer to the array of percentiles to compute (each value between 0-100). |
| positions | Number of percentiles to compute. |
| x | Pointer to the array of doubles. |
| keep | Pointer to the array of flags indicating which elements to include. |
| n | Number of elements in the array. |
Definition at line 113 of file median.c.