Announcement

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

  • Bootstrapping with 2 samples

    Hi there, I'm not an expert STATA user, so I hope to get some help in this forum.

    Here is my set up: I'm planning to partition my data into two sets - a smaller set and a bigger one. Now, I want to sample the larger partition with the sample size equal to the smaller partition and use bootstrapping for my negative binomial regression. So, the bootstrapped samples should select from observations from the larger partition only while leaving the smaller partition as is. I'm familiar with STATA's bootstrap command for regressions but I don't know how to integrate/specify the two different samples I just mentioned. Also, how do I plot the distribution of regression coefficients after I ran my regressions say 1000 times?

    Any help is appreciated!

    Thank you!

  • #2
    What you describe sounds to me like this would fit what you want:
    Code:
    set seed 97646
    use WholeDataSet.dta
    // You didn't say how you wanted to partition the data set, so here is one example.
    local SmallN = 100
    gen rand = runiform()
    sort rand
    gen byte bigpart = _n > `SmallN'
    keep if bigpart == 1
    //
    tempfile bootresults
    bootstrap, reps(1000) size(`SmallN') saving(`bootresults'): nbreg y x1 x2 x3
    clear
    use `bootresults'
    histogram _b_x1
    I don't know what you mean by "integrate/specify the two different samples."

    Comment

    Working...
    X