/* DATE: 4\19\91: changes logiodds.ado to include e option */ /* Fix options !! */ program define logiodd2 version 2.1 if "%_*"=="" { mac def _1 "%LOGIODD2" mac def _2 "%LOGIIFIN" if "%_*"=="" { di in red "invalid syntax -- see help logiodd2" exit 198 } } mac def _options "STats Logit Fit Ext Inf Roc SAving(string) *" mac def _varlist "req ex" mac def _if "opt" mac def _in "opt" parse "%_*" parse "%_varlist", parse(" ") mac def LOGIODD2 "%_varlist" mac def LOGIIFIN "%_if %_in" mac def _dv "%_1" if ("%_logit"=="") { mac def _quiet "quietly" } else { mac def _quiet "noisily" } capture { %_quiet logit %_* %_if %_in, %_options mac def _nobs = _result(1) mac def _df = _result(1) - _result(3) emdef S_it : invt .95 %_df di _n in gr /* */ "Variable | Odds Ratio Std. Error [95% Conf. Interval] Delta*Coef" /* */ _n in gr "---------+" _dup(62) "-" mac def _bad "0" while ("%_2"!="") { capture mac def _beta = _b[%_2] if _rc { mac def _bad "1" } else { emdef S_se : se %_2 mac def _delta 1 mac def _ind " " summ %_2 %_if %_in if (_result(6)-_result(5)>1) { mac def _delta = sqrt(_result(4)) mac def _ind "*" } mac def _x = exp(_b[%_2]*%_delta) mac def S_se = %S_se*%_delta mac def _indent = 8 - length("%_2") di _skip(%_indent) in gr "%_2" _col(9) " |" /* */ in ye _col(14) %9.0g %_x in gr "%_ind" /* */ in ye _col(28) %9.0g %S_se*%_x /* */ _col(39) %9.0g %_x*exp(-%S_it*%S_se) /* */ _col(50) %9.0g %_x*exp(%S_it*%S_se) /* */ _col(63) %9.0g _b[%_2]*%_delta in gr "%_ind" } mac shift } di in gr "---------+" _dup(62) "-" _n /* */ _col(30) "(*) Note: Delta = 1 SD rather than 1 unit." _n set adosize 20 if %_bad==1 { predict _HAT %_if %_in, index count if _HAT!=. if _result(1) != %_nobs { #delimit ; di in blu "Warning: " in gr "At least one variable was dropped from the model due to perfect" _n " prediction. The " in ye _result(1)-%_nobs in gr " corresponding observations will not, however," _n " be dropped by " in wh "logistat" in gr ", " in wh "logifit" in gr ", and " in wh "roc" in gr " unless explicitly omitted." ; #delimit cr if "%_stats"!="" | "%_fit"!="" | "%_roc"!="" | "_ext"!="" | "_inf"!="" { di in gr /* */ " Additional statistics suppressed." mac def _stats mac def _fit mac def _roc mac def _ext mac def _inf } } drop _HAT } if ("%_stats"!="") { logistat %_dv %_if %_in } if ("%_fit"!="") { logifit %_varlist %_if %_in } if ("%_ext"!="") { extlogit %_varlist %_if %_in } if ("%_inf"!="") { inflogit %_varlist %_if %_in } if ("%_roc"!="") { if ("%_saving"!="") { mac def _saving "saving(%_saving)" } roc %_dv %_if %_in, %_saving di in gr _dup(72) "-" } } mac def _rc = _rc cap mac drop S_se cap mac drop S_it cap drop _HAT exit %_rc end