# Endogenous ordered probit (Stata, R)

main equation

$y_1 = y_2 \beta + x_1 \gamma + u_i$

Instrumental equation

$y_2=x_1 \pi_1 + x_2 \pi_2$

I have a binary endogenous variable $y_2$ in my main estimation equation. My instrument $x_2$ is binary as well and recently my supervisor suggested a structural equation approach to me. In STATA I ran

gsem (y1 <- y2 x1 L@a, oprobit) (y2 <- x1 x2 L@a)


Where the latent variable $L$ is part of the parametrisation (cf. link before). The main issue is that this procedure is that I do not account for the binary nature of the instrument and the instrumented variable and consequently the log-likelihood function breaks as it is not continous.

Is there a way around this discontinous function problem? Or do I need to estimate the first part with probit/logit? If so is that then still IV-regression or something else?

You can fit this sort of model very easily with David Roodman's conditional mixed process estimator cmp.

Here's a toy example, where the "first stage" is a probit:

. set more off

. webuse fullauto, clear
(Automobile Models)

. capture ssc install cmp, replace

.
. /* CMP Way */
. qui cmp (repair: rep77 = foreign) (foreign: foreign=length mpg weight), ind($cmp_oprobit$cmp_probit) nolr qui tech(dfp)

. margins, dydx(foreign) ///
> predict(outcome(1) eq(repair) pr) ///
> predict(outcome(2) eq(repair) pr) ///
> predict(outcome(3) eq(repair) pr) ///
> predict(outcome(4) eq(repair) pr) ///
> predict(outcome(5) eq(repair) pr) post

Average marginal effects                        Number of obs     =         74
Model VCE    : OIM

dy/dx w.r.t. : foreign
1._predict   : Pr(rep77=1), predict(outcome(1) eq(repair) pr)
2._predict   : Pr(rep77=2), predict(outcome(2) eq(repair) pr)
3._predict   : Pr(rep77=3), predict(outcome(3) eq(repair) pr)
4._predict   : Pr(rep77=4), predict(outcome(4) eq(repair) pr)
5._predict   : Pr(rep77=5), predict(outcome(5) eq(repair) pr)

------------------------------------------------------------------------------
|            Delta-method
|      dy/dx   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
foreign      |
_predict |
1  |   -.044628   .0463312    -0.96   0.335    -.1354354    .0461794
2  |  -.0860181   .0842473    -1.02   0.307    -.2511398    .0791037
3  |  -.0382132   .0436574    -0.88   0.381    -.1237801    .0473536
4  |   .1148185    .112255     1.02   0.306    -.1051973    .3348343
5  |   .0540409   .0541395     1.00   0.318    -.0520706    .1601523
------------------------------------------------------------------------------


The repair record rating runs from Poor (1) to Excellent (5). We can see that foreign cars are less likely to have low repair ratings and more likely to have higher ones (though everything is insignificant). For example, Excellent is 5.4 percentage points more likely for foreign carts.

I think the gsem approach is also doable, but I think you will have to normalize the variance:

. /* GSEM Way */
. qui gsem (rep77 <- foreign UC, oprobit) (foreign <- length mpg weight UC@1, probit), var(UC@1) coefl

. margins, dydx(foreign) ///
> predict(outcome(1.rep77)) ///
> predict(outcome(2.rep77)) ///
> predict(outcome(3.rep77)) ///
> predict(outcome(4.rep77)) ///
> predict(outcome(5.rep77)) ///
> force post
(note: prediction is a function of possibly stochastic quantities other than e(b))
(note: prediction is a function of possibly stochastic quantities other than e(b))
(note: prediction is a function of possibly stochastic quantities other than e(b))
(note: prediction is a function of possibly stochastic quantities other than e(b))
(note: prediction is a function of possibly stochastic quantities other than e(b))

Average marginal effects                        Number of obs     =         74
Model VCE    : OIM

dy/dx w.r.t. : foreign
1._predict   : Marginal predicted mean (1.rep77), predict(outcome(1.rep77))
2._predict   : Marginal predicted mean (2.rep77), predict(outcome(2.rep77))
3._predict   : Marginal predicted mean (3.rep77), predict(outcome(3.rep77))
4._predict   : Marginal predicted mean (4.rep77), predict(outcome(4.rep77))
5._predict   : Marginal predicted mean (5.rep77), predict(outcome(5.rep77))

------------------------------------------------------------------------------
|            Delta-method
|      dy/dx   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
foreign      |
_predict |
1  |  -.0445979   .0462875    -0.96   0.335    -.1353198     .046124
2  |  -.0859752   .0842847    -1.02   0.308    -.2511702    .0792198
3  |  -.0382088   .0436134    -0.88   0.381    -.1236896    .0472719
4  |   .1147599   .1122424     1.02   0.307    -.1052312     .334751
5  |    .054022   .0541014     1.00   0.318    -.0520148    .1600589
------------------------------------------------------------------------------


As you can see, the estimates of the average marginal effects are very similar to cmp.

• I realised that in addition to endogeneity I have heteroskedasticity in two variables as well. As far as I understood the manual cmp offers no way to control for that. If I am right is there another command from which I can build in the heteroskedasticity as well as the endogeneity? – 5th Aug 4 '16 at 16:11
• @5th I am not sure what it means for there to be heteroskedasticity in variables. That is a property of error terms, so I assume that is what you meant. cmp has the robust option and gsem has the vce(robust) option. However, if you truly have heteroskedasticity, your parameter estimates will be inconsistent since you are normalizing your coefficients and cutpoints by the errors' standard deviations. No fix for that in this setting, I am afraid. – Dimitriy V. Masterov Aug 4 '16 at 17:10