Dear all,
I want to calculate standard errors for the decomposition of change (for the three scalar: che_CI`x', che_Ela`x', and CC`x) using a programe.
Code:
svyset PSU [pweight=finwgt], bsrweight(bsrw1-bsrw50) vce(bootstrap) * 2011 decompostion capture program drop gebreboot program define gebreboot, rclass conindex ANC4_skilled if survey==3 & v025==1, rankvar(meduc_t00) bounded limits(0 1) erreygers svy sca EI2011 = r(CI) global X adolescent_age_ur2 region_ur2 region_ur3 region_ur4 region_ur5 region_ur6 region_ur7 region_ur8 region_ur9 region_ur10 region_ur11 husband_edu_ur2 husband_edu_ur3 husband_edu_ur4 religion_f_ur2 religion_f_ur3 religion_f_ur4 media_new_ur2 meduc_t00_ur2 meduc_t00_ur3 women_occupation_ur2 husband_occupation_ur2 swpatt3gr_ur2 swpatt3gr_ur3 swpsoc3gr_ur2 swpsoc3gr_ur3 swpdec3gr_ur2 swpdec3gr_ur3 birthor_ur2 birthor_ur3 birthor_ur4 wealth_rr_ur2 qui sum ANC4_skilled if survey==3 & v025==1 [aw=wt] sca m_y=r(mean) svy: qui glm ANC4_skilled $X if survey==3 & v025==1, family(binomial) link(logit) foreach x of varlist $X { sca b_`x'=_b[`x'] } foreach x of varlist $X { qui { conindex `x' if survey==3 & v025==1, rank(meduc_t00) truezero svy sca CI2011_`x' = r(CI) sum `x' if survey==3 & v025==1 [aw=wt] sca m_`x'=r(mean) sca elas2011_`x' = (b_`x'*m_`x')/m_y sca con_`x' = 4*b_`x'*m_`x'*CI2011_`x' sca prcnt_`x' = 100*con_`x'/EI2011 } } * 2016 decomposition and the change between 2011-2016 clear matrix conindex ANC4_skilled if survey==4 & v025==1, rankvar(meduc_t00) bounded limits(0 1) erreygers svy sca EI2016 = r(CI) global X adolescent_age_ur2 region_ur2 region_ur3 region_ur4 region_ur5 region_ur6 region_ur7 region_ur8 region_ur9 region_ur10 region_ur11 husband_edu_ur2 husband_edu_ur3 husband_edu_ur4 religion_f_ur2 religion_f_ur3 religion_f_ur4 media_new_ur2 meduc_t00_ur2 meduc_t00_ur3 women_occupation_ur2 husband_occupation_ur2 swpatt3gr_ur2 swpatt3gr_ur3 swpsoc3gr_ur2 swpsoc3gr_ur3 swpdec3gr_ur2 swpdec3gr_ur3 birthor_ur2 birthor_ur3 birthor_ur4 wealth_rr_ur2 qui sum ANC4_skilled if survey==4 & v025==1 [aw=wt] sca m_y=r(mean) svy: qui glm ANC4_skilled $X if survey==4 & v025==1, family(binomial) link(logit) foreach x of varlist $X { sca b_`x'=_b[`x'] } foreach x of varlist $X { qui { conindex `x' if survey==4 & v025==1, rank(meduc_t00) truezero svy sca CI2016_`x' = r(CI) sum `x' if survey==4 & v025==1 [aw=wt] sca m_`x'=r(mean) sca elas2016_`x' = (b_`x'*m_`x')/m_y sca con_`x' = 4*b_`x'*m_`x'*CI2016_`x' sca prcnt_`x' = 100*con_`x'/EI2016 sca che_CI`x' = elas2016_`x'*(CI2016_`x' - CI2011_`x') sca che_Ela`x' = CI2011_`x'*(elas2016_`x' - elas2011_`x') sca CC`x' = elas2016_`x'*(CI2016_`x' - CI2011_`x') + CI2011_`x'*(elas2016_`x' - elas2011_`x') } di "`xí concentration index:", che_CI`x' di "`xí elast:", che_Ela`x' di "`xí totalCC:", CC`x' matrix Decomp20112016_urban = nullmat(Decomp20112016_urban)\ (che_CI`x', che_Ela`x', CC`x') } matrix rownames Decomp20112016_urban= $X matrix colnames Decomp20112016_urban = "CIchange""elaschnage""CC" matrix list Decomp20112016_urban, format(%8.3f) end
Code:
svy:gebreboot
Your help is highly appreciated.