oprobit
The same ordered-category model, with the bell-curve shape.
What we have
- cut points, as in
ologit
Coming later
predictandmarginsafterwards
How you write it
oprobit depvar indepvars [if]
Square brackets mean optional. A vertical bar means choose one.
What it does
oprobit is to ologit what probit is to logit: a different curve for the same job, almost always the same conclusions.
Try it
Every example below was run after sysuse vira.sample03, clear.
. oprobit rating age level
Ordered probit regression Number of obs = 4,000
LR chi2 = 41.72
Prob > chi2 = 0.0000
Log likelihood = -5319.2504
------------------------------------------------------------------------------
rating | Coefficient Std. err. z P>|z| [95% conf. interval]
-------------+----------------------------------------------------------------
age | -.0025796 .00214196 -1.20 0.228 -.0067778 .00161854
level | .1109122 .01764647 6.29 0.000 .07632577 .1454987
-------------+----------------------------------------------------------------
/cut1 | -1.694323
/cut2 | -.5311521
/cut3 | .5615532
/cut4 | 1.720323
------------------------------------------------------------------------------
The same thing in pandas and in R
pandas
import pandas as pd
import patsy
from statsmodels.miscmodels.ordinal_model import OrderedModel
_, X = patsy.dmatrices('rating ~ age + level', df, return_type="dataframe")
X = X.drop(columns=["Intercept"], errors="ignore")
y = pd.Categorical(df['rating'], categories=sorted(df['rating'].dropna().unique()), ordered=True)
model = OrderedModel(y, X, distr="probit").fit(method="bfgs", disp=False)
R
library(MASS)
model <- polr(factor(rating) ~ age + level, data = df, Hess = TRUE,
method = "probit")
summary(model)
# This R has NOT been run against a real R yet: read it as documentation.