## 13.8 Ordered logistic distribution

### 13.8.1 Probability mass function

If $$K \in \mathbb{N}$$ with $$K > 2$$, $$c \in \mathbb{R}^{K-1}$$ such that $$c_k < c_{k+1}$$ for $$k \in \{1,\ldots,K-2\}$$, and $$\eta \in \mathbb{R}$$, then for $$k \in \{1,\ldots,K\}$$, $\text{OrderedLogistic}(k~|~\eta,c) = \left\{ \begin{array}{ll} 1 - \text{logit}^{-1}(\eta - c_1) & \text{if } k = 1, \\[4pt] \text{logit}^{-1}(\eta - c_{k-1}) - \text{logit}^{-1}(\eta - c_{k}) & \text{if } 1 < k < K, \text{and} \\[4pt] \text{logit}^{-1}(\eta - c_{K-1}) - 0 & \text{if } k = K. \end{array} \right.$ The $$k=K$$ case is written with the redundant subtraction of zero to illustrate the parallelism of the cases; the $$k=1$$ and $$k=K$$ edge cases can be subsumed into the general definition by setting $$c_0 = -\infty$$ and $$c_K = +\infty$$ with $$\text{logit}^{-1}(-\infty) = 0$$ and $$\text{logit}^{-1}(\infty) = 1$$.

### 13.8.2 Sampling statement

k ~ ordered_logistic(eta, c)

Increment target log probability density with ordered_logistic_lupmf(k | eta, c).

### 13.8.3 Stan functions

real ordered_logistic_lpmf(ints k | vector eta, vectors c)
The log ordered logistic probability mass of k given linear predictors eta, and cutpoints c.

real ordered_logistic_lupmf(ints k | vector eta, vectors c)
The log ordered logistic probability mass of k given linear predictors eta, and cutpoints c dropping constant additive terms.

int ordered_logistic_rng(real eta, vector c)
Generate an ordered logistic variate with linear predictor eta and cutpoints c; may only be used in transformed data and generated quantities blocks