1 #ifndef __STAN__PROB__DISTRIBUTIONS__UNIVARIATE__DISCRETE__ORDERED_LOGISTIC_HPP__
2 #define __STAN__PROB__DISTRIBUTIONS__UNIVARIATE__DISCRETE__ORDERED_LOGISTIC_HPP__
4 #include <boost/random/uniform_01.hpp>
5 #include <boost/random/variate_generator.hpp>
58 template <
bool propto,
62 typename boost::math::tools::promote_args<T_lambda,T_cut>::type
64 const T_lambda& lambda,
65 const Eigen::Matrix<T_cut,Eigen::Dynamic,1>& c,
74 static const char*
function =
"stan::prob::ordered_logistic(%1%)";
86 typename boost::math::tools::promote_args<T_lambda,T_cut>::type lp(0.0);
93 "Location parameter", &lp, Policy()))
97 "Size of cut points parameter",
102 for (
int i = 1; i < c.size(); ++i) {
104 "Cut points parameter",
110 "Cut points parameter",
115 "Cut points parameter",
136 template <
bool propto,
139 typename boost::math::tools::promote_args<T_lambda,T_cut>::type
141 const T_lambda& lambda,
142 const Eigen::Matrix<T_cut,Eigen::Dynamic,1>& c) {
147 template <
typename T_lambda,
150 typename boost::math::tools::promote_args<T_lambda,T_cut>::type
152 const T_lambda& lambda,
153 const Eigen::Matrix<T_cut,Eigen::Dynamic,1>& c,
155 return ordered_logistic_log<false>(y,lambda,c,Policy());
159 template <
typename T_lambda,
161 typename boost::math::tools::promote_args<T_lambda,T_cut>::type
163 const T_lambda& lambda,
164 const Eigen::Matrix<T_cut,Eigen::Dynamic,1>& c) {
171 const Eigen::Matrix<double,Eigen::Dynamic,1>& c,
173 using boost::variate_generator;
175 Eigen::VectorXd cut(c.rows());
177 for(
int j = 1; j < c.rows() - 1; j++)
179 cut(c.rows() - 1) =
inv_logit(eta - c(c.rows() - 2));