Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • IVREG2: How to store the instrumented shock, i.e., 1st-stage fitted value.

    Hi Statalists,

    I'm using ivreg2 to run a series of h regressions (h=16) with the IV approach.

    Code:
    Code:
    forvalues i = 1/16 { 
     eststo:  ivreg2 var`i'y (var`i'g = `instrument1' `instrument2') $`controls', robust bw(auto) }
    Where I instrument var`i'g with the two instruments (1,2). The question: I would like to include the instrumented shock (i.e., the fitted value of var`i'g of the 1st stage) in the control set of the 2nd stage, how can I achieve that? Thanks.

  • #2
    The second stage can be seen as a regression of the dependent variable on the exogenous control variables and the fitted values from the first stage. Thus, those fitted values are already included in the second stage.

    Do you maybe want to include the first-stage residuals in the second stage? This is essentially what is done by the Wu-Hausman test, which is implemented in the estat endogenous postestimation command. If you want to do this manually, you need to replicate this procedure step by step.
    https://www.kripfganz.de/stata/

    Comment


    • #3
      Thank you Sebastian. I apologize if I didn't explain myself correctly. I would like to include some lags of the fitted values from the 1st-stage as additional controls in the 2nd-stage.

      Comment


      • #4
        You would need to do this manually by running the first-stage regression separately and obtaining predicted values. However, note that this procedure leads to a "generated regressors" problem, which at least invalidates the conventional variance estimates.

        What do you aim to achieve with this approach? If lagged regressors/instruments can have a direct effect on the outcome variable, it might be worth including them in the model from the outset (in both the first and second stage). Moreover, if lagged instruments can have a direct effect on the outcome, it might be difficult to justify the exclusion restriction that contemporaneous instruments do not have such a direct effect.
        https://www.kripfganz.de/stata/

        Comment


        • #5
          Thanks for your reply Sebastian. In my framework the exclusion restriction is taken as granted (by construction of the instruments). Hence, the instruments do not have a direct effect on the outcome variable, but only indirect through the variable I'm instrumenting.

          The first stage goes as follows:
          Code:
          ivreg2 var`i'g `instrument1' `instrument2' lag(1/4).`instrument1' lag(1/4).`instrument2' lag(1/4).y
          In the second stage I do not want to include the instruments as controls but rather the instrumented shock (it is purged of all the controls used in the first stage).

          For the "generated regressors problem" I should bootstrap both stages of the procedure, right?

          Comment


          • #6
            Originally posted by Sebastian Kripfganz View Post
            You would need to do this manually by running the first-stage regression separately and obtaining predicted values. However, note that this procedure leads to a "generated regressors" problem, which at least invalidates the conventional variance estimates.

            What do you aim to achieve with this approach? If lagged regressors/instruments can have a direct effect on the outcome variable, it might be worth including them in the model from the outset (in both the first and second stage). Moreover, if lagged instruments can have a direct effect on the outcome, it might be difficult to justify the exclusion restriction that contemporaneous instruments do not have such a direct effect.
            To solve the "generated regressors problem" I need to bootstrap both the 1st and 2nd stage, how can I do that?

            This is what I currently have:
            Code:
             forvalues i = 1/16 {
            ivreg2 f`i'g `instrument1' `instrument2' L(1/4).`instrument1' L(1/4).`instrument2' L(1/4).`controls', robust bw(auto)
                predict double shock`i'
            
            ivreg2 f`i'var`dep' shock`i' L(1/4).shock`i', robust bw(auto)
            }

            Comment

            Working...
            X