[192840]: src / modules / bugs / distributions / DGenGamma.h  Maximize  Restore  History

Download this file

39 lines (33 with data), 1.1 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#ifndef DGEN_GAMMA_H_
#define DGEN_GAMMA_H_
#include <distribution/RScalarDist.h>
namespace jags {
namespace bugs {
/**
* @short Generalizedgamma distribution
* <pre>
* X ~ dgen.gamma(r, mu, beta)
* f(x|r,mu) = beta * mu^(beta*r) * x^(beta*r - 1) * exp(-(mu * x)^beta) / gamma(r)
* </pre>
*/
class DGenGamma : public RScalarDist {
public:
DGenGamma();
std::string alias() const;
double d(double x, PDFType type,
std::vector<double const *> const &parameters,
bool give_log) const;
double p(double q, std::vector<double const *> const &parameters, bool lower,
bool give_log) const;
double q(double p, std::vector<double const *> const &parameters, bool lower,
bool log_p) const;
double r(std::vector<double const *> const &parameters, RNG *rng) const;
/**
* Checks that r > 0, mu > 0, beta > 0
*/
bool checkParameterValue(std::vector<double const *> const &parameters) const;
double KL(std::vector<double const *> const &par1,
std::vector<double const *> const &par2) const;
};
}}
#endif /* DGEN_GAMMA_H_ */