#ifndef DDIRCH_H_ #define DDIRCH_H_ #include /** * @short Dirichlet distribution * * Zero shape parameters are allowed. These represent structural * zeros: when x ~ ddirch(alpha) is forward sampled, x[i] = 0 when * alpha[i] = 0. To avoid trapping states in the model, structural * zeros are only allowed when the array of shape parameters is * fixed. * *
 * p[] ~ ddirch(alpha[])
 * f(p | alpha) = C * prod(p^alpha)
 * 
*/ class DDirch : public Distribution { public: DDirch(); ~DDirch(); double logLikelihood(SArray const &x, std::vector const ¶meters) const; void randomSample(SArray &x, std::vector const ¶meters) const; Index const &dim(std::vector const ¶meters) const; /** * Checks that alpha is a vector of length at least 2 */ bool checkParameterDim(std::vector const ¶meters) const; /** * Checks that each element of alpha is >= 0. * * Structural zeros are allowed in the Dirichlet distribution. * These are represented by the elements of alpha that are set to * zero. This is permitted only if alpha is fixed and there is at * least one non-zero element of alpha. */ bool checkParameterValue(std::vector const ¶meters) const; unsigned long df(std::vector const ¶meters) const; double lowerSupport(unsigned long i, std::vector const ¶meters) const; double upperSupport(unsigned long i, std::vector const ¶meters) const; }; #endif /* DDIRCH_H_ */