I am trying to add 95% confidence intervals to a kdenstiy plot. I think I need to caculate the top 2.5% and bottom 2.5% of my variable b, but I am not sure how to do this and to add it to the plot as lines (line at lower and upper). Any ideas? Thanks!
Code:
preserve set seed 692525 tempfile temp // to hold the results from each repetition permute beta1 b = _b[beta1], saving(`temp') reps(10):reghdfe hous_all_act_ind beta1 gender2 race2 age_at_refer if ym>=`=tm(2018m12)', absorb(i.hh_zip2 i.yearmonth) su b use `temp', clear kdensity b, lwidth(0.3) lcolor(cranberry) xline(-0.027, lwidth(0.3) lcolor(ebblue) lpattern(longdash)) xlabel (-0.03 (.01) 0.005) xtitle(Estimated Placebo Betas) ytitle(Density) title(Housing Risk Services) graphregion(color(white)) bgcolor(white) text(150 -0.015 "Actual Beta = -0.027", size(small)) graph export "placebo1.png", as (png) replace restore
0 Response to Calculating top and bottom 2.5%
Post a Comment