Hi everyone,
I am trying to calculate the significances after applying a DFL detailed decomposition, where I have re-weighted all observations, using bootstrap. Unfortunately, the approaches suggested here in the forum have not worked so far, so I would really appreciate any help as I have been stuck on this problem for weeks.
Part of the program I am running:
In this part of the code, I am iterating over 120 different different pre-programmed reweighting schemes to calculate several summary statistics (mean, p10, p25, p50, p75, p90, p95) for the wealth variable. c_dummy is a country, as we are working on the wealth distribution in two countries.
After this section of code follows the bootstrap code. I have already tried debugging with preserve etc, as recommended in other posts. My dummy variables of the five independent variables have at least 2000 observations in each category. If I run the programme dfl_dd without bootstrap, I can display the percentiles.
I hope I have been able to explain my problem and have shared all the important information, if not please excuse me, I am still a very newbie in the world of econometrics (btw, running a DFL right away when using Stata for the first time may not have been the smartest idea, but sweat and tears got me here and everything except for the bootstrap works :D)
Have a great day,
Clara Rummel
I am trying to calculate the significances after applying a DFL detailed decomposition, where I have re-weighted all observations, using bootstrap. Unfortunately, the approaches suggested here in the forum have not worked so far, so I would really appreciate any help as I have been stuck on this problem for weeks.
Code:
. noisily bootstrap r(p101), reps(1000) seed(123456): dfl_dd (running dfld on estimation sample) Bootstrap replications (1000) ----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 50 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 100 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 150 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 200 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 250 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 300 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 350 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 400 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 450 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 500 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 550 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 600 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 650 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 700 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 750 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 800 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 850 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 900 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 950 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 1000 insufficient observations to compute bootstrap standard errors no results will be saved r(2000);
Code:
program define dfl_dd, rclass probit c_dummy $agegr_dummies $immigr_dummies $educ_dummies $lfs_dummies $incomeq_dummies [pw=hwgt], vce(robust) predict double phat gen double weight001new=(1-phat)/(phat) gen weight001=. replace weight001=weight001new drop phat // Second probit regression, excluding one set of variables probit c_dummy $immigr_dummies $educ_dummies $lfs_dummies $incomeq_dummies [pw=hwgt],vce(robust) predict double phat gen double weight001hnew=(phat)/(1-phat) replace weight001h=weight001hnew*weight001 gen double weight001h2=(1-phat)/(phat) drop phat *continue for the other 3 probit, always excluding a variable
Code:
*(...) forvalues i=116(1)120{ quietly su anw_ppp if c_dummy==1 [aw=x`i'`z'],detail foreach stat in mean p10 p25 p50 p75 p90 p95{ local `stat'm`i' = r(`stat') if `i'==116 local `stat'm1=r(`stat') if `i'==117 local `stat'm2=r(`stat') if `i'==118 local `stat'm3=r(`stat') if `i'==119 local `stat'm4=r(`stat') if `i'==120 local `stat'm5=r(`stat') } } foreach stat in mean p10 p25 p50 p75 p90 p95{ local `stat'1`z'=``stat'1`z''+(``stat'm00'-``stat'm1') local `stat'2`z'=``stat'2`z''+(``stat'm2'-``stat'm3') local `stat'3`z'=``stat'3`z''+(``stat'm4'-``stat'm5') local `stat'4`z'=``stat'4`z''+(``stat'm3'-``stat'm4') local `stat'5`z'=``stat'5`z''+(``stat'm1'-``stat'm2') } } foreach stat in mean p10 p25 p50 p75 p90 p95{ local `stat'1=(``stat'1a'+``stat'5b'+``stat'4c'+``stat'3d'+``stat'5e')/120 local `stat'2=(``stat'2a'+``stat'1b'+``stat'5c'+``stat'4d'+``stat'4e')/120 local `stat'3=(``stat'3a'+``stat'2b'+``stat'1c'+``stat'5d'+``stat'3e')/120 local `stat'4=(``stat'4a'+``stat'3b'+``stat'2c'+``stat'1d'+``stat'2e')/120 local `stat'5=(``stat'5a'+``stat'4b'+``stat'3c'+``stat'2d'+``stat'1e')/120 local `stat'6=``stat'1'+``stat'2'+``stat'3'+``stat'4'+``stat'5' *compositional effect local `stat'7=``stat'm00'-``stat'c0' *unadjusted difference return scalar `stat'1=``stat'1' return scalar `stat'2=``stat'2' *continue for 3-7 } *** dropping weight00, wgt and x1a-120e *** *(...) end
I hope I have been able to explain my problem and have shared all the important information, if not please excuse me, I am still a very newbie in the world of econometrics (btw, running a DFL right away when using Stata for the first time may not have been the smartest idea, but sweat and tears got me here and everything except for the bootstrap works :D)
Have a great day,
Clara Rummel