Ordered Logit

Ordinal logit is a model for modeling the association between covariates and the likelihood of observing a particular level of an ordered categorical outcome. Coefficients are reported in log-odds. These examples assume y_ord is a categorical variable taking at least 3 (mutually exclusive) ordered values.

Stata

Stata uses ologit for multinomial models.

ologit y_ord x z

R

The most commonly used ordinal logistic regression function in R is polr in the MASS package. y_ord here should be an ordered.

example_ologit <- 
  MASS::polr(y_ord ~ x + z,
             data=example_data,
             Hess=TRUE)

Note Hess=TRUE just tells the function to return the hessian matrix required to estimate standard errors.

summary() produces summary output with standard errors. You can also use broom::tidy() to get a data frame of coefficients, standard errors, and p-values–and confidence intervals when using conf.int=TRUE.

summary(example_ologit)
broom::tidy(example_ologit)

Generalized Ordinal Models

Generalized ordinal models relax the proportional odds assumption

Stata

gologit2 is used to fit these models in Stata. Variables with a proportional relationship to the outcome are listed in pl(). In the output, proportional variables will be fixed to the same value across all outcome thresholds, while the others will vary between thresholds.

gologit2 z, pl(x)

R

Generalized ordinal logit models may be run using ordinal::clm(). The argument nominal = specifies variables which are not proportional to the outcome. These are treated as nominal with regard to the outcome. In the output, nominal variable effects will be shown under Threshold Coefficients while proportional coefficiens will display under Coefficients.

clm(y_ord ~ x, nominal = ~ z, data = example_data)

Predictions

Stata

No one has requested this yet: Let me know if desired. Mostly redundant with other model types.

R

If you want the predicted outcome for each case, you can use predict().

predict(example_ologit)

If you want the probability of falling into each level of the outcome, you can use predict() with type = "probs".

predict(example_ologit, type = "probs")

Note this will produce a column of probabilities for each level of the outcome.

ggeffects can make predictions over a range of covariates.

library(ggeffects)
library(dplyr) # For the pipes
example_ologit %>%
  ggpredict(terms = c("x","z")) %>%
  plot()

Testing Parallel Odds Assumption

Brant tests are used to test the parallel odds assumption of the ordinal logit model.

Stata

You can test this assumption with a Brant test using the brant postestimation command in Stata. This function is in the spost package. The detail option provides more… detail.

ologit y_ord x z
brant, detail

R

You can conduct a Brant test using poTest() in the car package.

car::poTest(example_ologit)