I would like to calculate weighted confidence intervals of the median, which I need to use for a descriptive graph (median wealth and associated confidence intervals graphed by marital status group and gender).
Currently I am using the following command, which unfortunately cannot handle weights:
Code:
statsby median=r(c_1) upper=r(ub_1) lower=r(lb_1), by(mar_di_pro2 female) saving(medianci, replace) : centile wealth use medianci , clear
Code:
gen median1 = . 
gen median0 = .
quietly forvalues i = 1/6 { 
    forvalues f=0/1{
        summarize wealth [w=xrwght] if mar_di_pro2 == `i' & female==`f', detail 
        replace median`f' = r(p50) if mar_di_pro2 == `i' & female==`f'
  }
}
I am using Stata 15 and my data are the German Socio-Economic Panel.
Thanks,
Nicole
0 Response to How to obtain weighted confidence intervals of the median
Post a Comment