Announcement

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

  • Insufficient observations to compute bootstrap standard errors

    I am trying to perform mi imputation with bootstrap using following syntax:
    1.mi set wide
    2. program define myboot, rclass
    3.mi register imputed varlist....
    4.mi impute mvn varlist....., add( 187)
    5. egen country1=group(country)
    6. mi xtset country1 year,yearly
    7. mi estimate: xtreg varlist.....
    8. return scalar b_a = el(e(b_mi),1,1)
    9. return scalar b_b = el(e(b_mi),1,2)
    10. return scalar b_c = el(e(b_mi),1,3)
    11. return scalar b_d = el(e(b_mi),1,4)
    12. return scalar b_e = el(e(b_mi),1,5)
    13. return scalar b_f = el(e(b_mi),1,6)
    14. return scalar b_g = el(e(b_mi),1,7)
    15. end
    16. set seed 23543
    17. bootstrap b_va1=r(b_a) b_var2=r(b_b) b_var3=r(b_c) b_var4=r(b_d) b_var5=r(b_e) b_var6=r(b_f) intercept=r(b_g), reps(2000) : myboot
    I am facing following problem after execution:
    Bootstrap replications (2000)
    ----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5
    xxxxxxxxxxxxxxxxxxxx
    insufficient observations to compute bootstrap standard errors
    no results will be saved
    r(2000);
    Please guide

  • #2
    Well, while there may be other problems, the first thing that strikes me is that bootstrap resampling, with its default options as used in the -bootstrap- command, will not respect the panel structure of the data. So it is likely that when you get to -mi xtset country1 year- Stata finds that at least some country1's have multiple observations for some years, and that will terminate the execution of program myboot with no results generated.

    So at the very least you will need to revise your program to use -simulate- instead of -bootstrap- and include in program myboot a -bsample- command with appropriate options to assure that the resampling resamples entire panels picked at random, not just random observations.

    All of that said, I have a very hard time imagining why you want to do this in the first place. I can't think of any purpose it might serve.

    Comment


    • #3
      My data sample consists of 150 observations with missing values which is highly skewed and may not be able to predict the accurate standard errors as well as confidence interval. Therefore i tried to compute mi imputation with bootstrap.

      Comment


      • #4
        Thanks Clyde for your assistance. Reps(200) is just for illustrative purpose. Now i stuck at this point please guide further
        command: myboot bsample
        b_male: r(b_a)
        b_female: r(b_b)
        b_age0_17: r(b_c)
        b_age18_24: r(b_d)
        b_gdp_growth: r(b_e)
        b_gdp_percap: r(b_f)
        b_state: r(b_g)
        b_market: r(b_h)
        intercept: r(b_i)

        Simulations (200)
        ----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5
        .xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 50
        xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 100
        xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 150
        xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 200

        .

        Comment


        • #5
          Clyde is thinking one step ahead, so let me take a step back.

          Danish, there is an error in your programme. Before you bootstrap or simulate your programme, you need to make sure first that it is working.

          After you define myboot, just execute it firstly on its own (without bootstrap or stimulate) and then see whether it goes through or generates errors.

          Comment


          • #6
            Thanks Joro for your time, That is my program. Please guide and write program which will be helpful for me to catch your point
            program define mybootbsample, rclass
            1. mi register imputed state market male female intention
            2. mi impute mvn state market male female intention, add(200)
            3. egen country1=group(country)
            4. mi xtset country1 year,yearly
            5. mi estimate: xtreg intention male female market state, re
            6. matrix list e(b_mi)
            7. return scalar b_a = el(e(b_mi),1,1)
            8. return scalar b_b = el(e(b_mi),1,2)
            9. return scalar b_c = el(e(b_mi),1,3)
            10. return scalar b_d = el(e(b_mi),1,4)
            11. return scalar b_e = el(e(b_mi),1,5)
            12. end

            . set seed 23543

            . simulate b_male=r(b_a) b_female=r(b_b) b_market=r(b_c) b_state=r(b_d) intercept=r(b_e), reps(20): mybootbsample

            command: mybootbsample
            b_male: r(b_a)
            b_female: r(b_b)
            b_market: r(b_c)
            b_state: r(b_d)
            intercept: r(b_e)

            Simulations (20)
            ----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5
            .xxxxxxxxxxxxxxxxxxx

            Comment


            • #7
              It is hard to impossible to trouble shoot programs like this without having the data and from a distance.

              My point is, after you have defined the program and before the simulate, say above the -set seed-, type

              mybootbsample

              to execute the programme firstly and to see what Stata says. Then from the error messages we will hopefully know where is the problem.

              I think I see a mistake in line 3. The first simulation round when you
              egen country1

              it works, because country1 is not yet defined.

              But the second round, it is already defined so Stata probably says something like

              country1 already exists

              and terminates without calculating anything.

              You can solve this problem by adding before line 1.

              cap drop country1

              Comment


              • #8
                Thanks to both for your time and cooperation. Finally, my problem has been resolved using the following syntax:
                Let's suppose Dep. var is intention and Indep. vars are male female state and market as well as paneval var is country in this example.

                mi set mlong

                mi register imputed intention female male market state
                mi impute mvn intention female male market state, add(200)
                egen country1=group(country)
                mi xtset country1 year,yearly
                mi estimate: xtreg intention male female market state, re
                matrix list e(b_mi)
                program define myboot, rclass
                1. mi estimate: xtreg intention male female market state, re
                2. return scalar b_a = el(e(b_mi),1,1)
                3. return scalar b_b = el(e(b_mi),1,2)
                4. return scalar b_c = el(e(b_mi),1,3)
                5. return scalar b_d = el(e(b_mi),1,4)
                6. return scalar b_e = el(e(b_mi),1,5)
                7. end

                . set seed 23543

                . bootstrap b_male=r(b_a) b_female=r(b_b) b_market=r(b_c) b_state=r(b_d) intercept=r(b_e), reps(100) cluster(country) idcluster (country1): myboot

                Comment

                Working...
                X