Note: This chapter uses a suite of commands, called spost, written by J. Scott Long and Jeremy Freese. The commands must be downloaded prior to their use, and this can be done by typing search spost in the Stata command line (see How can I use the search command to search for programs and get additional help? for more information about using search).
Table 4.1, page 97.
use https://stats.idre.ucla.edu/stat/stata/examples/long/binlfp2.dta, clear logit lfp k5 k618 age wc hc lwg inc Iteration 0: log likelihood = -514.8732 Iteration 1: log likelihood = -454.32339 Iteration 2: log likelihood = -452.64187 Iteration 3: log likelihood = -452.63296 Iteration 4: log likelihood = -452.63296 Logit estimates Number of obs = 753 LR chi2(7) = 124.48 Prob > chi2 = 0.0000 Log likelihood = -452.63296 Pseudo R2 = 0.1209 ------------------------------------------------------------------------------ lfp | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- k5 | -1.462913 .1970006 -7.43 0.000 -1.849027 -1.076799 k618 | -.0645707 .0680008 -0.95 0.342 -.1978499 .0687085 age | -.0628706 .0127831 -4.92 0.000 -.0879249 -.0378162 wc | .8072738 .2299799 3.51 0.000 .3565215 1.258026 hc | .1117336 .2060397 0.54 0.588 -.2920969 .515564 lwg | .6046931 .1508176 4.01 0.000 .3090961 .9002901 inc | -.0344464 .0082084 -4.20 0.000 -.0505346 -.0183583 _cons | 3.18214 .6443751 4.94 0.000 1.919188 4.445092 ------------------------------------------------------------------------------
LR Tests, test k5 = 0.
quietly logit lfp k5 k618 age wc hc lwg inc est store a quietly logit lfp k618 age wc hc lwg inc est store b lrtest a b, stats likelihood-ratio test LR chi2(1) = 66.48 (Assumption: b nested in a) Prob > chi2 = 0.0000 ------------------------------------------------------------------------------ Model | nobs ll(null) ll(model) df AIC BIC -------------+---------------------------------------------------------------- b | 753 -514.8732 -485.875 7 985.7501 1018.119 a | 753 -514.8732 -452.633 8 921.2659 958.2584 ------------------------------------------------------------------------------
Test wc = hc = 0.
quietly logit lfp k5 k618 age lwg inc est store c lrtest a c, stats likelihood-ratio test LR chi2(2) = 18.50 (Assumption: c nested in a) Prob > chi2 = 0.0001 ------------------------------------------------------------------------------ Model | nobs ll(null) ll(model) df AIC BIC -------------+---------------------------------------------------------------- c | 753 -514.8732 -461.8808 6 935.7617 963.5061 a | 753 -514.8732 -452.633 8 921.2659 958.2584 ------------------------------------------------------------------------------
Test all slopes = 0.
quietly logit lfp est store d lrtest a d, stats likelihood-ratio test LR chi2(7) = 124.48 (Assumption: d nested in a) Prob > chi2 = 0.0000 ------------------------------------------------------------------------------ Model | nobs ll(null) ll(model) df AIC BIC -------------+---------------------------------------------------------------- d | 753 -514.8732 -514.8732 1 1031.746 1036.37 a | 753 -514.8732 -452.633 8 921.2659 958.2584 ------------------------------------------------------------------------------
Wald Tests.
logit lfp k5 k618 age wc hc lwg inc Iteration 0: log likelihood = -514.8732 Iteration 1: log likelihood = -454.32339 Iteration 2: log likelihood = -452.64187 Iteration 3: log likelihood = -452.63296 Iteration 4: log likelihood = -452.63296 Logit estimates Number of obs = 753 LR chi2(7) = 124.48 Prob > chi2 = 0.0000 Log likelihood = -452.63296 Pseudo R2 = 0.1209 ------------------------------------------------------------------------------ lfp | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- k5 | -1.462913 .1970006 -7.43 0.000 -1.849027 -1.076799 k618 | -.0645707 .0680008 -0.95 0.342 -.1978499 .0687085 age | -.0628706 .0127831 -4.92 0.000 -.0879249 -.0378162 wc | .8072738 .2299799 3.51 0.000 .3565215 1.258026 hc | .1117336 .2060397 0.54 0.588 -.2920969 .515564 lwg | .6046931 .1508176 4.01 0.000 .3090961 .9002901 inc | -.0344464 .0082084 -4.20 0.000 -.0505346 -.0183583 _cons | 3.18214 .6443751 4.94 0.000 1.919188 4.445092 ------------------------------------------------------------------------------ test k5 ( 1) k5 = 0 chi2( 1) = 55.14 Prob > chi2 = 0.0000 test wc hc ( 1) wc = 0 ( 2) hc = 0 chi2( 2) = 17.66 Prob > chi2 = 0.0001 test k5 k618 age wc hc lwg inc ( 1) k5 = 0 ( 2) k618 = 0 ( 3) age = 0 ( 4) wc = 0 ( 5) hc = 0 ( 6) lwg = 0 ( 7) inc = 0 chi2( 7) = 94.98 Prob > chi2 = 0.0000
Figure 4.4, page 100.
Note: Figures 4.4 and 4.5 on pages 100 and 101 do not match the textbook.
logit lfp k5 k618 age wc hc lwg inc Iteration 0: log likelihood = -514.8732 Iteration 1: log likelihood = -454.32339 Iteration 2: log likelihood = -452.64187 Iteration 3: log likelihood = -452.63296 Iteration 4: log likelihood = -452.63296 Logit estimates Number of obs = 753 LR chi2(7) = 124.48 Prob > chi2 = 0.0000 Log likelihood = -452.63296 Pseudo R2 = 0.1209 ------------------------------------------------------------------------------ lfp | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- k5 | -1.462913 .1970006 -7.43 0.000 -1.849027 -1.076799 k618 | -.0645707 .0680008 -0.95 0.342 -.1978499 .0687085 age | -.0628706 .0127831 -4.92 0.000 -.0879249 -.0378162 wc | .8072738 .2299799 3.51 0.000 .3565215 1.258026 hc | .1117336 .2060397 0.54 0.588 -.2920969 .515564 lwg | .6046931 .1508176 4.01 0.000 .3090961 .9002901 inc | -.0344464 .0082084 -4.20 0.000 -.0505346 -.0183583 _cons | 3.18214 .6443751 4.94 0.000 1.919188 4.445092 ------------------------------------------------------------------------------ predict rstd, rstandard sort inc gen index = _n label var index "Observation Number" graph twoway (scatter rstd index)
Figure 4.5, page 101. Index Plot of Cook’s Influence Statistics
predict c, dbeta label var c "Cook's Influence Statistics" graph twoway (scatter c index, mlabel(index))
Table 4.2, page 106.
quietly reg lfp k5 k618 age wc hc lwg inc fitstat Measures of Fit for regress of lfp Log-Lik Intercept Only: -539.410 Log-Lik Full Model: -478.086 D(745): 956.171 LR(7): 122.648 Prob > LR: 0.000 R2: 0.150 Adjusted R2: 0.142 AIC: 1.291 AIC*n: 972.171 BIC: -3978.757 BIC': -76.280 quietly reg lfp k5 age age2 wc inc fitstat Measures of Fit for regress of lfp Log-Lik Intercept Only: -539.410 Log-Lik Full Model: -486.426 D(747): 972.851 LR(5): 105.968 Prob > LR: 0.000 R2: 0.131 Adjusted R2: 0.125 AIC: 1.308 AIC*n: 984.851 BIC: -3975.326 BIC': -72.848
Logit Model.
quietly logit lfp k5 k618 age wc hc lwg inc fitstat Measures of Fit for logit of lfp Log-Lik Intercept Only: -514.873 Log-Lik Full Model: -452.633 D(745): 905.266 LR(7): 124.480 Prob > LR: 0.000 McFadden's R2: 0.121 McFadden's Adj R2: 0.105 Maximum Likelihood R2: 0.152 Cragg & Uhler's R2: 0.204 McKelvey and Zavoina's R2: 0.217 Efron's R2: 0.155 Variance of y*: 4.203 Variance of error: 3.290 Count R2: 0.693 Adj Count R2: 0.289 AIC: 1.223 AIC*n: 921.266 BIC: -4029.663 BIC': -78.112 gen age2 = age*age quietly logit lfp k5 age age2 wc inc fitstat Measures of Fit for logit of lfp Log-Lik Intercept Only: -514.873 Log-Lik Full Model: -461.653 D(747): 923.306 LR(5): 106.441 Prob > LR: 0.000 McFadden's R2: 0.103 McFadden's Adj R2: 0.092 Maximum Likelihood R2: 0.132 Cragg & Uhler's R2: 0.177 McKelvey and Zavoina's R2: 0.182 Efron's R2: 0.135 Variance of y*: 4.023 Variance of error: 3.290 Count R2: 0.677 Adj Count R2: 0.252 AIC: 1.242 AIC*n: 935.306 BIC: -4024.871 BIC': -73.321
Table 4.4, page 109.
quietly logit lfp k5 k618 age wc hc lwg inc * Stata 8 code. lstat * Stata 9 code and output. estat classification Logistic model for lfp -------- True -------- Classified | D ~D | Total -----------+--------------------------+----------- + | 342 145 | 487 - | 86 180 | 266 -----------+--------------------------+----------- Total | 428 325 | 753 Classified + if predicted Pr(D) >= .5 True D defined as lfp != 0 -------------------------------------------------- Sensitivity Pr( +| D) 79.91% Specificity Pr( -|~D) 55.38% Positive predictive value Pr( D| +) 70.23% Negative predictive value Pr(~D| -) 67.67% -------------------------------------------------- False + rate for true ~D Pr( +|~D) 44.62% False - rate for true D Pr( -| D) 20.09% False + rate for classified + Pr(~D| +) 29.77% False - rate for classified - Pr( D| -) 32.33% -------------------------------------------------- Correctly classified 69.32% --------------------------------------------------
Table 4.6, page 113.
quietly logit lfp k5 k618 age wc hc lwg inc fitstat Measures of Fit for logit of lfp Log-Lik Intercept Only: -514.873 Log-Lik Full Model: -452.633 D(745): 905.266 LR(7): 124.480 Prob > LR: 0.000 McFadden's R2: 0.121 McFadden's Adj R2: 0.105 Maximum Likelihood R2: 0.152 Cragg & Uhler's R2: 0.204 McKelvey and Zavoina's R2: 0.217 Efron's R2: 0.155 Variance of y*: 4.203 Variance of error: 3.290 Count R2: 0.693 Adj Count R2: 0.289 AIC: 1.223 AIC*n: 921.266 BIC: -4029.663 BIC': -78.112 quietly logit lfp k5 age age2 wc inc fitstat Measures of Fit for logit of lfp Log-Lik Intercept Only: -514.873 Log-Lik Full Model: -461.653 D(747): 923.306 LR(5): 106.441 Prob > LR: 0.000 McFadden's R2: 0.103 McFadden's Adj R2: 0.092 Maximum Likelihood R2: 0.132 Cragg & Uhler's R2: 0.177 McKelvey and Zavoina's R2: 0.182 Efron's R2: 0.135 Variance of y*: 4.023 Variance of error: 3.290 Count R2: 0.677 Adj Count R2: 0.252 AIC: 1.242 AIC*n: 935.306 BIC: -4024.871 BIC': -73.321