I am writing a do file where I run 3 regressions: (i) the OLS, (ii) the IV first stage, (iii) the IV 2SLS.
I have multiple variables to measure the endogenous explanatory variable; each of which have their own instrument.
Is there a way I can loop the 3 regressions over each couple of endogenous variable-IV?
I have 4 couples:
1. Endogenous variable is X1, their instrument is IV1
2. Endogenous variable is X2, their instrument is IV2
3. Endogenous variable is X3, their instrument is IV3
4. Endogenous variable is X4, their instrument is IV4
My regressions are:
Code:
** OLS reg `yvar' X1, robust ** IV First stage reg X1 IV1, robust ** 2SLS ivreg2 `yvar' (X1 = IV1), robust
Thanks,
Comment