Quantcast
Channel: Statalist
Viewing all articles
Browse latest Browse all 73253

Bootstrap error for test of difference of estimated coefficient across two groups

$
0
0
Dear Stata users:

I hope you are all doing well.

I am trying to test if the estimated coefficient of treated is significantly different across group 1 and group 2. The suest command cannot be used in this setting.

Group 1 has 9000 observations. Group 2 has 9000 observations.

I receive an error at the end of the procedure explained at the bottom of this message. How could you resolve this issue? Many thanks for your help!

error message:

"Bootstrap replications (50): xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx done
x: Error occurred when bootstrap executed boot_sdid_diff.
insufficient observations to compute bootstrap standard errors
no results will be saved


Procedure:

capture program drop boot_sdid_diff
program define boot_sdid_diff, rclass

* Preserve the full dataset
preserve

* Estimate SDID for Sample 1
keep if sample == 0
sdid interestrate counties year treated, vce(bootstrap) reps(100) seed(1213) covariates(countygdp)

matrix b1 = e(b)

* Restore the full dataset
restore
preserve

* Estimate SDID for Sample 2
keep if sample == 1
sdid interestrate counties year treated, vce(bootstrap) reps(100) seed(1213) covariates(countygdp)

matrix b2 = e(b)

* Calculate the difference in coefficients
scalar diff = b1[1,1] - b2[1,1]
return scalar diff = diff

* Restore the original dataset for the next bootstrap iteration
restore
end

bootstrap diff = r(diff), reps(50): boot_sdid_diff

Viewing all articles
Browse latest Browse all 73253


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>