*! 1.0.1 NJC 7 Jan 1999 STB-48 gr35 * 1.0.0 NJC 29 Jan 1998 program define qdagum version 5.0 local varlist "req ex max(1)" local if "opt" local in "opt" local options "Symbol(string) Connect(string) GRid noBorder *" parse "`*'" capture assert "$S_b" != "" & "$S_d" != "" & "$S_h" != "" if _rc { di in r "needs macros S_b, S_d and S_h from dagumfit" exit 198 } if "`symbol'" == "" { local symbol "oi" } else { local symbol "`symbol'`i" } if "`connect'" == "" { local connect ".l" } else { local connect "`connect'`l" } tempvar y touse x Psubi quietly { gen `y' = `varlist' local yl: variable label `varlist' if "`yl'" == "" { label var `y' "`varlist'" } else { label var `y' "`yl'" } gen byte `touse' = cond(`varlist' == .,.,1) `if' `in' sort `varlist' gen float `Psubi' = sum(`touse') replace `Psubi' = cond(`touse' == .,.,(`Psubi'-.5)/`Psubi'[_N]) gen float `x' = /* */ ($S_h / ((1 / `Psubi')^(1 / $S_b) - 1))^(1 / $S_d) label var `x' "inverse Dagum" local fmt : format `varlist' format `y' `x' `fmt' if "`grid'" != "" { parse "5 10 25 50 75 90 95", parse(" ") while "`1'" != "" { local dq`1' : di %4.3f /* */ ($S_h / ((100 / `1')^(1 / $S_b) - 1))^(1 / $S_d) mac shift } su `y' if `touse', detail local xtl = "`dq50',`dq95',`dq5'" local xn = "`xtl',`dq25',`dq75',`dq90',`dq10'" #delimit ; local ytl = string(_result(7)) + "," + string(_result(10)) + "," + string(_result(13)) ; local yn = "`ytl'" + "," + string(_result(8)) + "," + string(_result(9)) + "," + string(_result(11)) + "," + string(_result(12)) ; noisily graph `y' `x' `x', c(`connect') s(`symbol') ylin(`yn') rtic(`yn') rlab(`ytl') xlin(`xn') ttic(`xn') tlab(`xtl') `options' t1("(Grid lines are 5, 10, 25, 50, 75, 90, and 95 percentiles)") ; #delimit cr } else { if "`border'"=="" { local bo "border" } noisily graph `y' `x' `x', c(`connect') /* */ s(`symbol') `bo' `options' } } end