# Control Function (CF) / Two Stage Residual Inclusion (2SRI) - with an ordinal EEV - in Stata

I am mostly an R user. But since I have not found a way yet to reproduce generalised residuals in R (link), I am using Stata for my estimation of a CF/2SRI (references below). The jist is as follows: I run an oprobit on my ordinal EEV, I get the generalised residual (apparently that is just one residual per observation, instead of on per level?). I add the residual with the EEV in the second stage, which I estimate with fracreg. And finally I calculate the AME/APE.

Am I correctly implementing this?

ordinal_var is an ordinal variable with four levels

depvar is the dependent variable with values ranging between (and including) 0 and 1.

// ordinal probit regression
oprobit ordinal_var instrumentalvar1 instrumentalvar2

// to able to re-run the code
drop residual

// Generalised Residual (Vella, 1993)
predict residual, score

// Because dep var is ration between and including 0 - 1
fracreg logit depvar i.ordinal_var residual, vce(robust)

// Because I am interested in the marginal effects.
margins, dy/dx(i.ordinal_var)


Outcome:

----------------------------------------------------------------------------------
|            Delta-method
|      dy/dx   Std. Err.      z    P>|z|     [95% Conf. Interval]
-----------------+----------------------------------------------------------------
ordinal_var      |
1  |  -.0707792   .0093849    -7.54   0.000    -.0891732   -.0523851
2  |  -.1159215   .0162036    -7.15   0.000    -.1476799   -.0841631
3  |   -.175346   .0289114    -6.06   0.000    -.2320114   -.1186807
----------------------------------------------------------------------------------


# References

Chiburis, R., & Lokshin, M. (2007). Maximum Likelihood and Two-Step Estimation of an Ordered-Probit Selection Model. The Stata Journal, 7(2), 167–182. https://doi.org/10.1177/1536867X0700700202

Terza J. V, Basu A., Rathouz, P.J. (2008) Two-stage residual inclusion estimation: addressing endogeneity in health econometric modeling. Journal of health economics 27 (3), 531-543, 2008

Vella, F. (1993). A Simple Estimator for Simultaneous Models with Censored Endogenous Regressors. International Economic Review, 34(2), 441-457. doi:10.2307/2526924

Wooldridge,JM. (2014) Quasi-maximum likelihood estimation and testing for nonlinear models with endogenous explanatory variables. Journal of Econometrics Volume 182, Issue 1, September 2014, Pages 226-234