#ifndef DNEGBIN_H_ #define DNEGBIN_H_ #include /** *
 * x ~ dnegbin(p, r)
 * f(x|p,r) = ((x+r-1)!/(x!*(r-1)!)) * p^r * (1-p)^x
 * 
* @short Negative Binomial distribution */ class DNegBin : public DistDiscrete { public: DNegBin(); ~DNegBin(); double d(double x, std::vector const ¶meters, bool give_log) const; double p(double q, std::vector const ¶meters, bool lower, bool give_log) const; double q(double p, std::vector const ¶meters, bool lower, bool log_p) const; double r(std::vector const ¶meters) const; double mean(std::vector const ¶meters) const; double var(std::vector const ¶meters) const; /** * Checks that p and r are scalar, and that r is discrete-valued */ bool checkParameterDim (std::vector const ¶meters) const; /** * Checks that p lies in the interval (0,1) and r > 0 */ bool checkParameterValue(std::vector const ¶meters) const; }; #endif /* DNEGBIN_H_ */