1 #ifndef STAN_MATH_PRIM_MAT_PROB_ORDERED_LOGISTIC_RNG_HPP
2 #define STAN_MATH_PRIM_MAT_PROB_ORDERED_LOGISTIC_RNG_HPP
4 #include <boost/random/uniform_01.hpp>
5 #include <boost/random/variate_generator.hpp>
25 const Eigen::Matrix<double, Eigen::Dynamic, 1>& c,
27 using boost::variate_generator;
30 static const char*
function(
"stan::math::ordered_logistic");
41 check_greater(
function,
"Size of cut points parameter", c.size(), 0);
42 for (
int i = 1; i < c.size(); ++i) {
43 check_greater(
function,
"Cut points parameter", c(i), c(i - 1));
45 check_finite(
function,
"Cut points parameter", c(c.size()-1));
48 Eigen::VectorXd cut(c.rows()+1);
50 for (
int j = 1; j < c.rows(); j++)
52 cut(c.rows()) =
inv_logit(eta - c(c.rows() - 1));
bool check_less(const char *function, const char *name, const T_y &y, const T_high &high)
Return true if y is strictly less than high.
fvar< T > inv_logit(const fvar< T > &x)
bool check_bounded(const char *function, const char *name, const T_y &y, const T_low &low, const T_high &high)
Return true if the value is between the low and high values, inclusively.
int categorical_rng(const Eigen::Matrix< double, Eigen::Dynamic, 1 > &theta, RNG &rng)
bool check_positive(const char *function, const char *name, const T_y &y)
Return true if y is positive.
bool check_less_or_equal(const char *function, const char *name, const T_y &y, const T_high &high)
Return true if y is less or equal to high.
bool check_finite(const char *function, const char *name, const T_y &y)
Return true if y is finite.
int ordered_logistic_rng(const double eta, const Eigen::Matrix< double, Eigen::Dynamic, 1 > &c, RNG &rng)
bool check_nonnegative(const char *function, const char *name, const T_y &y)
Return true if y is non-negative.
bool check_greater(const char *function, const char *name, const T_y &y, const T_low &low)
Return true if y is strictly greater than low.