Hello everybody,
I am trying to run an instrumental variables regression where my endogenous variable is a categorical variable (which I created two dummy variables to account for) and with a need for interactions terms.
The set up is as follows:
- Primary dependent variable: Y (continuous)
- Exogenous independent variables: X
- Endogenous Variable: D (categorical with 3 possible values, but created 2 dummy variables D1 and D2)
- Instrument: Z
- Exogenous control variable: C
- Interaction terms: D*X
I have tried running it with the following code:
ivreg2 Y C X (D1 D2 D1#C.X D2#C.X = Z Z#C.X), robust
However, I am just not sure whether this is the right way to go given that I have two binary endogenous variables with interaction.
I've also tried running it the following way, but it keeps giving me the error message: "D1_hat: factor variables may not contain noninteger values"
probit D1 X C Z, vce(robust)
predict D1_hat
probit D2 X C Z, vce(robust)
predict D2_hat
ivreg2 Y C X (D1 D2 D1#C.X D2#C.X = D1_hat D2_hat D1_hat#C.X D2_hat#C.X)
I have read other similar postings such as https://www.statalist.org/forums/for...enous-variable but wasn't able to figure it out.
How should I approach this question using stata?
Thank you so much in advance for any advice!
I am trying to run an instrumental variables regression where my endogenous variable is a categorical variable (which I created two dummy variables to account for) and with a need for interactions terms.
The set up is as follows:
- Primary dependent variable: Y (continuous)
- Exogenous independent variables: X
- Endogenous Variable: D (categorical with 3 possible values, but created 2 dummy variables D1 and D2)
- Instrument: Z
- Exogenous control variable: C
- Interaction terms: D*X
I have tried running it with the following code:
ivreg2 Y C X (D1 D2 D1#C.X D2#C.X = Z Z#C.X), robust
However, I am just not sure whether this is the right way to go given that I have two binary endogenous variables with interaction.
I've also tried running it the following way, but it keeps giving me the error message: "D1_hat: factor variables may not contain noninteger values"
probit D1 X C Z, vce(robust)
predict D1_hat
probit D2 X C Z, vce(robust)
predict D2_hat
ivreg2 Y C X (D1 D2 D1#C.X D2#C.X = D1_hat D2_hat D1_hat#C.X D2_hat#C.X)
I have read other similar postings such as https://www.statalist.org/forums/for...enous-variable but wasn't able to figure it out.
How should I approach this question using stata?
Thank you so much in advance for any advice!
Comment