Announcement

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

  • 2SLS IV regression, partial out and predict command

    Hello everyone,

    I have a brief question regarding the partial out function in the ivreg2 command. In particular, I want to obtain the predictive values from my estimated instrumental variable (IV) model. However, as I read in the help file of the ivreg2 command, it is not possible that the post-estimation command “predict” can be used straightforwardly to generate predictive values, if the partial option is used (see also the paper by Baum et al. 2007). Therefore, I would like to know how I can obtain the predictive values while using the partial out command in an IV regression?

    If I understand it correctly, the partialling out option doesn’t change the coefficients of the regressors but adjusts the model F and the R-Square accordingly. Is it therefore legitimate to estimate the model without the partial out command and to generate the predictive values? But in the description of the results I would report the model F and R-Square, which I obtained from the model estimated with the partial out command.
    Would the outlined approach be possible or is there another way to obtain the predictive values in that case?

    Thank you in advance.

    Best
    Michael

    References:
    Baum, C. F., Schaffer, M. E., & Stillman, S. (2007). Enhanced routines for instrumental variables/GMM estimation and testing. Stata Journal, 7(4), 465-506.

  • #2
    You didn't get a quick answer. You'll increase your chances of a useful answer by following the FAQ on asking questions - provide Stata code in code delimiters, readable Stata output, and sample data using dataex.

    ivreg2 is user written. Can you get what you need with ivregress? Answers on Statalist depend on one of the few active commentators knowing the routine and option you want to use. I've never worked with partialling on ivreg2 so I can't help you. The final recourse is to go to the routine's author.

    Comment


    • #3
      Michael,

      You need to do the partialling out first, by hand, and the do your IV estimation as usual. Then your post-estimation predicted values will be predictions of the post-partialling-out dependent variable, which I guess is what you want.

      If you want predicted values of the original dep var before the partialling-out transformation, then just estimate as usual, without partialling out.

      --Mark

      Comment


      • #4
        Hello everyone,

        thanks for the feedback.
        @Mark: Yes, I'm interessted in the first scenario you mentioned. The challenge is that without the partial out command I get an error message that I have a singleton dummy variable and that the partial out option might address the problem. Which is of course true :-)
        In particular, the IV model I estimate looks something like this:
        Code:
        ivreg2 lognd5 (i.treatmentreceived=i.treatmentassigned) i.sex i.bs age extra membership gruppen strategicnetworkind2 i.freearea weeklyhours i.otincome i.freq i.treatmentreceived#c.strategicnetworkind2, robust partial(i.freearea) ffirst
        Right know, I'm having trouble to do the partial out by hand in my case. Do you have reference how to partial it out by hand in Stata or any other hint for me?

        Another question to better understand the statistics. Would there be any difference in the predicted values, if I do the partial out by hand or simply include the variable I intend to partial out (i.freearea in our case) as a control variable into the model and then estimate the predicted values? Of course, the model statistics are wrong in the latter approach. Or in other words, from a statistical point-of-view, how "wrong" would it be to estimate the predicted values using i.freearea as a control variable in the model, but reporting the model statistics when i.freearea was included in the partial out function? As the coefficients for the remaing regressor are the same regardless whether I include the variable as a control or in the partial out command.

        Thank you very much.

        Best
        Michael

        Comment


        • #5
          A few suggestions:

          Don't use factor variables for the endog vars and IVs. Create them by hand.

          Partialling out is very easy. For the OLS reg y x z case: (1) reg y z and get the resids ey. (2) reg x z and get the resids ex. (3) reg ey ez, nocons. Voila! For the IV case, add a step where you regress the IVs on z and collect the resids.

          The predicted values yhat, xhat, etc. probably aren't interesting for you. They will of course be different in the partialled-out vs original regressions. What is the same is the residuals. In other words, after ivreg2, you get the same residuals with "predict ehat, resid" whether or not you use the partial option.

          Partialling-out is an application of the Frisch-Waugh-Lovell (FWL) theorem. If you google around I am sure you can find expositions of it with Stata examples. Dave Giles' blog had a discussion of FWL for IV estimation several years ago (but no Stata examples).

          M

          Comment


          • #6
            Hello Mark,

            thanks for the valuable feedback. I will take a closer look at the points you mentioned.
            Again, to better understand it: Why is it better to create the factor variables by hand, instead of using the i. prefix?

            Thank you and best
            Michael

            Comment


            • #7
              It's more of a sensible precaution than an absolute requirement. Factor variables are created by Stata "on the fly", by default a variable for the omitted base variable is also created, if you have collinearities things get messy.... If you create these variables in advance then you avoid all this. Plus factor variables aren't really intended to be used as endogenous/outcome variables anyway (various official Stata commands won't accept them when used as such).

              Comment


              • #8
                Ok, thanks for clarifiying.

                Comment

                Working...
                X