---------------------------------------------------------------------------------------------------------------------------------------------------- name: log: f:\vhm812-data\L5a-log_reg_dx.txt log type: text opened on: 3 Feb 2015, 23:39:26 . set more off . . * open the Nocardia dataset . use nocardia.dta, clear . sum dcpct Variable | Obs Mean Std. Dev. Min Max -------------+-------------------------------------------------------- dcpct | 108 75.56481 37.3964 0 100 . tab dcpct Pcnt. of | cows dry | treated | Freq. Percent Cum. ------------+----------------------------------- 0 | 7 6.48 6.48 1 | 2 1.85 8.33 3 | 1 0.93 9.26 5 | 3 2.78 12.04 7 | 1 0.93 12.96 10 | 1 0.93 13.89 14 | 1 0.93 14.81 20 | 2 1.85 16.67 25 | 3 2.78 19.44 30 | 2 1.85 21.30 40 | 1 0.93 22.22 50 | 7 6.48 28.70 75 | 4 3.70 32.41 80 | 1 0.93 33.33 83 | 1 0.93 34.26 90 | 1 0.93 35.19 95 | 1 0.93 36.11 99 | 3 2.78 38.89 100 | 66 61.11 100.00 ------------+----------------------------------- Total | 108 100.00 . egen dcpct3=cut(dcpct), at(0,50,100,1000) . tab dcpct3 dcpct3 | Freq. Percent Cum. ------------+----------------------------------- 0 | 24 22.22 22.22 50 | 18 16.67 38.89 100 | 66 61.11 100.00 ------------+----------------------------------- Total | 108 100.00 . . * residuals one per covariate pattern . * fitting a logistic model . logit casecont dneo##dclox i.dcpct3 Iteration 0: log likelihood = -74.859896 Iteration 1: log likelihood = -52.081216 Iteration 2: log likelihood = -51.634967 Iteration 3: log likelihood = -51.632242 Iteration 4: log likelihood = -51.632242 Logistic regression Number of obs = 108 LR chi2(5) = 46.46 Prob > chi2 = 0.0000 Log likelihood = -51.632242 Pseudo R2 = 0.3103 ------------------------------------------------------------------------------ casecont | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- dneo | yes | 3.19238 .8361783 3.82 0.000 1.5535 4.831259 | dclox | yes | .4529145 1.026657 0.44 0.659 -1.559296 2.465125 | dneo#dclox | yes#yes | -2.532558 1.207714 -2.10 0.036 -4.899634 -.1654829 | dcpct3 | 50 | 1.361002 .819178 1.66 0.097 -.2445579 2.966561 100 | 2.026562 .6855237 2.96 0.003 .6829604 3.370164 | _cons | -3.531226 .9364287 -3.77 0.000 -5.366593 -1.69586 ------------------------------------------------------------------------------ . . * examining the covariate patterns . predict cov, num . predict pv, p . sort cov . * generate a count of the number of obs. in each cov. pattern . quietly by cov: gen cnt=_N . br cov cnt dcpct3 dneo dclox pv casecont . . * examining Pearson residuals . predict pear, res /*one per covariate pattern*/ . format pv pear %5.3f . sort pear . summ pear Variable | Obs Mean Std. Dev. Min Max -------------+-------------------------------------------------------- pear | 108 .1413821 .5669692 -.5835651 2.359985 . list cov cnt dcpct dneo dclox pv casecont pear if abs(pear)>2, noobs sep(4) +-------------------------------------------------------------+ | cov cnt dcpct dneo dclox pv casecont pear | |-------------------------------------------------------------| | 4 1 83 no yes 0.152 yes 2.360 | +-------------------------------------------------------------+ . . * Pearson goodness-of-fit tests . *summary table - page 6 . preserve . gen pear_sq=pear^2 . collapse pv cnt pear pear_sq , by(cov casecont) . sort cov casecont . foreach var in pv cnt pear { 2. by cov:replace `var'=. if _n>1 3. } (8 real changes made, 8 to missing) (8 real changes made, 8 to missing) (8 real changes made, 8 to missing) . table casecont, by(cov) c(mean cnt mean pv mean pear ) ---------------------------------------------- covariate | pattern | and Case | - Control | mean(cnt) mean(pv) mean(pear) ----------+----------------------------------- 1 | no | 12 0.028 1.144 yes | ----------+----------------------------------- 2 | no | 2 0.102 -0.478 yes | ----------+----------------------------------- 3 | no | 8 0.182 -0.416 yes | ----------+----------------------------------- 4 | no | yes | 1 0.152 2.360 ----------+----------------------------------- 5 | no | 11 0.259 -0.584 yes | ----------+----------------------------------- 6 | no | 11 0.416 -0.353 yes | ----------+----------------------------------- 7 | no | 10 0.735 -0.254 yes | ----------+----------------------------------- 8 | no | 38 0.844 0.416 yes | ----------+----------------------------------- 9 | no | 1 0.082 -0.298 yes | ----------+----------------------------------- 10 | no | 5 0.258 -0.295 yes | ----------+----------------------------------- 11 | no | 9 0.403 0.252 yes | ---------------------------------------------- . summ pear_sq if cnt~=. Variable | Obs Mean Std. Dev. Min Max -------------+-------------------------------------------------------- pear_sq | 11 .7474848 1.638725 .0634578 5.569528 . di "Pearson X2 = " r(sum) " Prob > chi2 =" chi2tail(11-6,r(sum)) Pearson X2 = 8.2223332 Prob > chi2 =.14440061 . restore . . * Pearson GOF . **stata post estimation command . estat gof Logistic model for casecont, goodness-of-fit test number of observations = 108 number of covariate patterns = 11 Pearson chi2(5) = 8.22 Prob > chi2 = 0.1444 . . * Hosmer - Lemeshow Test . estat gof, g(10) table Logistic model for casecont, goodness-of-fit test (Table collapsed on quantiles of estimated probabilities) (There are only 7 distinct quantiles because of ties) +--------------------------------------------------------+ | Group | Prob | Obs_1 | Exp_1 | Obs_0 | Exp_0 | Total | |-------+--------+-------+-------+-------+-------+-------| | 1 | 0.0284 | 1 | 0.3 | 11 | 11.7 | 12 | | 2 | 0.1817 | 2 | 1.9 | 10 | 10.1 | 12 | | 3 | 0.2589 | 3 | 4.1 | 13 | 11.9 | 16 | | 4 | 0.4033 | 4 | 3.6 | 5 | 5.4 | 9 | | 5 | 0.4161 | 4 | 4.6 | 7 | 6.4 | 11 | |-------+--------+-------+-------+-------+-------+-------| | 6 | 0.7354 | 7 | 7.4 | 3 | 2.6 | 10 | | 10 | 0.8439 | 33 | 32.1 | 5 | 5.9 | 38 | +--------------------------------------------------------+ number of observations = 108 number of groups = 7 Hosmer-Lemeshow chi2(5) = 2.16 Prob > chi2 = 0.8262 . . * commands to show how table is constructed . preserve . logit casecon dneo##dclox i.dcpct3, nolog Logistic regression Number of obs = 108 LR chi2(5) = 46.46 Prob > chi2 = 0.0000 Log likelihood = -51.632242 Pseudo R2 = 0.3103 ------------------------------------------------------------------------------ casecont | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- dneo | yes | 3.19238 .8361783 3.82 0.000 1.5535 4.831259 | dclox | yes | .4529145 1.026657 0.44 0.659 -1.559296 2.465125 | dneo#dclox | yes#yes | -2.532558 1.207714 -2.10 0.036 -4.899634 -.1654829 | dcpct3 | 50 | 1.361002 .819178 1.66 0.097 -.2445579 2.966561 100 | 2.026562 .6855237 2.96 0.003 .6829604 3.370164 | _cons | -3.531226 .9364287 -3.77 0.000 -5.366593 -1.69586 ------------------------------------------------------------------------------ . capture drop pctile . capture drop pv . predict pv (option pr assumed; Pr(casecont)) . sort pv . sumdist pv, n(10) qgp(pctile) Distributional summary statistics, 10 quantile groups --------------------------------------------------------------------------- Quantile | group | Quantile % of median Share, % L(p), % GL(p) ----------+---------------------------------------------------------------- 1 | 0.03 6.83 0.63 0.63 0.00 2 | 0.18 43.68 3.51 4.14 0.02 3 | 0.26 62.22 7.66 11.80 0.06 4 | 0.40 96.91 6.72 18.52 0.09 5 | 0.42 100.00 8.48 26.99 0.13 6 | 0.74 176.74 13.62 40.61 0.20 7 | 0.84 202.82 59.39 100.00 0.50 --------------------------------------------------------------------------- Share = quantile group share of total pv; L(p)=cumulative group share; GL(p)=L(p)*mean(pv) . format pv %4.2f . collapse (count) total=id (sum) cases=casecont (sum) expcases=pv (max) pv (mean) avg_pv=pv, by(pctile) . gen nocases=total-cases . format expcases %2.1f . rename pctile group . quietly summ cases . scalar cases = r(sum) . quietly summ expcases . gen HLoe =(cases-(total*avg_pv))^2/(total*avg_pv*(1-avg_pv)) . quietly summ HLoe . gen pct_HL = HLoe/r(sum) . list group pv cases expcase total HLoe pct_HL, noobs +---------------------------------------------------------------+ | group pv cases expcases total HLoe pct_HL | |---------------------------------------------------------------| | 1 0.03 1 0.3 12 1.308949 .6051602 | | 2 0.18 2 1.9 12 .007215 .0033357 | | 3 0.26 3 4.1 16 .4212823 .1947695 | | 4 0.40 4 3.6 9 .0634578 .0293382 | | 5 0.42 4 4.6 11 .1245676 .0575908 | |---------------------------------------------------------------| | 6 0.74 7 7.4 10 .0643713 .0297605 | | 7 0.84 33 32.1 38 .1731363 .0800453 | +---------------------------------------------------------------+ . di "H-L Chi_sq = "r(sum) " , pvalue = " chiprob(7-2, r(sum)) H-L Chi_sq = 2.162979 , pvalue = .82616509 . restore . . * Evaluating Important Observations in a Logistic Model . * fitting a logistic model . logit casecont i.dneo##dclox i.dcpct3 Iteration 0: log likelihood = -74.859896 Iteration 1: log likelihood = -52.081216 Iteration 2: log likelihood = -51.634967 Iteration 3: log likelihood = -51.632242 Iteration 4: log likelihood = -51.632242 Logistic regression Number of obs = 108 LR chi2(5) = 46.46 Prob > chi2 = 0.0000 Log likelihood = -51.632242 Pseudo R2 = 0.3103 ------------------------------------------------------------------------------ casecont | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- dneo | yes | 3.19238 .8361783 3.82 0.000 1.5535 4.831259 | dclox | yes | .4529145 1.026657 0.44 0.659 -1.559296 2.465125 | dneo#dclox | yes#yes | -2.532558 1.207714 -2.10 0.036 -4.899634 -.1654829 | dcpct3 | 50 | 1.361002 .819178 1.66 0.097 -.2445579 2.966561 100 | 2.026562 .6855237 2.96 0.003 .6829604 3.370164 | _cons | -3.531226 .9364287 -3.77 0.000 -5.366593 -1.69586 ------------------------------------------------------------------------------ . * evaluating outliers . capture drop cov pv . capture drop cnt . capture drop lev . capture drop pear_std . predict pv, p . predict pear_std, rstandard . predict cov, num . quietly bysort cov: gen cnt=_N . predict lev, hat . . * Identifying highest leverage points . summ lev, d leverage ------------------------------------------------------------- Percentiles Smallest 1% .1063734 .0550704 5% .2907239 .1063734 10% .2907239 .1662458 Obs 108 25% .7028956 .1662458 Sum of Wgt. 108 50% .8515815 Mean .729414 Largest Std. Dev. .2256387 75% .8515815 .9453593 90% .9453593 .9453593 Variance .0509128 95% .9453593 .9453593 Skewness -1.434562 99% .9453593 .9453593 Kurtosis 3.850434 . * graph of stand. resid. vs leverage . scatter lev pv, mlabel(cov) xline(0.1 0.9) xlabel(0(0.1)1) . scatter pear_std lev , mlabel(cov) yline(-2 2) . . *list . preserve . collapse (count) herds=casecont (mean) dcpct dneo dclox pv pear_std lev, by(cov) . sort lev pv . l cov herds dcpct dneo dclox pv pear_std lev if pv>0.1 & pv<0.9 , noobs // this is diff as in the notes - have pv not lev +----------------------------------------------------------------------+ | cov herds dcpct dneo dclox pv pear_std lev | |----------------------------------------------------------------------| | 4 1 83 0 1 .152218 2.496497 .1063734 | | 2 2 75 0 0 .1024564 -.5232843 .1662458 | | 10 5 74 1 1 .2577896 -.4160336 .4957797 | | 7 10 69 1 0 .7353922 -.4654696 .7028956 | | 3 8 100 0 0 .1817309 -.8012637 .7303169 | |----------------------------------------------------------------------| | 11 9 100 1 1 .4032532 .5182928 .76377 | | 8 38 100 1 0 .8439235 1.080066 .8515815 | | 6 11 15 1 0 .4160897 -1.073387 .8918833 | | 5 11 100 0 1 .2588893 -2.496497 .9453593 | +----------------------------------------------------------------------+ . restore . . * Residual analysis . sort pear_std . twoway (scatter pear_std cov [aweight=cnt], msymbol(Oh) mlcolor(black) mlwidth(medium)) /// > (scatter pear_std cov, msize(vtiny) mlabel(cov)), legend(off) yline( -2 2) . bysort cov: gen wcov=_n . bysort cov: egen avgcc=mean(casecont) . list cov cnt dcpct dneo dclox avgcc pv pear_std if wcov==1 & abs(pear_std)>2 ,noobs +--------------------------------------------------------------------+ | cov cnt dcpct dneo dclox avgcc pv pear_std | |--------------------------------------------------------------------| | 4 1 83 no yes 1 .152218 2.496497 | | 5 11 100 no yes .1818182 .2588893 -2.496497 | +--------------------------------------------------------------------+ . . * evaluating delta chisq . predict dx2, dx2 . scatter dx2 pv, mlabel(cov) yline(3.84) /*delta chi2*/ . . foreach var in pv pear_std db dx2 lev { 2. format `var' %5.3f 3. } . preserve . collapse (count) herds=casecont (mean) dcpct dneo dclox pv dx2 lev , by(cov) . sort dx2 . list cov herds dcpct dneo dclox pv dx2 lev if dx2>3.84, noobs table +------------------------------------------------------------+ | cov herds dcpct dneo dclox pv dx2 lev | |------------------------------------------------------------| | 4 1 83 0 1 0.152 6.232 0.106 | | 5 11 100 0 1 0.259 6.232 0.945 | +------------------------------------------------------------+ . restore . . * evaluating delta betas . predict db, dbeta . sort db . summ db, d Pregibon's dbeta ------------------------------------------------------------- Percentiles Smallest 1% .0545994 .0054927 5% .1701865 .0545994 10% .5125833 .0545994 Obs 108 25% .7564373 .1701865 Sum of Wgt. 108 50% 6.69328 Mean 14.65434 Largest Std. Dev. 31.68869 75% 6.69328 107.8308 90% 107.8308 107.8308 Variance 1004.173 95% 107.8308 107.8308 Skewness 2.581599 99% 107.8308 107.8308 Kurtosis 7.77457 . scatter db pv, ml(cov) yline(1) . scatter db lev, ml(cov) yline(1) . scatter dx2 pv [aweight=db], msymbol(Oh) || scatter dx2 pv, ml(cov) yline(3.84) legend(off) /// > ytitle("Delta Chi2") . . preserve . collapse (count) herds=casecont (mean) dcpct dneo dclox pv lev dx2 db, by(cov) . sort db . l cov herds dcpct dneo dclox pv lev dx2 db if db > abs(1), noobs table +-----------------------------------------------------------------------+ | cov herds dcpct dneo dclox pv lev dx2 db | |-----------------------------------------------------------------------| | 3 8 100 0 0 0.182 0.730 0.642 1.738636 | | 8 38 100 1 0 0.844 0.852 1.167 6.69328 | | 6 11 15 1 0 0.416 0.892 1.152 9.504465 | | 5 11 100 0 1 0.259 0.945 6.232 107.8308 | +-----------------------------------------------------------------------+ . restore . . * dropping the highest db covariate pattern and refitting the model . logit casecont dneo##dclox i.dcpct3 if cov~=5 note: 0.dneo#1.dclox != 0 predicts success perfectly 0.dneo#1.dclox dropped and 1 obs not used note: 1.dneo#1.dclox omitted because of collinearity Iteration 0: log likelihood = -66.354507 Iteration 1: log likelihood = -44.475074 Iteration 2: log likelihood = -44.191216 Iteration 3: log likelihood = -44.189538 Iteration 4: log likelihood = -44.189538 Logistic regression Number of obs = 96 LR chi2(4) = 44.33 Prob > chi2 = 0.0000 Log likelihood = -44.189538 Pseudo R2 = 0.3340 ------------------------------------------------------------------------------ casecont | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- dneo | yes | 3.24774 .8455286 3.84 0.000 1.590534 4.904945 | dclox | yes | -2.081316 .6762839 -3.08 0.002 -3.406808 -.7558245 | dneo#dclox | no#yes | 0 (empty) yes#yes | 0 (omitted) | dcpct3 | 50 | 1.086617 .8180359 1.33 0.184 -.5167036 2.689938 100 | 2.13252 .6950519 3.07 0.002 .7702429 3.494796 | _cons | -3.58071 .9466209 -3.78 0.000 -5.436053 -1.725367 ------------------------------------------------------------------------------ . * no interaction cov 5 only cov with dneo=no and dclox=yes with cases and controls . * the other cov with this patterns is 4 but only has one case. . table casecont dneo dclox ------------------------------------ | Cloxacillin used on farm |and Neomycin used on farm Case - | --- no --- --- yes -- Control | no yes no yes ----------+------------------------- no | 20 15 9 10 yes | 2 44 3 5 ------------------------------------ . table casecont dneo dclox if cov~=5 ------------------------------------ | Cloxacillin used on farm |and Neomycin used on farm Case - | --- no --- --- yes -- Control | no yes no yes ----------+------------------------- no | 20 15 10 yes | 2 44 1 5 ------------------------------------ . . * refitting and comparing the models . logit casecont dneo##dclox i.dcpct3 Iteration 0: log likelihood = -74.859896 Iteration 1: log likelihood = -52.081216 Iteration 2: log likelihood = -51.634967 Iteration 3: log likelihood = -51.632242 Iteration 4: log likelihood = -51.632242 Logistic regression Number of obs = 108 LR chi2(5) = 46.46 Prob > chi2 = 0.0000 Log likelihood = -51.632242 Pseudo R2 = 0.3103 ------------------------------------------------------------------------------ casecont | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- dneo | yes | 3.19238 .8361783 3.82 0.000 1.5535 4.831259 | dclox | yes | .4529145 1.026657 0.44 0.659 -1.559296 2.465125 | dneo#dclox | yes#yes | -2.532558 1.207714 -2.10 0.036 -4.899634 -.1654829 | dcpct3 | 50 | 1.361002 .819178 1.66 0.097 -.2445579 2.966561 100 | 2.026562 .6855237 2.96 0.003 .6829604 3.370164 | _cons | -3.531226 .9364287 -3.77 0.000 -5.366593 -1.69586 ------------------------------------------------------------------------------ . estimate store final . * without cov pattern 5 . logit casecont dneo##dclox i.dcpct3 if cov~=5 note: 0.dneo#1.dclox != 0 predicts success perfectly 0.dneo#1.dclox dropped and 1 obs not used note: 1.dneo#1.dclox omitted because of collinearity Iteration 0: log likelihood = -66.354507 Iteration 1: log likelihood = -44.475074 Iteration 2: log likelihood = -44.191216 Iteration 3: log likelihood = -44.189538 Iteration 4: log likelihood = -44.189538 Logistic regression Number of obs = 96 LR chi2(4) = 44.33 Prob > chi2 = 0.0000 Log likelihood = -44.189538 Pseudo R2 = 0.3340 ------------------------------------------------------------------------------ casecont | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- dneo | yes | 3.24774 .8455286 3.84 0.000 1.590534 4.904945 | dclox | yes | -2.081316 .6762839 -3.08 0.002 -3.406808 -.7558245 | dneo#dclox | no#yes | 0 (empty) yes#yes | 0 (omitted) | dcpct3 | 50 | 1.086617 .8180359 1.33 0.184 -.5167036 2.689938 100 | 2.13252 .6950519 3.07 0.002 .7702429 3.494796 | _cons | -3.58071 .9466209 -3.78 0.000 -5.436053 -1.725367 ------------------------------------------------------------------------------ . estimates store wocov5 . * without cov pattern 6 . logit casecont dneo##dclox i.dcpct3 if cov~=6 Iteration 0: log likelihood = -67.188877 Iteration 1: log likelihood = -44.268414 Iteration 2: log likelihood = -43.951293 Iteration 3: log likelihood = -43.949794 Iteration 4: log likelihood = -43.949794 Logistic regression Number of obs = 97 LR chi2(5) = 46.48 Prob > chi2 = 0.0000 Log likelihood = -43.949794 Pseudo R2 = 0.3459 ------------------------------------------------------------------------------ casecont | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- dneo | yes | 3.639127 .99651 3.65 0.000 1.686003 5.592251 | dclox | yes | .8080203 1.132313 0.71 0.475 -1.411272 3.027313 | dneo#dclox | yes#yes | -3.018298 1.34906 -2.24 0.025 -5.662408 -.3741881 | dcpct3 | 50 | .1199465 1.407715 0.09 0.932 -2.639124 2.879017 100 | .8134231 1.299859 0.63 0.531 -1.734255 3.361101 | _cons | -2.671599 1.073272 -2.49 0.013 -4.775174 -.5680239 ------------------------------------------------------------------------------ . estimates store wocov6 . * without cov pattern 8 . logit casecont dneo##dclox i.dcpct3 if cov~=8 Iteration 0: log likelihood = -42.760501 Iteration 1: log likelihood = -36.670668 Iteration 2: log likelihood = -36.284326 Iteration 3: log likelihood = -36.280224 Iteration 4: log likelihood = -36.280224 Logistic regression Number of obs = 70 LR chi2(5) = 12.96 Prob > chi2 = 0.0238 Log likelihood = -36.280224 Pseudo R2 = 0.1515 ------------------------------------------------------------------------------ casecont | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- dneo | yes | 2.518415 .9964233 2.53 0.011 .5654611 4.471369 | dclox | yes | .7045019 1.065468 0.66 0.508 -1.383776 2.79278 | dneo#dclox | yes#yes | -2.05333 1.255048 -1.64 0.102 -4.51318 .4065195 | dcpct3 | 50 | 1.173495 .7931855 1.48 0.139 -.3811195 2.72811 100 | 1.168346 1.025769 1.14 0.255 -.842125 3.178817 | _cons | -2.97189 .9807858 -3.03 0.002 -4.894194 -1.049585 ------------------------------------------------------------------------------ . estimates store wocov8 . . estimates table final wocov5 wocov6 wocov8 , b(%5.3f) stats(N) star( .05 .01 .001) -------------------------------------------------------------------------- Variable | final wocov5 wocov6 wocov8 -------------+------------------------------------------------------------ dneo | yes | 3.192*** 3.248*** 3.639*** 2.518* | dclox | yes | 0.453 -2.081** 0.808 0.705 | dneo#dclox | no#yes | (base) (empty) (base) (base) | dneo#dclox | yes#yes | -2.533* (omitted) -3.018* -2.053 | dcpct3 | 50 | 1.361 1.087 0.120 1.173 100 | 2.027** 2.133** 0.813 1.168 | _cons | -3.531*** -3.581*** -2.672* -2.972** -------------+------------------------------------------------------------ N | 108 96 97 70 -------------------------------------------------------------------------- legend: * p<.05; ** p<.01; *** p<.001 . . *Predictive ability of the model . * sensitivity and specificty of logistic model . logit casecont dneo##dclox i.dcpct3 Iteration 0: log likelihood = -74.859896 Iteration 1: log likelihood = -52.081216 Iteration 2: log likelihood = -51.634967 Iteration 3: log likelihood = -51.632242 Iteration 4: log likelihood = -51.632242 Logistic regression Number of obs = 108 LR chi2(5) = 46.46 Prob > chi2 = 0.0000 Log likelihood = -51.632242 Pseudo R2 = 0.3103 ------------------------------------------------------------------------------ casecont | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- dneo | yes | 3.19238 .8361783 3.82 0.000 1.5535 4.831259 | dclox | yes | .4529145 1.026657 0.44 0.659 -1.559296 2.465125 | dneo#dclox | yes#yes | -2.532558 1.207714 -2.10 0.036 -4.899634 -.1654829 | dcpct3 | 50 | 1.361002 .819178 1.66 0.097 -.2445579 2.966561 100 | 2.026562 .6855237 2.96 0.003 .6829604 3.370164 | _cons | -3.531226 .9364287 -3.77 0.000 -5.366593 -1.69586 ------------------------------------------------------------------------------ . estat class Logistic model for casecont -------- True -------- Classified | D ~D | Total -----------+--------------------------+----------- + | 40 8 | 48 - | 14 46 | 60 -----------+--------------------------+----------- Total | 54 54 | 108 Classified + if predicted Pr(D) >= .5 True D defined as casecont != 0 -------------------------------------------------- Sensitivity Pr( +| D) 74.07% Specificity Pr( -|~D) 85.19% Positive predictive value Pr( D| +) 83.33% Negative predictive value Pr(~D| -) 76.67% -------------------------------------------------- False + rate for true ~D Pr( +|~D) 14.81% False - rate for true D Pr( -| D) 25.93% False + rate for classified + Pr(~D| +) 16.67% False - rate for classified - Pr( D| -) 23.33% -------------------------------------------------- Correctly classified 79.63% -------------------------------------------------- . * two graph ROC . lsens, lpattern(solid dash) . * changing the cutpoint . estat class, cut(0.25) Logistic model for casecont -------- True -------- Classified | D ~D | Total -----------+--------------------------+----------- + | 51 33 | 84 - | 3 21 | 24 -----------+--------------------------+----------- Total | 54 54 | 108 Classified + if predicted Pr(D) >= .25 True D defined as casecont != 0 -------------------------------------------------- Sensitivity Pr( +| D) 94.44% Specificity Pr( -|~D) 38.89% Positive predictive value Pr( D| +) 60.71% Negative predictive value Pr(~D| -) 87.50% -------------------------------------------------- False + rate for true ~D Pr( +|~D) 61.11% False - rate for true D Pr( -| D) 5.56% False + rate for classified + Pr(~D| +) 39.29% False - rate for classified - Pr( D| -) 12.50% -------------------------------------------------- Correctly classified 66.67% -------------------------------------------------- . * standard ROC graph . lroc Logistic model for casecont number of observations = 108 area under ROC curve = 0.8460 . end of do-file