Announcement

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

  • Running Bootstrap program to Implement Control Function Approach

    Hello,

    I am trying to implement Wooldridge's control function approach and bootstrap both the first and second stage's using a program and I could use some help regarding the code. Thus far i have:

    capture program drop boot
    program boot, rclass
    regress endogvar instrument controls
    predict resid_cf, resid
    regress dv controls endogvar endogvar*x1 endogvar*x2 resid_cf
    end
    bootstrap, reps(100) : boot

    However, it returns:

    Bootstrap replications (100)
    ----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 50
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 100
    insufficient observations to compute bootstrap standard errors
    no results will be saved


    Could someone please advise?

    Thank you in advance!






  • #2
    -regress dv controls endogvar endogvar*x1 endogvar*x2 resid_cf- is a syntax error, so your second regression never runs.

    For the correct syntax for products of variables, read -help fvvarlist-. (Be sure to pay attention to the difference in handling of discrete and continuous variables.)

    Comment


    • #3
      My apologies, I put the * as illustration, to be more precise:

      capture program drop boot
      program boot, rclass
      regress endogvar instrument controls
      predict resid_cf, resid
      regress dv controls c.endogvar##c.(x1 x2) resid_cf
      end
      bootstrap, reps(100) : boot

      Comment


      • #4
        I would change the program as follows:
        Code:
                . webuse hsng2, clear
                . ivregress 2sls rent pcturban (hsngval = faminc i.region), small
                program boot_cf, eclass
                capture drop resid
                reg hsngval  faminc i.region pcturban
                predict resid, res
                reg rent pcturban  hsngval resid
                end
                bootstrap:boot_cf
        HTH

        Comment


        • #5
          It isn't possible to to troubleshoot an illustration of code: the actual code is needed. It is not immediately apparent what is going wrong with what you show in #3, but I can't help wondering whether "instrument" and "controls" may also be illustrations of something that might contain errors.

          I suggest you re-run your -bootstrap- adding the -noisily- option. That way you will get the actual output of program boot at each iteration. The error messages will likely tell you what is wrong. If not, then post back showing the actual code (including the -noisily- option and output you get from it.

          Added: Crossed with #4. Fernando Rios is right: you can't -predict, resid- repeatedly, as the variable already exists after the first run of -myboot-. Sorry I didn't see that.
          Last edited by Clyde Schechter; 28 May 2019, 14:07.

          Comment


          • #6
            Originally posted by FernandoRios View Post
            I would change the program as follows:
            Code:
            . webuse hsng2, clear
            . ivregress 2sls rent pcturban (hsngval = faminc i.region), small
            program boot_cf, eclass
            capture drop resid
            reg hsngval faminc i.region pcturban
            predict resid, res
            reg rent pcturban hsngval resid
            end
            bootstrap:boot_cf
            HTH
            Why did you not include i.region in the second stage?

            Comment


            • #7
              Because both Region and Faminc are being used as Instruments here. Thus, they shouldn't be included in the second stage

              Comment


              • #8
                ah okay, thanks

                Comment

                Working...
                X