Stan Math Library
5.0.0
Automatic Differentiation
|
|
inline |
Returns the (natural) log probability of the specified array of integers given the vector of continuous locations and specified cutpoints in an ordered logistic model.
Typically the continuous lambda will be the dot product of a vector of regression coefficients and a vector of predictors for the outcome
\[ \frac{\partial }{\partial \lambda} = \begin{cases}\\ -\mathrm{logit}^{-1}(\lambda - c_1) & \mbox{if } k = 1,\\ -(((1-e^{c_{k-1}-c_{k-2}})^{-1} - \mathrm{logit}^{-1}(c_{k-2}-\lambda)) + ((1-e^{c_{k-2}-c_{k-1}})^{-1} - \mathrm{logit}^{-1}(c_{k-1}-\lambda))) & \mathrm{if } 1 < k < K, \mathrm{and}\\ \mathrm{logit}^{-1}(c_{K-2}-\lambda) & \mathrm{if } k = K. \end{cases} \]
\[ \frac{\partial }{\partial \lambda} = \begin{cases} -\mathrm{logit}^{-1}(\lambda - c_1) & \text{if } k = 1,\\ -(((1-e^{c_{k-1}-c_{k-2}})^{-1} - \mathrm{logit}^{-1}(c_{k-2}-\lambda)) + ((1-e^{c_{k-2}-c_{k-1}})^{-1} - \mathrm{logit}^{-1}(c_{k-1}-\lambda))) & \text{if } 1 < k < K, \text{ and}\\ \mathrm{logit}^{-1}(c_{K-2}-\lambda) & \text{if } k = K. \end{cases} \]
propto | True if calculating up to a proportion. |
T_y | Y variable type (integer or array of integers). |
T_loc | lambda type. |
T_cut | Cut-point type. |
y | Array of integers |
lambda | Vector of continuous lambda variables. |
cuts | Positive increasing vector of cutpoints. |
std::domain_error | If the outcome is not between 1 and the number of cutpoints plus 2; if the cutpoint vector is empty; if the cutpoint vector contains a non-positive, non-finite value; or if the cutpoint vector is not sorted in ascending order. |
std::invalid_argument | If y and lambda are different lengths. |
Definition at line 70 of file ordered_logistic_lpmf.hpp.