|
Rejection Sampling
|
#include <stdio.h>#include <stdlib.h>#include <math.h>#include <gsl/gsl_rng.h>
Go to the source code of this file.
Functions | |
| void | Generate_Corrected_Pareto (double *pointer, size_t length, double alpha, double delta, double xmin, const gsl_rng *rng) |
| int | Hi2Lo (const void *a, const void *b) |
| int | main (void) |
| void Generate_Corrected_Pareto | ( | double * | pointer, |
| size_t | length, | ||
| double | alpha, | ||
| double | delta, | ||
| double | xmin, | ||
| const gsl_rng * | rng | ||
| ) |
Generates a sample of size length with density function
\[ f(x; x_0, \alpha, \delta) = \frac{\alpha+\delta}{\delta} \frac{\alpha}{x_0} \left( \frac{x}{x_0} \right)^{-(\alpha+1)} \cdot \left[ 1- \left( \frac{x}{x_0} \right)^{-\delta} \right] \]
The complementary distribution function is
\[ F(x; x_0, \alpha, \delta) \equiv \mathbf{P}(X \geq x) = \frac{\alpha+\delta}{\delta} \left( \frac{x}{x_0} \right)^{-\alpha} \cdot \left[ 1-\frac{\alpha}{\alpha+\delta} \left( \frac{x}{x_0} \right)^{-\delta} \right] *\]
Definition at line 99 of file gyak2_rejection_sampling.c.
| int Hi2Lo | ( | const void * | a, |
| const void * | b | ||
| ) |
A comparator for the C library quicksort function (stdlib.h/qsort). Descending order for doubles.
Definition at line 121 of file gyak2_rejection_sampling.c.
| int main | ( | void | ) |
Definition at line 54 of file gyak2_rejection_sampling.c.
1.7.4