Hi everyone,
I have panel data with a list of 60 endogeneous variables that I would like to instrument with 60 corresponding instruments (I want to run 60 separate regressions). Please find below a simplified example of what I would like to do:
xtivreg2 depvar control1 control2 (endogeneous1= instrument_endogeneous1 variablex), fe endog( endogeneous1)
xtivreg2 depvar control1 control2 (endogeneous2= instrument_endogeneous2 variablex ), fe endog( endogeneous2)
xtivreg2 depvar control1 control2 (endogeneous3= instrument_endogeneous3 variablex ), fe endog( endogeneous3)
and so on for the remaining ones.
I tried creating loops for endogenous variables and instruments. Please find below a simplification:
local ivar1 endogeneous1
local ivar2 endogeneous2
local dvar1 instrument_endogeneous1
local dvar2 instrument_endogeneous2
forv i=1/60 {
forv d=1/60 {
xtivreg2 depvar control1 control2 (`ivar`i''=`dvar`d'' variablex), fe endog(`ivar`i'') first savefirst
}
}
The problem here is that it runs regressions for each endogenous variable instrumented once by each instrument in the list. This is not what I intend to do. I want to instrument each variable with its corresponding instrument (not the whole list of instruments).
I would be grateful if you could advise on this. I am sorry in advance if this has been asked before and I couldn't locate the answer.
Many thanks in advance.
Jala Youssef
I have panel data with a list of 60 endogeneous variables that I would like to instrument with 60 corresponding instruments (I want to run 60 separate regressions). Please find below a simplified example of what I would like to do:
xtivreg2 depvar control1 control2 (endogeneous1= instrument_endogeneous1 variablex), fe endog( endogeneous1)
xtivreg2 depvar control1 control2 (endogeneous2= instrument_endogeneous2 variablex ), fe endog( endogeneous2)
xtivreg2 depvar control1 control2 (endogeneous3= instrument_endogeneous3 variablex ), fe endog( endogeneous3)
and so on for the remaining ones.
I tried creating loops for endogenous variables and instruments. Please find below a simplification:
local ivar1 endogeneous1
local ivar2 endogeneous2
local dvar1 instrument_endogeneous1
local dvar2 instrument_endogeneous2
forv i=1/60 {
forv d=1/60 {
xtivreg2 depvar control1 control2 (`ivar`i''=`dvar`d'' variablex), fe endog(`ivar`i'') first savefirst
}
}
The problem here is that it runs regressions for each endogenous variable instrumented once by each instrument in the list. This is not what I intend to do. I want to instrument each variable with its corresponding instrument (not the whole list of instruments).
I would be grateful if you could advise on this. I am sorry in advance if this has been asked before and I couldn't locate the answer.
Many thanks in advance.
Jala Youssef
Comment