Zephyr Scientific Library (zscilib)
|
Probability-related functions. More...
Files | |
file | probability.h |
API header file for probability in zscilib. | |
Functions | |
zsl_real_t | zsl_prob_uni_pdf (zsl_real_t *a, zsl_real_t *b, zsl_real_t *x) |
Computes the image of a value x of the uniform probability distribution function (PDF), which has zero probability everywhere except in the interval (a, b). More... | |
int | zsl_prob_uni_mean (zsl_real_t *a, zsl_real_t *b, zsl_real_t *m) |
Computes the mean of a uniform probability distribution function of interval (a, b). More... | |
int | zsl_prob_uni_var (zsl_real_t *a, zsl_real_t *b, zsl_real_t *v) |
Computes the variance of a uniform probability distribution function of interval (a, b). More... | |
zsl_real_t | zsl_prob_uni_cdf (zsl_real_t *a, zsl_real_t *b, zsl_real_t *x) |
Computes the image of a value x of the uniform cumulative distribution function (CDF) with interval (a, b). More... | |
zsl_real_t | zsl_prob_normal_pdf (zsl_real_t *m, zsl_real_t *s, zsl_real_t *x) |
Computes the image of a value x of the normal probability distribution function (PDF) of mean 'm' and standard deviation 's'. More... | |
zsl_real_t | zsl_prob_normal_cdf (zsl_real_t *m, zsl_real_t *s, zsl_real_t *x) |
Computes the image of a value x of the normal cumulative distribution function (CDF) of mean 'm' and standard deviation 's'. More... | |
zsl_real_t | zsl_prob_erf_inv (zsl_real_t *x) |
Computes the value of the inverse error fuction of a value 'x' using the Chebyshev interpolation to estimate the value of the function. More... | |
zsl_real_t | zsl_prob_normal_cdf_inv (zsl_real_t *m, zsl_real_t *s, zsl_real_t *x) |
Computes the inverse of the normal cumulative distribution function of a value x. More... | |
int | zsl_prob_factorial (int *n) |
Computes the factorial of a natural number, i. e., the finite product n * (n - 1) * (n - 2) * (n - 3) * ... * 3 * 2 * 1. More... | |
int | zsl_prob_binomial_coef (int *n, int *k, int *c) |
Computes binomial coefficient of n and k (commonly writen as 'n over k'). More... | |
zsl_real_t | zsl_prob_binomial_pdf (int *n, zsl_real_t *p, int *x) |
Computes the image of a value x of the binomial probability distribution function (PDF). More... | |
int | zsl_prob_binomial_mean (int *n, zsl_real_t *p, zsl_real_t *m) |
Computes the mean of a binomial probability distribution function. More... | |
int | zsl_prob_binomial_var (int *n, zsl_real_t *p, zsl_real_t *v) |
Computes the variance of a binomial probability distribution function. More... | |
zsl_real_t | zsl_prob_binomial_cdf (int *n, zsl_real_t *p, int *x) |
Computes the image of a value x of the ubinomial cumulative distribution function (CDF). More... | |
int | zsl_prob_entropy (struct zsl_vec *v, zsl_real_t *h) |
Computes the Shannon entropy of a set of events with given probabilities. More... | |
int | zsl_prob_bayes (zsl_real_t *pa, zsl_real_t *pb, zsl_real_t *pba, zsl_real_t *pab) |
Computes the probability of an event A to occur given the event B, based on the probability of A, B and the probability of B given A, using the Bayes' Theorem. More... | |
Probability-related functions.
int zsl_prob_bayes | ( | zsl_real_t * | pa, |
zsl_real_t * | pb, | ||
zsl_real_t * | pba, | ||
zsl_real_t * | pab | ||
) |
Computes the probability of an event A to occur given the event B, based on the probability of A, B and the probability of B given A, using the Bayes' Theorem.
pa | Probability of the event A. |
pb | Probability of the event B. |
pba | Probability of the event B given the event A. |
pab | Probability of the event A given the event B. |
Definition at line 301 of file probability.c.
zsl_real_t zsl_prob_binomial_cdf | ( | int * | n, |
zsl_real_t * | p, | ||
int * | x | ||
) |
Computes the image of a value x of the ubinomial cumulative distribution function (CDF).
n | The number of times the experiment has been done. |
p | The probability of the outcome. |
x | The number of times we want the outcome. |
Definition at line 244 of file probability.c.
int zsl_prob_binomial_coef | ( | int * | n, |
int * | k, | ||
int * | c | ||
) |
Computes binomial coefficient of n and k (commonly writen as 'n over k').
n | The first input natural number. |
k | The second input natural number. This number can be negative or bigger than 'n', but then the function will be returning zero. |
c | The combinatory number of 'n' over 'k'. |
Definition at line 168 of file probability.c.
Referenced by zsl_prob_binomial_cdf(), and zsl_prob_binomial_pdf().
int zsl_prob_binomial_mean | ( | int * | n, |
zsl_real_t * | p, | ||
zsl_real_t * | m | ||
) |
Computes the mean of a binomial probability distribution function.
n | The number of times the experiment has been done. |
p | The probability of the outcome. |
m | The mean value of the binomial distribution. |
Definition at line 208 of file probability.c.
zsl_real_t zsl_prob_binomial_pdf | ( | int * | n, |
zsl_real_t * | p, | ||
int * | x | ||
) |
Computes the image of a value x of the binomial probability distribution function (PDF).
The binomial distribution describes how likely it is to get the same outcome of an experiment exactly 'x' out of the 'n' times the experiment is repeated. In this formula, 'p' is the probability to get such outcome.
n | The number of times the experiment has been done. |
p | The probability of the outcome. |
x | The number of times we want the outcome. |
Definition at line 189 of file probability.c.
int zsl_prob_binomial_var | ( | int * | n, |
zsl_real_t * | p, | ||
zsl_real_t * | v | ||
) |
Computes the variance of a binomial probability distribution function.
n | The number of times the experiment has been performed. |
p | The probability of the outcome. |
v | The variance value of the binomial distribution. |
Definition at line 226 of file probability.c.
int zsl_prob_entropy | ( | struct zsl_vec * | v, |
zsl_real_t * | h | ||
) |
Computes the Shannon entropy of a set of events with given probabilities.
v | The vector with the probabilities of the events. |
h | The Shannon entropy of the probabilities in v. |
Definition at line 274 of file probability.c.
zsl_real_t zsl_prob_erf_inv | ( | zsl_real_t * | x | ) |
Computes the value of the inverse error fuction of a value 'x' using the Chebyshev interpolation to estimate the value of the function.
x | The input value, between -1 and 1 (not included). |
Definition at line 95 of file probability.c.
Referenced by zsl_prob_normal_cdf_inv().
int zsl_prob_factorial | ( | int * | n | ) |
Computes the factorial of a natural number, i. e., the finite product n * (n - 1) * (n - 2) * (n - 3) * ... * 3 * 2 * 1.
n | Natural number to compute its factorial. |
Definition at line 151 of file probability.c.
Referenced by zsl_prob_binomial_coef().
zsl_real_t zsl_prob_normal_cdf | ( | zsl_real_t * | m, |
zsl_real_t * | s, | ||
zsl_real_t * | x | ||
) |
Computes the image of a value x of the normal cumulative distribution function (CDF) of mean 'm' and standard deviation 's'.
m | Mean value of the normal distribution. |
s | Standard deviation of the normal distribution. |
x | Value to calculate its image. |
Definition at line 86 of file probability.c.
zsl_real_t zsl_prob_normal_cdf_inv | ( | zsl_real_t * | m, |
zsl_real_t * | s, | ||
zsl_real_t * | x | ||
) |
Computes the inverse of the normal cumulative distribution function of a value x.
m | Mean value of the normal distribution. |
s | Standard deviation of the normal distribution. |
x | Value to calculate its image. Must be in the open interval (0, 1). |
Definition at line 134 of file probability.c.
zsl_real_t zsl_prob_normal_pdf | ( | zsl_real_t * | m, |
zsl_real_t * | s, | ||
zsl_real_t * | x | ||
) |
Computes the image of a value x of the normal probability distribution function (PDF) of mean 'm' and standard deviation 's'.
m | Mean value of the normal distribution. |
s | Standard deviation of the normal distribution. |
x | Value to calculate its image. |
Definition at line 76 of file probability.c.
zsl_real_t zsl_prob_uni_cdf | ( | zsl_real_t * | a, |
zsl_real_t * | b, | ||
zsl_real_t * | x | ||
) |
Computes the image of a value x of the uniform cumulative distribution function (CDF) with interval (a, b).
a | The lower bound of the interval in which the probability is not zero. |
b | The higher bound of the interval in which the probability is not zero. |
x | Value to calculate its image. |
Definition at line 58 of file probability.c.
int zsl_prob_uni_mean | ( | zsl_real_t * | a, |
zsl_real_t * | b, | ||
zsl_real_t * | m | ||
) |
Computes the mean of a uniform probability distribution function of interval (a, b).
a | The lower bound of the interval in which the probability is not zero. |
b | The higher bound of the interval in which the probability is not zero. |
m | The arithmetic mean of the uniform probability distribution. |
Definition at line 30 of file probability.c.
zsl_real_t zsl_prob_uni_pdf | ( | zsl_real_t * | a, |
zsl_real_t * | b, | ||
zsl_real_t * | x | ||
) |
Computes the image of a value x of the uniform probability distribution function (PDF), which has zero probability everywhere except in the interval (a, b).
a | The lower bound of the interval in which the probability is not zero. |
b | The higher bound of the interval in which the probability is not zero. |
x | Value to calculate its image. |
Definition at line 14 of file probability.c.
int zsl_prob_uni_var | ( | zsl_real_t * | a, |
zsl_real_t * | b, | ||
zsl_real_t * | v | ||
) |
Computes the variance of a uniform probability distribution function of interval (a, b).
a | The lower bound of the interval in which the probability is not zero. |
b | The higher bound of the interval in which the probability is not zero. |
v | The variance of the uniform probability distribution. |
Definition at line 44 of file probability.c.