diff --git a/lib/node_modules/@stdlib/stats/base/dists/gamma/logpdf/README.md b/lib/node_modules/@stdlib/stats/base/dists/gamma/logpdf/README.md index 6f19ff51b1ce..960d84e4fa2c 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/gamma/logpdf/README.md +++ b/lib/node_modules/@stdlib/stats/base/dists/gamma/logpdf/README.md @@ -155,6 +155,104 @@ for ( i = 0; i < 10; i++ ) { + + +* * * + +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +#include "stdlib/stats/base/dists/gamma/logpdf.h" +``` + +#### stdlib_base_dists_gamma_logpdf( x, alpha, beta ) + +Evaluates the logarithm of the probability density function (PDF) for a gamma distribution with shape parameter `alpha` and rate parameter `beta` at a value `x`. + +```c +double out = stdlib_base_dists_gamma_logpdf( 2.0, 0.5, 1.0 ); +// returns ~-2.919 +``` + +The function accepts the following arguments: + +- **x**: `[in] double` input value. +- **mu**: `[in] double` shape parameter. +- **b**: `[in] double` rate parameter. + +```c +double stdlib_base_dists_gamma_logpdf( const double x, const double alpha, const double beta ); +``` + +
+ + + + + +
+ +
+ + + + + +
+ +### Examples + +```c +#include "stdlib/stats/base/dists/gamma/logpdf.h" +#include +#include + +static double random_uniform( const double min, const double max ) { + double v = (double)rand() / ( (double)RAND_MAX + 1.0 ); + return min + ( v*(max-min) ); +} + +int main( void ) { + double alpha; + double beta; + double x; + double y; + int i; + + for ( i = 0; i < 25; i++ ) { + x = random_uniform( 0.0, 10.0 ) - 5.0; + alpha = random_uniform( 0.0, 20.0 ); + beta = random_uniform( 0.0, 20.0 ); + y = stdlib_base_dists_gamma_logpdf( x, alpha, beta ); + printf( "x: %lf, α: %lf, β: %lf, ln(f(x;α,β)): %lf\n", x, alpha, beta, y ); + } +} +``` + +
+ + + +
+ + +