diff options
Diffstat (limited to 'src/misc.c')
-rw-r--r-- | src/misc.c | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -498,3 +498,11 @@ double std(const double *x, size_t n) return sqrt(sum/n); } + +double gamma_pdf(double x, double k, double theta) +{ + /* Returns the PDF for the gamma distribution. + * + * See https://en.wikipedia.org/wiki/Gamma_distribution. */ + return pow(x,k-1)*exp(-x/theta)/(gsl_sf_gamma(k)*pow(theta,k)); +} |