### 7.2 Ordered Logit model

Mathematical representation

 $\begin{array}{cc}\begin{array}{rl}{y}_{i}^{\ast }& ={\mathbf{x}}_{i}^{\prime }\beta +{𝜀}_{i},\phantom{\rule{2em}{0ex}}\phantom{\rule{1em}{0ex}}{𝜀}_{i}\sim \mathrm{Logistic}\left(0,1\right)\\ {y}_{i}& =\left\{\begin{array}{ccc}1\hfill & \hfill \mathrm{if}\hfill & \hfill {\gamma }_{0}<{y}_{i}^{\ast }\le {\gamma }_{1}\hfill \\ 2\hfill & \hfill \mathrm{if}\hfill & \hfill {\gamma }_{1}<{y}_{i}^{\ast }\le {\gamma }_{2}\hfill \\ ⋮\hfill & \hfill ⋮\hfill & \hfill ⋮\hfill \\ M\hfill & \hfill \mathrm{if}\hfill & \hfill {\gamma }_{M-1}<{y}_{i}^{\ast }\le {\gamma }_{M}\hfill \\ \hfill \end{array}\right\\end{array}& \end{array}$ (7.2)
• the model is estimated using $N$ observations
• ${y}_{i}$ is the value of the dependent variable for observation $i$ and it can assume integer values in the range $1,\dots ,M$
• ${\mathbf{x}}_{i}$ is a $K\phantom{\rule{0.3em}{0ex}}×\phantom{\rule{0.3em}{0ex}}1$ vector that stores the values of the $K$ independent variables for observation $i$
• $\beta$ is a $K\phantom{\rule{0.3em}{0ex}}×\phantom{\rule{0.3em}{0ex}}1$ vector of parameters
• the $\gamma$s are parameters that represent the cutoﬀ points between categories and they satisfy the relation ${\gamma }_{0}<{\gamma }_{1}<\cdots <{\gamma }_{M}$, with ${\gamma }_{0}=-\infty$, ${\gamma }_{M}=\infty$ and, for identiﬁcation purposes, ${\gamma }_{1}=0$; there are $M\phantom{\rule{0.3em}{0ex}}-\phantom{\rule{0.3em}{0ex}}2$ $\gamma$s to be estimated
• following Albert & Chib (2001), to impose the inequality constraints on the $\gamma$s the problem is re-parameterized using the 1-1 mapping:
$\begin{array}{ccc}\hfill {\delta }_{2}\hfill & \hfill =\hfill & \hfill log\left({\gamma }_{2}-{\gamma }_{1}\right)\hfill \\ \hfill {\delta }_{3}\hfill & \hfill =\hfill & \hfill log\left({\gamma }_{3}-{\gamma }_{2}\right)\hfill \\ \hfill ⋮\hfill & \hfill =\hfill & \hfill ⋮\hfill \\ \hfill {\delta }_{M-1}\hfill & \hfill =\hfill & \hfill log\left({\gamma }_{M-1}-{\gamma }_{M-2}\right)\hfill \end{array}$

there are $M\phantom{\rule{0.3em}{0ex}}-\phantom{\rule{0.3em}{0ex}}2$ $\delta$s to be estimated and they are collected in an $\left(M\phantom{\rule{0.3em}{0ex}}-\phantom{\rule{0.3em}{0ex}}2\right)×1$ vector $\delta$

Priors

 Parameter Probability density function Default hyperparameters $\beta$ $p\left(\beta \right)=\frac{|{\mathbf{P}}_{\beta }{|}^{1∕2}}{{\left(2\pi \right)}^{K∕2}}exp\left\{-\frac{1}{2}{\left(\beta -{\mathbf{m}}_{\beta }\right)}^{\prime }{\mathbf{P}}_{\beta }\left(\beta -{\mathbf{m}}_{\beta }\right)\right\}$ ${\mathbf{m}}_{\beta }={\mathbf{0}}_{K}$, ${\mathbf{P}}_{\beta }=0.001\cdot {\mathbf{I}}_{K}$ $\delta$ $p\left(\delta \right)=\frac{|{\mathbf{P}}_{\delta }{|}^{1∕2}}{{\left(2\pi \right)}^{\frac{M-2}{2}}}exp\left\{-\frac{1}{2}{\left(\delta -{\mathbf{m}}_{\delta }\right)}^{\prime }{\mathbf{P}}_{\delta }\left(\delta -{\mathbf{m}}_{\delta }\right)\right\}$ ${\mathbf{m}}_{\delta }={\mathbf{0}}_{M\phantom{\rule{0.3em}{0ex}}-\phantom{\rule{0.3em}{0ex}}2}$, ${\mathbf{P}}_{\delta }=0.001\cdot {\mathbf{I}}_{M\phantom{\rule{0.3em}{0ex}}-\phantom{\rule{0.3em}{0ex}}2}$

Syntax

$\left[$<model name> = $\right]$ ologit( y ~ x1 x2  xK $\left[$, <options> $\right]$ );

where:

• y is the dependent variable name, as it appears in the dataset used for estimation
• x1 x2 $\dots$xK is a list of the $K$ independent variable names, as they appear in the dataset used for estimation; when a constant term is to be included in the model, this must be requested explicitly

 The dependent variable, y, in the dataset used for estimation must contain only consecutive integer values, with the numbering starting at 1. Observations with missing values in y are dropped during estimation, but if a non-integer numerical value is encountered or if the integer values are not consecutive (for example there are no observations for which ${y}_{i}=2$), then an error is produced.

The optional arguments for the ordered Logit model are:2

 Gibbs parameters "chains" number of chains to run in parallel (positive integer); the default value is 1 "burnin" number of burn-in draws per chain (positive integer); the default value is 10000 "draws" number of retained draws per chain (positive integer); the default value is 20000 "thin" value of the thinning parameter (positive integer); the default value is 1 "seed" value of the seed for the random-number generator (positive integer); the default value is 42 Hyperparameters "m_beta" mean vector of the prior for $\beta$ ($K\phantom{\rule{0.3em}{0ex}}×\phantom{\rule{0.3em}{0ex}}1$ vector); the default value is ${\mathbf{0}}_{K}$ "P_beta" precision matrix of the prior for $\beta$ ($K\phantom{\rule{0.3em}{0ex}}×\phantom{\rule{0.3em}{0ex}}K$ symmetric and positive-deﬁnite matrix); the default value is $0.001\phantom{\rule{0.3em}{0ex}}\cdot \phantom{\rule{0.3em}{0ex}}{\mathbf{I}}_{K}$ "m_delta" mean vector of the prior for $\delta$ ($\left(M\phantom{\rule{0.3em}{0ex}}-\phantom{\rule{0.3em}{0ex}}2\right)\phantom{\rule{0.3em}{0ex}}×\phantom{\rule{0.3em}{0ex}}1$ vector); the default value is ${\mathbf{0}}_{M-2}$ "P_delta" precision matrix of the prior for $\delta$ ($\left(M\phantom{\rule{0.3em}{0ex}}-\phantom{\rule{0.3em}{0ex}}2\right)\phantom{\rule{0.3em}{0ex}}×\phantom{\rule{0.3em}{0ex}}\left(M\phantom{\rule{0.3em}{0ex}}-\phantom{\rule{0.3em}{0ex}}2\right)$ symmetric and positive-deﬁnite matrix); the default value is $0.001\phantom{\rule{0.3em}{0ex}}\cdot \phantom{\rule{0.3em}{0ex}}{\mathbf{I}}_{M-2}$ Dataset and log-marginal likelihood "dataset" the id value of the dataset that will be used for estimation; the default value is the ﬁrst dataset in memory (in alphabetical order) "logML_CJ" boolean indicating whether the Chib (1995)/Chib & Jeliazkov (2001) approximation to the log-marginal likelihood should be calculated (true$|$false); the default value is false

Reported Parameters

 $\beta$ variable_name vector of parameters associated with the independent variables $\gamma$ gamma_m vector of cutoﬀ points ($M\phantom{\rule{0.3em}{0ex}}-\phantom{\rule{0.3em}{0ex}}2$)

Stored values and post-estimation analysis
If a left-hand-side id value is provided when an ordered Logit model is created, then the following results are saved in the model item and are accessible via the ‘.’ operator:

 Samples a matrix containing the draws from the posterior of $\beta$ and $\gamma$ x1,$\dots$,xK vectors containing the draws from the posterior of the parameters associated with variables x1,$\dots$,xK (the names of these vectors are the names of the variables that were included in the right-hand side of the model) gamma_2,$\dots$,  gamma_{M-1} vectors containing the draws from the posterior of the cutoﬀ parameters, for $m=2,\dots ,M\phantom{\rule{0.3em}{0ex}}-\phantom{\rule{0.3em}{0ex}}1$ logML the Lewis & Raftery (1997) approximation of the log-marginal likelihood logML_CJ the Chib (1995)/Chib & Jeliazkov (2001) approximation to the log-marginal likelihood; this is available only if the model was estimated with the "logML_CJ"=true option nchains the number of chains that were used to estimate the model nburnin the number of burn-in draws per chain that were used when estimating the model ndraws the total number of retained draws from the posterior ($=$chains $\cdot$ draws) nthin value of the thinning parameter that was used when estimating the model nseed value of the seed for the random-number generator that was used when estimating the model

Additionally, the following functions are available for post-estimation analysis (see section B.14):

• diagnostics()
• test()
• pmp()
• mfx()

The ordered Logit model uses the mfx() function to calculate and report the marginal eﬀects of the independent variables on the probability of the response variable being in each one of the $M$ categories: $Prob\left(y=m|\mathbf{x}\right)$, for $m=1,2,\dots ,M$. Because the model calculates only one type of marginal eﬀects, the only valid value for the "type" option is 1. The generic syntax for a statement involving the mfx() function after estimation of an ordered Logit model is:

mfx( $\left[$"type"=1$\right]$ $\left[$, "point"=<point of calculation>$\right]$ $\left[$, "model"=<model name>$\right]$ );

See the general documentation of the mfx() function (section B.14) for details on the other optional arguments.

Examples

Example 1

myData = import("$BayESHOME/Datasets/dataset10.csv"); myData.constant = ones(rows(myData), 1); ologit( y ~ constant x1 x2 x3 x4 ); Example 2 myData = import("$BayESHOME/Datasets/dataset10.csv");
myData.constant = ones(rows(myData), 1);

myModel = ologit( y ~ constant x1 x2 x3 x4,
"m_beta"=zeros(5,1), "P_beta" = 0.01*eye(5,5),
"m_delta"=zeros(3,1), "P_delta" = 0.1*eye(3,3),
"burnin"=10000, "draws"=40000, "thin"=4, "chains"=2,
"logML_CJ" = true, "dataset"=myData);

diagnostics("model"=myModel);

mfx("point"="mean","model"=myModel);
mfx("point"="median","model"=myModel);

2Optional arguments are always given in option-value pairs (eg. "chains"=3).