------------------------------------------------------------------------------------------------------------------------------- name: log: c:\acdbookrevision\stata_final_programs_2013\racd03.txt log type: text opened on: 14 Jan 2013, 20:38:41 . . ********** OVERVIEW OF racd03.do ********** . . * STATA Program . * copyright C 2013 by A. Colin Cameron and Pravin K. Trivedi . * used for "Regression Analyis of Count Data" SECOND EDITION . * by A. Colin Cameron and Pravin K. Trivedi (2013) . * Cambridge University Press . . * Chapter 3 . * 3.2 POISSON REGRESSION WITH VARIOUS STANDARD ERRORS . * 3.3 NEGATIVE BINOMIAL WITH VARIOUS STANDARD ERRORS . * 3.4 OVERDISPERSION TESTS . * 3.5 MARGINAL EFFECTS AFTER POISSON . * 3.7 OTHER MODELS . * The bootstraps are commented out to speed up execution time. . . * To run you need file . * racd03data.dta . * The included output also inlcued output from user-written Stata addon countfit . . ********** SETUP ********** . . set more off . version 12 . clear all . * set linesize 82 . set scheme s1mono /* Graphics scheme */ . . ********** DATA DESCRIPTION . . * The data set racd3data.dta is the same data as originally used in . * (1) A.C. Cameron and P.K. Trivedi (1986), "Econometric Models Based on . * Count Data: Comparisons and Applications of Some Estimators and Tests", . * Journal of Applied Econometrics, Vol. 1, pp. 29-54. . * and in other papers. . . * This data is not a representative sample of Australians as it oversamples . * young and old. In particular, use of health services may be overstated. . * This is because while the original sample of 40,650 individuals . * from the 1977-78 Australian Health Survey is representative, . * the sample used here is restricted to single people over 18 years of age. . . * See the R.E.Stud. (1988, pp.85-106) section 3 for more detailed . * discussion of the data than that given in the RACD book. . * Also see racd03makedata.do for further details . . ********** 3.2 READ DATA AND SUMMARIZE . . use racd03data.dta, clear . . *** TABLE 3.1: FREQUENCIES . . * Tabulate counts of doctor visits . tabulate DVISITS Number of | doctor (or | specialist) | visits in | past 2 | weeks | Freq. Percent Cum. ------------+----------------------------------- 0 | 4,141 79.79 79.79 1 | 782 15.07 94.86 2 | 174 3.35 98.21 3 | 30 0.58 98.79 4 | 24 0.46 99.25 5 | 9 0.17 99.42 6 | 12 0.23 99.65 7 | 12 0.23 99.88 8 | 5 0.10 99.98 9 | 1 0.02 100.00 ------------+----------------------------------- Total | 5,190 100.00 . . *** TABLE 3.2: VARIABLE DEFINITIONS AND SUMMARY STATISTICS . . * Variable descriptions and summary statistics . describe Contains data from racd03data.dta obs: 5,190 vars: 20 21 Jun 2011 11:27 size: 415,200 ------------------------------------------------------------------------------------------------------------------------------- storage display value variable name type format label variable label ------------------------------------------------------------------------------------------------------------------------------- SEX float %9.0g Equals 1 if female AGE float %9.0g Age in years divided by 100 (midpoint of 10 age groups) AGESQ float %9.0g AGE squared INCOME float %9.0g Annual income in tens of thousands of dollars LEVYPLUS float %9.0g Equals if private insurance FREEPOOR float %9.0g Equals 1 if free government insurance due to low income FREEREPA float %9.0g Equals 1 if free government insurance due to old-age, disability or veteran stat ILLNESS float %9.0g Number of illnesses in past 2 weeks ACTDAYS float %9.0g Number of days of reduced activity in past two weeks due to illness or injury HSCORE float %9.0g General health questionnaire score using Goldberg's method (High score bad hlth) CHCOND1 float %9.0g Equals 1 if chronic condition(s) but not limited in activity, 0 other CHCOND2 float %9.0g Equals 1 if chronic condition(s) and limited in activity, 0 otherwise DVISITS float %9.0g Number of doctor (or specialist) visits in past 2 weeks NONDOCCO float %9.0g Number of consultations with non-doctor health professionals HOSPADMI float %9.0g Number of hospital admissions in the past 12 months HOSPDAYS float %9.0g Number of nights in a hospital, etc. during most recent admission (mid-range) MEDICINE float %9.0g Number of prescribed/ nonprescribed medications in past 2 days PRESCRIB float %9.0g Number of prescribed medications used in past 2 days NONPRESC float %9.0g Number of nonprescribed medications used in past 2 days CONSTANT float %9.0g ------------------------------------------------------------------------------------------------------------------------------- Sorted by: . summarize Variable | Obs Mean Std. Dev. Min Max -------------+-------------------------------------------------------- SEX | 5190 .5206166 .4996229 0 1 AGE | 5190 .4063854 .2047818 .19 .72 AGESQ | 5190 .2070766 .1856365 .0361 .5184 INCOME | 5190 .5831599 .3689067 0 1.5 LEVYPLUS | 5190 .4427746 .4967623 0 1 -------------+-------------------------------------------------------- FREEPOOR | 5190 .0427746 .202368 0 1 FREEREPA | 5190 .2102119 .4074983 0 1 ILLNESS | 5190 1.431985 1.384152 0 5 ACTDAYS | 5190 .8618497 2.887628 0 14 HSCORE | 5190 1.217534 2.124266 0 12 -------------+-------------------------------------------------------- CHCOND1 | 5190 .4030829 .4905644 0 1 CHCOND2 | 5190 .1165703 .3209385 0 1 DVISITS | 5190 .3017341 .7981338 0 9 NONDOCCO | 5190 .2146435 .9652756 0 11 HOSPADMI | 5190 .1736031 .5075236 0 5 -------------+-------------------------------------------------------- HOSPDAYS | 5190 1.333719 6.120081 0 80 MEDICINE | 5190 1.218304 1.556643 0 8 PRESCRIB | 5190 .8626204 1.415375 0 8 NONPRESC | 5190 .355684 .712389 0 8 CONSTANT | 5190 1 0 1 1 . . * Global for the regressors . global XLIST SEX AGE AGESQ INCOME LEVYPLUS FREEPOOR FREEREPA ILLNESS /// > ACTDAYS HSCORE CHCOND1 CHCOND2 . . ********** 3.2 POISSON REGRESSION WITH VARIOUS STANDARD ERRORS . . *** POISSON MLE and QMLE . . * Poisson Robust standard errors . poisson DVISITS $XLIST, vce(robust) Iteration 0: log pseudolikelihood = -4923.1976 Iteration 1: log pseudolikelihood = -3890.2934 Iteration 2: log pseudolikelihood = -3356.8559 Iteration 3: log pseudolikelihood = -3355.5431 Iteration 4: log pseudolikelihood = -3355.5413 Iteration 5: log pseudolikelihood = -3355.5413 Poisson regression Number of obs = 5190 Wald chi2(12) = 964.02 Prob > chi2 = 0.0000 Log pseudolikelihood = -3355.5413 Pseudo R2 = 0.1576 ------------------------------------------------------------------------------ | Robust DVISITS | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- SEX | .156882 .0792209 1.98 0.048 .0016118 .3121522 AGE | 1.056299 1.364474 0.77 0.439 -1.618021 3.73062 AGESQ | -.8487041 1.459683 -0.58 0.561 -3.709631 2.012223 INCOME | -.2053206 .1292572 -1.59 0.112 -.45866 .0480188 LEVYPLUS | .1231854 .0951652 1.29 0.196 -.0633348 .3097057 FREEPOOR | -.4400609 .2900225 -1.52 0.129 -1.008494 .1283726 FREEREPA | .0797984 .1257953 0.63 0.526 -.1667558 .3263527 ILLNESS | .1869484 .0239387 7.81 0.000 .1400295 .2338674 ACTDAYS | .1268465 .0077698 16.33 0.000 .1116179 .142075 HSCORE | .030081 .0142359 2.11 0.035 .0021791 .0579829 CHCOND1 | .1140853 .0908541 1.26 0.209 -.0639854 .2921561 CHCOND2 | .1411583 .1227226 1.15 0.250 -.0993737 .3816902 _cons | -2.223848 .2544567 -8.74 0.000 -2.722574 -1.725122 ------------------------------------------------------------------------------ . estimates store PRobust . . * The following GLM command gives the same . glm DVISITS $XLIST, family(poisson) link(log) vce(robust) Iteration 0: log pseudolikelihood = -3652.9281 Iteration 1: log pseudolikelihood = -3358.3637 Iteration 2: log pseudolikelihood = -3355.5441 Iteration 3: log pseudolikelihood = -3355.5413 Iteration 4: log pseudolikelihood = -3355.5413 Generalized linear models No. of obs = 5190 Optimization : ML Residual df = 5177 Scale parameter = 1 Deviance = 4379.515095 (1/df) Deviance = .8459562 Pearson = 6873.982244 (1/df) Pearson = 1.327793 Variance function: V(u) = u [Poisson] Link function : g(u) = ln(u) [Log] AIC = 1.298089 Log pseudolikelihood = -3355.541345 BIC = -39907.07 ------------------------------------------------------------------------------ | Robust DVISITS | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- SEX | .156882 .0792209 1.98 0.048 .0016118 .3121522 AGE | 1.056299 1.364474 0.77 0.439 -1.618021 3.73062 AGESQ | -.8487041 1.459683 -0.58 0.561 -3.709631 2.012223 INCOME | -.2053206 .1292572 -1.59 0.112 -.45866 .0480188 LEVYPLUS | .1231854 .0951652 1.29 0.196 -.0633348 .3097057 FREEPOOR | -.4400609 .2900225 -1.52 0.129 -1.008494 .1283726 FREEREPA | .0797984 .1257953 0.63 0.526 -.1667558 .3263527 ILLNESS | .1869484 .0239387 7.81 0.000 .1400295 .2338674 ACTDAYS | .1268465 .0077698 16.33 0.000 .1116179 .142075 HSCORE | .030081 .0142359 2.11 0.035 .0021791 .0579829 CHCOND1 | .1140853 .0908541 1.26 0.209 -.0639854 .2921561 CHCOND2 | .1411583 .1227226 1.15 0.250 -.0993737 .3816902 _cons | -2.223848 .2544567 -8.74 0.000 -2.722574 -1.725122 ------------------------------------------------------------------------------ . . * Poisson Bootstrap is asymptotically equivalent . * Comment out to save time . * poisson DVISITS $XLIST, vce(boot, reps(400) seed(10101)) . * estimates store PBoot . . * Poisson Default ml standard errors (Same as vce(oim)) . poisson DVISITS $XLIST Iteration 0: log likelihood = -4923.1976 Iteration 1: log likelihood = -3890.2934 Iteration 2: log likelihood = -3356.8559 Iteration 3: log likelihood = -3355.5431 Iteration 4: log likelihood = -3355.5413 Iteration 5: log likelihood = -3355.5413 Poisson regression Number of obs = 5190 LR chi2(12) = 1255.31 Prob > chi2 = 0.0000 Log likelihood = -3355.5413 Pseudo R2 = 0.1576 ------------------------------------------------------------------------------ DVISITS | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- SEX | .156882 .0561368 2.79 0.005 .0468558 .2669081 AGE | 1.056299 1.000781 1.06 0.291 -.9051946 3.017794 AGESQ | -.8487041 1.077785 -0.79 0.431 -2.961123 1.263715 INCOME | -.2053206 .0883793 -2.32 0.020 -.3785409 -.0321003 LEVYPLUS | .1231854 .0716398 1.72 0.086 -.0172261 .2635969 FREEPOOR | -.4400609 .1798115 -2.45 0.014 -.792485 -.0876369 FREEREPA | .0797984 .0920603 0.87 0.386 -.1006364 .2602333 ILLNESS | .1869484 .0182805 10.23 0.000 .1511192 .2227776 ACTDAYS | .1268465 .005034 25.20 0.000 .1169801 .1367129 HSCORE | .030081 .0100994 2.98 0.003 .0102866 .0498754 CHCOND1 | .1140853 .0666396 1.71 0.087 -.0165258 .2446964 CHCOND2 | .1411583 .0831451 1.70 0.090 -.0218032 .3041197 _cons | -2.223848 .1898161 -11.72 0.000 -2.595881 -1.851815 ------------------------------------------------------------------------------ . estimates store PMLHess . . * The following GLM command gives the same . glm DVISITS $XLIST, family(poisson) link(log) Iteration 0: log likelihood = -3652.9281 Iteration 1: log likelihood = -3358.3637 Iteration 2: log likelihood = -3355.5441 Iteration 3: log likelihood = -3355.5413 Iteration 4: log likelihood = -3355.5413 Generalized linear models No. of obs = 5190 Optimization : ML Residual df = 5177 Scale parameter = 1 Deviance = 4379.515095 (1/df) Deviance = .8459562 Pearson = 6873.982244 (1/df) Pearson = 1.327793 Variance function: V(u) = u [Poisson] Link function : g(u) = ln(u) [Log] AIC = 1.298089 Log likelihood = -3355.541345 BIC = -39907.07 ------------------------------------------------------------------------------ | OIM DVISITS | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- SEX | .156882 .0561368 2.79 0.005 .0468558 .2669081 AGE | 1.056299 1.000781 1.06 0.291 -.9051946 3.017794 AGESQ | -.8487041 1.077785 -0.79 0.431 -2.961123 1.263715 INCOME | -.2053206 .0883793 -2.32 0.020 -.3785409 -.0321003 LEVYPLUS | .1231854 .0716398 1.72 0.086 -.0172261 .2635969 FREEPOOR | -.4400609 .1798115 -2.45 0.014 -.792485 -.0876369 FREEREPA | .0797984 .0920603 0.87 0.386 -.1006364 .2602333 ILLNESS | .1869484 .0182805 10.23 0.000 .1511192 .2227776 ACTDAYS | .1268465 .005034 25.20 0.000 .1169801 .1367129 HSCORE | .030081 .0100994 2.98 0.003 .0102866 .0498754 CHCOND1 | .1140853 .0666396 1.71 0.087 -.0165258 .2446964 CHCOND2 | .1411583 .0831451 1.70 0.090 -.0218032 .3041197 _cons | -2.223848 .1898161 -11.72 0.000 -2.595881 -1.851815 ------------------------------------------------------------------------------ . . * Poisson OPG standard errors . poisson DVISITS $XLIST, vce(opg) Iteration 0: log likelihood = -4923.1976 Iteration 1: log likelihood = -3890.2934 Iteration 2: log likelihood = -3356.8559 Iteration 3: log likelihood = -3355.5431 Iteration 4: log likelihood = -3355.5413 Iteration 5: log likelihood = -3355.5413 Poisson regression Number of obs = 5190 LR chi2(12) = 1255.31 Prob > chi2 = 0.0000 Log likelihood = -3355.5413 Pseudo R2 = 0.1576 ------------------------------------------------------------------------------ | OPG DVISITS | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- SEX | .156882 .0406153 3.86 0.000 .0772774 .2364865 AGE | 1.056299 .7498656 1.41 0.159 -.4134101 2.526009 AGESQ | -.8487041 .8092148 -1.05 0.294 -2.434736 .7373278 INCOME | -.2053206 .061921 -3.32 0.001 -.3266834 -.0839578 LEVYPLUS | .1231854 .0560472 2.20 0.028 .0133349 .2330359 FREEPOOR | -.4400609 .1163511 -3.78 0.000 -.668105 -.2120169 FREEREPA | .0797984 .0700594 1.14 0.255 -.0575154 .2171123 ILLNESS | .1869484 .0141893 13.18 0.000 .1591378 .214759 ACTDAYS | .1268465 .0035073 36.17 0.000 .1199722 .1337207 HSCORE | .030081 .0073544 4.09 0.000 .0156666 .0444954 CHCOND1 | .1140853 .0514849 2.22 0.027 .0131767 .2149939 CHCOND2 | .1411583 .058631 2.41 0.016 .0262436 .256073 _cons | -2.223848 .1443307 -15.41 0.000 -2.506731 -1.940965 ------------------------------------------------------------------------------ . estimates store PMLOPG . . * The following GLM command gives the same . glm DVISITS $XLIST, family(poisson) link(log) vce(opg) Iteration 0: log likelihood = -3652.9281 Iteration 1: log likelihood = -3358.3637 Iteration 2: log likelihood = -3355.5441 Iteration 3: log likelihood = -3355.5413 Iteration 4: log likelihood = -3355.5413 Generalized linear models No. of obs = 5190 Optimization : ML Residual df = 5177 Scale parameter = 1 Deviance = 4379.515095 (1/df) Deviance = .8459562 Pearson = 6873.982244 (1/df) Pearson = 1.327793 Variance function: V(u) = u [Poisson] Link function : g(u) = ln(u) [Log] AIC = 1.298089 Log likelihood = -3355.541345 BIC = -39907.07 ------------------------------------------------------------------------------ | OPG DVISITS | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- SEX | .156882 .0406114 3.86 0.000 .077285 .2364789 AGE | 1.056299 .7497934 1.41 0.159 -.4132685 2.525867 AGESQ | -.8487041 .8091368 -1.05 0.294 -2.434583 .737175 INCOME | -.2053206 .061915 -3.32 0.001 -.3266717 -.0839694 LEVYPLUS | .1231854 .0560418 2.20 0.028 .0133455 .2330254 FREEPOOR | -.4400609 .1163399 -3.78 0.000 -.668083 -.2120388 FREEREPA | .0797984 .0700526 1.14 0.255 -.0575022 .2170991 ILLNESS | .1869484 .014188 13.18 0.000 .1591405 .2147563 ACTDAYS | .1268465 .003507 36.17 0.000 .1199729 .1337201 HSCORE | .030081 .0073537 4.09 0.000 .015668 .044494 CHCOND1 | .1140853 .05148 2.22 0.027 .0131864 .2149842 CHCOND2 | .1411583 .0586254 2.41 0.016 .0262547 .2560619 _cons | -2.223848 .1443168 -15.41 0.000 -2.506704 -1.940993 ------------------------------------------------------------------------------ . . * Poisson NB1 standard errors . glm DVISITS $XLIST, family(poisson) link(log) scale(x2) Iteration 0: log likelihood = -3652.9281 Iteration 1: log likelihood = -3358.3637 Iteration 2: log likelihood = -3355.5441 Iteration 3: log likelihood = -3355.5413 Iteration 4: log likelihood = -3355.5413 Generalized linear models No. of obs = 5190 Optimization : ML Residual df = 5177 Scale parameter = 1 Deviance = 4379.515095 (1/df) Deviance = .8459562 Pearson = 6873.982244 (1/df) Pearson = 1.327793 Variance function: V(u) = u [Poisson] Link function : g(u) = ln(u) [Log] AIC = 1.298089 Log likelihood = -3355.541345 BIC = -39907.07 ------------------------------------------------------------------------------ | OIM DVISITS | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- SEX | .156882 .0646864 2.43 0.015 .030099 .283665 AGE | 1.056299 1.153198 0.92 0.360 -1.203928 3.316527 AGESQ | -.8487041 1.24193 -0.68 0.494 -3.282842 1.585434 INCOME | -.2053206 .1018394 -2.02 0.044 -.4049221 -.0057191 LEVYPLUS | .1231854 .0825505 1.49 0.136 -.0386106 .2849814 FREEPOOR | -.4400609 .2071966 -2.12 0.034 -.8461587 -.0339631 FREEREPA | .0797984 .1060809 0.75 0.452 -.1281164 .2877133 ILLNESS | .1869484 .0210647 8.87 0.000 .1456625 .2282344 ACTDAYS | .1268465 .0058006 21.87 0.000 .1154774 .1382155 HSCORE | .030081 .0116375 2.58 0.010 .0072719 .0528901 CHCOND1 | .1140853 .0767887 1.49 0.137 -.0364177 .2645883 CHCOND2 | .1411583 .095808 1.47 0.141 -.046622 .3289385 _cons | -2.223848 .2187249 -10.17 0.000 -2.652541 -1.795155 ------------------------------------------------------------------------------ (Standard errors scaled using square root of Pearson X2-based dispersion.) . estimates store PNB1 . . * Poisson NB2 standard errors . quietly poisson DVISITS $XLIST . matrix InvHessian = e(V) . matrix b = e(b) . scalar Nobs = e(N) . scalar k = e(k) . predict mu, n . generate terminsum = ((DVISITS - mu)^2 - mu) / (mu^2) . quietly summarize terminsum . scalar alphanb2 = r(sum) / (Nobs-k) . display "alpha for NB2 : " alphanb2 alpha for NB2 : .28644145 . generate NB2weight = mu + alphanb2*mu^2 . matrix accum Vmiddle = $XLIST [pweight = NB2weight] (obs=1932) . matrix VNB2 = InvHessian*Vmiddle*InvHessian . ereturn post b VNB2 . . ** TABLE 3.3: POISSON PMLE WITH NB2 STANDARD ERRORS . . ereturn display ------------------------------------------------------------------------------ | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- DVISITS | SEX | .156882 .0618302 2.54 0.011 .035697 .2780669 AGE | 1.056299 1.111559 0.95 0.342 -1.122316 3.234915 AGESQ | -.8487041 1.21038 -0.70 0.483 -3.221006 1.523598 INCOME | -.2053206 .0960251 -2.14 0.033 -.3935264 -.0171148 LEVYPLUS | .1231854 .0765315 1.61 0.107 -.0268135 .2731843 FREEPOOR | -.4400609 .1876806 -2.34 0.019 -.8079082 -.0722136 FREEREPA | .0797984 .1021836 0.78 0.435 -.1204778 .2800747 ILLNESS | .1869484 .0206126 9.07 0.000 .1465484 .2273485 ACTDAYS | .1268465 .0058892 21.54 0.000 .1153038 .1383892 HSCORE | .030081 .0117875 2.55 0.011 .0069779 .0531841 CHCOND1 | .1140853 .0709159 1.61 0.108 -.0249073 .2530779 CHCOND2 | .1411583 .0922214 1.53 0.126 -.0395924 .321909 _cons | -2.223848 .2069494 -10.75 0.000 -2.629462 -1.818235 ------------------------------------------------------------------------------ . . *** TABLE 3.3: POISSON PMLE WITH DIFFERENT STANDARD ERRORS . . * Most of Table 3.3 (except PNB2 given just above and PBoot ) . estimates table PRobust PMLHess PMLOPG PNB1, b(%9.3f) se(%9.3f) t(%9.2f) -------------------------------------------------------------- Variable | PRobust PMLHess PMLOPG PNB1 -------------+------------------------------------------------ SEX | 0.157 0.157 0.157 0.157 | 0.079 0.056 0.041 0.065 | 1.98 2.79 3.86 2.43 AGE | 1.056 1.056 1.056 1.056 | 1.364 1.001 0.750 1.153 | 0.77 1.06 1.41 0.92 AGESQ | -0.849 -0.849 -0.849 -0.849 | 1.460 1.078 0.809 1.242 | -0.58 -0.79 -1.05 -0.68 INCOME | -0.205 -0.205 -0.205 -0.205 | 0.129 0.088 0.062 0.102 | -1.59 -2.32 -3.32 -2.02 LEVYPLUS | 0.123 0.123 0.123 0.123 | 0.095 0.072 0.056 0.083 | 1.29 1.72 2.20 1.49 FREEPOOR | -0.440 -0.440 -0.440 -0.440 | 0.290 0.180 0.116 0.207 | -1.52 -2.45 -3.78 -2.12 FREEREPA | 0.080 0.080 0.080 0.080 | 0.126 0.092 0.070 0.106 | 0.63 0.87 1.14 0.75 ILLNESS | 0.187 0.187 0.187 0.187 | 0.024 0.018 0.014 0.021 | 7.81 10.23 13.18 8.87 ACTDAYS | 0.127 0.127 0.127 0.127 | 0.008 0.005 0.004 0.006 | 16.33 25.20 36.17 21.87 HSCORE | 0.030 0.030 0.030 0.030 | 0.014 0.010 0.007 0.012 | 2.11 2.98 4.09 2.58 CHCOND1 | 0.114 0.114 0.114 0.114 | 0.091 0.067 0.051 0.077 | 1.26 1.71 2.22 1.49 CHCOND2 | 0.141 0.141 0.141 0.141 | 0.123 0.083 0.059 0.096 | 1.15 1.70 2.41 1.47 _cons | -2.224 -2.224 -2.224 -2.224 | 0.254 0.190 0.144 0.219 | -8.74 -11.72 -15.41 -10.17 -------------------------------------------------------------- legend: b/se/t . * estimates table PRobust PMLHess PMLOPG PNB1 PBoot, b(%9.3f) se(%9.3f) t(%9.2f) . . /* Jackknife takes a long time so commented out. Results are as follows. > poisson DVISITS $XLIST, vce(jackknife) > Poisson regression Number of obs = 5190 > Replications = 5190 > F( 12, 5189) = 77.11 > Prob > F = 0.0000 > Log likelihood = -3355.5413 Pseudo R2 = 0.1576 > ------------------------------------------------------------------------------ > | Jackknife > DVISITS | Coef. Std. Err. t P>|t| [95% Conf. Interval] > -------------+---------------------------------------------------------------- > SEX | .156882 .080145 1.96 0.050 -.000236 .3139999 > AGE | 1.056299 1.380652 0.77 0.444 -1.650361 3.76296 > AGESQ | -.8487041 1.477986 -0.57 0.566 -3.746179 2.048771 > INCOME | -.2053206 .1309306 -1.57 0.117 -.4619997 .0513585 > LEVYPLUS | .1231854 .0961254 1.28 0.200 -.0652609 .3116318 > FREEPOOR | -.4400609 .3139898 -1.40 0.161 -1.055613 .1754914 > FREEREPA | .0797984 .1273904 0.63 0.531 -.1699404 .3295373 > ILLNESS | .1869484 .0242433 7.71 0.000 .1394213 .2344755 > ACTDAYS | .1268465 .0078955 16.07 0.000 .1113679 .142325 > HSCORE | .030081 .0144887 2.08 0.038 .0016771 .058485 > CHCOND1 | .1140853 .0917735 1.24 0.214 -.0658294 .294 > CHCOND2 | .1411583 .1241703 1.14 0.256 -.1022679 .3845844 > _cons | -2.223848 .2569408 -8.66 0.000 -2.72756 -1.720136 > ------------------------------------------------------------------------------ > */ . . * Poisson estimated using Stata ml command . program lfpois 1. version 11 2. args lnf theta1 // theta1=x'b, lnf=lnf(y) 3. tempvar lnyfact mu 4. local y "$ML_y1" // Define y so program more readable 5. generate double `lnyfact' = lnfactorial(`y') 6. generate double `mu' = exp(`theta1') 7. quietly replace `lnf' = -`mu' + `y'*`theta1' - `lnyfact' 8. end . ml model lf lfpois (DVISITS = $XLIST), vce(robust) . ml maximize initial: log pseudolikelihood = -5730.7989 alternative: log pseudolikelihood = -4471.693 rescale: log pseudolikelihood = -4016.0932 Iteration 0: log pseudolikelihood = -4016.0932 Iteration 1: log pseudolikelihood = -3485.72 Iteration 2: log pseudolikelihood = -3356.3275 Iteration 3: log pseudolikelihood = -3355.5416 Iteration 4: log pseudolikelihood = -3355.5413 Number of obs = 5190 Wald chi2(12) = 964.02 Log pseudolikelihood = -3355.5413 Prob > chi2 = 0.0000 ------------------------------------------------------------------------------ | Robust DVISITS | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- SEX | .156882 .0792209 1.98 0.048 .0016118 .3121522 AGE | 1.0563 1.364474 0.77 0.439 -1.61802 3.73062 AGESQ | -.8487049 1.459683 -0.58 0.561 -3.709631 2.012222 INCOME | -.2053207 .1292571 -1.59 0.112 -.45866 .0480186 LEVYPLUS | .1231855 .0951651 1.29 0.196 -.0633347 .3097058 FREEPOOR | -.4400608 .2900224 -1.52 0.129 -1.008494 .1283726 FREEREPA | .0797985 .1257953 0.63 0.526 -.1667557 .3263527 ILLNESS | .1869483 .0239387 7.81 0.000 .1400294 .2338673 ACTDAYS | .1268465 .0077698 16.33 0.000 .1116179 .142075 HSCORE | .030081 .0142359 2.11 0.035 .0021792 .0579829 CHCOND1 | .1140855 .0908541 1.26 0.209 -.0639852 .2921562 CHCOND2 | .1411585 .1227226 1.15 0.250 -.0993734 .3816904 _cons | -2.223848 .2544567 -8.74 0.000 -2.722574 -1.725122 ------------------------------------------------------------------------------ . . /* Following not run to save time but cited in discussion of Table 3.3 > Output is given for the first bootstrap > * Two checks: > * (1) correct standard errors if DVISITS_se observed Coef. > * is close to DVISITS Bootstrap Std. Error > * (2) variablity of the s.e. is DVISITS_se Bootstrap Std. Error > * Poisson Robust sandwich se's > bootstrap _b _se, reps(400) seed(10101): poisson DVISITS $XLIST, vce(robust) > Bootstrap results Number of obs = 5190 > Replications = 400 > ------------------------------------------------------------------------------ > | Observed Bootstrap Normal-based > | Coef. Std. Err. z P>|z| [95% Conf. Interval] > -------------+---------------------------------------------------------------- > DVISITS | > SEX | .156882 .076327 2.06 0.040 .0072839 .30648 > AGE | 1.056299 1.390803 0.76 0.448 -1.669625 3.782224 > AGESQ | -.8487041 1.476844 -0.57 0.566 -3.743264 2.045856 > INCOME | -.2053206 .128924 -1.59 0.111 -.4580069 .0473657 > LEVYPLUS | .1231854 .0998184 1.23 0.217 -.0724551 .3188259 > FREEPOOR | -.4400609 .2932651 -1.50 0.133 -1.01485 .1347281 > FREEREPA | .0797984 .131406 0.61 0.544 -.1777525 .3373494 > ILLNESS | .1869484 .0243491 7.68 0.000 .1392252 .2346717 > ACTDAYS | .1268465 .0079706 15.91 0.000 .1112243 .1424686 > HSCORE | .030081 .0138043 2.18 0.029 .0030251 .0571369 > CHCOND1 | .1140853 .0869783 1.31 0.190 -.0563889 .2845595 > CHCOND2 | .1411583 .1198889 1.18 0.239 -.0938196 .3761362 > _cons | -2.223848 .2705066 -8.22 0.000 -2.754031 -1.693665 > -------------+---------------------------------------------------------------- > DVISITS_se | > SEX | .0792209 .0031799 24.91 0.000 .0729885 .0854534 > AGE | 1.364474 .0778062 17.54 0.000 1.211977 1.516972 > AGESQ | 1.459683 .0716192 20.38 0.000 1.319312 1.600054 > INCOME | .1292572 .0097382 13.27 0.000 .1101707 .1483436 > LEVYPLUS | .0951652 .0047033 20.23 0.000 .0859468 .1043835 > FREEPOOR | .2900225 .0384038 7.55 0.000 .2147525 .3652924 > FREEREPA | .1257953 .0067341 18.68 0.000 .1125967 .1389939 > ILLNESS | .0239387 .0014318 16.72 0.000 .0211323 .026745 > ACTDAYS | .0077698 .0004421 17.58 0.000 .0069034 .0086362 > HSCORE | .0142359 .0008156 17.45 0.000 .0126373 .0158345 > CHCOND1 | .0908541 .0040289 22.55 0.000 .0829577 .0987505 > CHCOND2 | .1227226 .0066592 18.43 0.000 .1096708 .1357744 > _cons | .2544567 .011415 22.29 0.000 .2320838 .2768297 > ------------------------------------------------------------------------------ > * Poisson NB1 se's (assumes variance multiple of the mean) > bootstrap _b _se, reps(400) seed(10101): glm DVISITS $XLIST, family(poisson) link(log) > */ . . ********** 3.3 NEGATIVE BINOMIAL WITH VARIOUS STANDARD ERRORS . . *** NB2 MLE . . * Negbin2 MLE with default standard errors . nbreg DVISITS $XLIST, dispersion(mean) Fitting Poisson model: Iteration 0: log likelihood = -4923.1976 Iteration 1: log likelihood = -3890.2934 Iteration 2: log likelihood = -3356.8559 Iteration 3: log likelihood = -3355.5431 Iteration 4: log likelihood = -3355.5413 Iteration 5: log likelihood = -3355.5413 Fitting constant-only model: Iteration 0: log likelihood = -3657.9344 Iteration 1: log likelihood = -3589.7157 Iteration 2: log likelihood = -3586.0033 Iteration 3: log likelihood = -3585.9916 Iteration 4: log likelihood = -3585.9916 Fitting full model: Iteration 0: log likelihood = -3301.0284 Iteration 1: log likelihood = -3204.6437 Iteration 2: log likelihood = -3198.7794 Iteration 3: log likelihood = -3198.7438 Iteration 4: log likelihood = -3198.7438 Negative binomial regression Number of obs = 5190 LR chi2(12) = 774.50 Dispersion = mean Prob > chi2 = 0.0000 Log likelihood = -3198.7438 Pseudo R2 = 0.1080 ------------------------------------------------------------------------------ DVISITS | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- SEX | .2166435 .0693873 3.12 0.002 .0806469 .3526402 AGE | -.2161581 1.281016 -0.17 0.866 -2.726903 2.294587 AGESQ | .609158 1.406185 0.43 0.665 -2.146914 3.36523 INCOME | -.1422016 .1081902 -1.31 0.189 -.3542504 .0698472 LEVYPLUS | .1180641 .0855379 1.38 0.168 -.0495872 .2857153 FREEPOOR | -.496611 .2068902 -2.40 0.016 -.9021084 -.0911135 FREEREPA | .1449816 .1169489 1.24 0.215 -.084234 .3741971 ILLNESS | .2143414 .0242276 8.85 0.000 .1668561 .2618266 ACTDAYS | .1437537 .007814 18.40 0.000 .1284385 .1590689 HSCORE | .0380601 .0137992 2.76 0.006 .0110142 .065106 CHCOND1 | .099355 .0787023 1.26 0.207 -.0548987 .2536087 CHCOND2 | .190327 .1044087 1.82 0.068 -.0143102 .3949642 _cons | -2.190007 .2335801 -9.38 0.000 -2.647815 -1.732198 -------------+---------------------------------------------------------------- /lnalpha | .0742145 .0956442 -.1132447 .2616737 -------------+---------------------------------------------------------------- alpha | 1.077038 .1030124 .8929321 1.299103 ------------------------------------------------------------------------------ Likelihood-ratio test of alpha=0: chibar2(01) = 313.60 Prob>=chibar2 = 0.000 . estimates store NB2MLHess . . * Negbin2 MLE with robust standard errors . nbreg DVISITS $XLIST, dispersion(mean) vce(robust) Fitting Poisson model: Iteration 0: log pseudolikelihood = -4923.1976 Iteration 1: log pseudolikelihood = -3890.2934 Iteration 2: log pseudolikelihood = -3356.8559 Iteration 3: log pseudolikelihood = -3355.5431 Iteration 4: log pseudolikelihood = -3355.5413 Iteration 5: log pseudolikelihood = -3355.5413 Fitting constant-only model: Iteration 0: log pseudolikelihood = -3657.9344 Iteration 1: log pseudolikelihood = -3589.7157 Iteration 2: log pseudolikelihood = -3586.0033 Iteration 3: log pseudolikelihood = -3585.9916 Iteration 4: log pseudolikelihood = -3585.9916 Fitting full model: Iteration 0: log pseudolikelihood = -3301.0284 Iteration 1: log pseudolikelihood = -3204.6437 Iteration 2: log pseudolikelihood = -3198.7794 Iteration 3: log pseudolikelihood = -3198.7438 Iteration 4: log pseudolikelihood = -3198.7438 Negative binomial regression Number of obs = 5190 Dispersion = mean Wald chi2(12) = 859.34 Log pseudolikelihood = -3198.7438 Prob > chi2 = 0.0000 ------------------------------------------------------------------------------ | Robust DVISITS | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- SEX | .2166435 .0744094 2.91 0.004 .0708037 .3624833 AGE | -.2161581 1.366925 -0.16 0.874 -2.895282 2.462966 AGESQ | .609158 1.473207 0.41 0.679 -2.278275 3.496591 INCOME | -.1422016 .1221171 -1.16 0.244 -.3815467 .0971435 LEVYPLUS | .1180641 .0914323 1.29 0.197 -.06114 .2972681 FREEPOOR | -.496611 .2541404 -1.95 0.051 -.994717 .001495 FREEREPA | .1449816 .1213457 1.19 0.232 -.0928516 .3828147 ILLNESS | .2143414 .0236518 9.06 0.000 .1679846 .2606981 ACTDAYS | .1437537 .0087244 16.48 0.000 .1266542 .1608532 HSCORE | .0380601 .0137203 2.77 0.006 .0111689 .0649514 CHCOND1 | .099355 .0832814 1.19 0.233 -.0638736 .2625835 CHCOND2 | .190327 .1170918 1.63 0.104 -.0391687 .4198228 _cons | -2.190007 .2493685 -8.78 0.000 -2.67876 -1.701253 -------------+---------------------------------------------------------------- /lnalpha | .0742145 .1081377 -.1377315 .2861604 -------------+---------------------------------------------------------------- alpha | 1.077038 .1164684 .8713326 1.331306 ------------------------------------------------------------------------------ . estimates store NB2Robust . . * Negbin2 MLE with OPG standard errors . nbreg DVISITS $XLIST, dispersion(mean) vce(opg) Fitting Poisson model: Iteration 0: log likelihood = -4923.1976 Iteration 1: log likelihood = -3890.2934 Iteration 2: log likelihood = -3356.8559 Iteration 3: log likelihood = -3355.5431 Iteration 4: log likelihood = -3355.5413 Iteration 5: log likelihood = -3355.5413 Fitting constant-only model: Iteration 0: log likelihood = -3657.9344 Iteration 1: log likelihood = -3589.7157 Iteration 2: log likelihood = -3586.0033 Iteration 3: log likelihood = -3585.9916 Iteration 4: log likelihood = -3585.9916 Fitting full model: Iteration 0: log likelihood = -3301.0284 Iteration 1: log likelihood = -3204.6437 Iteration 2: log likelihood = -3198.7794 Iteration 3: log likelihood = -3198.7438 Iteration 4: log likelihood = -3198.7438 Negative binomial regression Number of obs = 5190 LR chi2(12) = 774.50 Dispersion = mean Prob > chi2 = 0.0000 Log likelihood = -3198.7438 Pseudo R2 = 0.1080 ------------------------------------------------------------------------------ | OPG DVISITS | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- SEX | .2166435 .0656017 3.30 0.001 .0880665 .3452206 AGE | -.2161581 1.23418 -0.18 0.861 -2.635107 2.20279 AGESQ | .609158 1.380479 0.44 0.659 -2.096531 3.314847 INCOME | -.1422016 .0976648 -1.46 0.145 -.333621 .0492178 LEVYPLUS | .1180641 .0848782 1.39 0.164 -.0482943 .2844224 FREEPOOR | -.496611 .1750976 -2.84 0.005 -.8397959 -.1534261 FREEREPA | .1449816 .117429 1.23 0.217 -.0851751 .3751383 ILLNESS | .2143414 .0257348 8.33 0.000 .163902 .2647807 ACTDAYS | .1437537 .0074716 19.24 0.000 .1291096 .1583978 HSCORE | .0380601 .0142574 2.67 0.008 .0101161 .0660042 CHCOND1 | .099355 .0766507 1.30 0.195 -.0508777 .2495876 CHCOND2 | .190327 .0948246 2.01 0.045 .0044742 .3761799 _cons | -2.190007 .2224622 -9.84 0.000 -2.626025 -1.753989 -------------+---------------------------------------------------------------- /lnalpha | .0742145 .0914208 -.1049669 .2533959 -------------+---------------------------------------------------------------- alpha | 1.077038 .0984636 .9003543 1.288393 ------------------------------------------------------------------------------ Likelihood-ratio test of alpha=0: chibar2(01) = 313.60 Prob>=chibar2 = 0.000 . estimates store NB2MLOPG . . * Negbin2 MLE with OIM standard errors . nbreg DVISITS $XLIST, dispersion(mean) vce(oim) Fitting Poisson model: Iteration 0: log likelihood = -4923.1976 Iteration 1: log likelihood = -3890.2934 Iteration 2: log likelihood = -3356.8559 Iteration 3: log likelihood = -3355.5431 Iteration 4: log likelihood = -3355.5413 Iteration 5: log likelihood = -3355.5413 Fitting constant-only model: Iteration 0: log likelihood = -3657.9344 Iteration 1: log likelihood = -3589.7157 Iteration 2: log likelihood = -3586.0033 Iteration 3: log likelihood = -3585.9916 Iteration 4: log likelihood = -3585.9916 Fitting full model: Iteration 0: log likelihood = -3301.0284 Iteration 1: log likelihood = -3204.6437 Iteration 2: log likelihood = -3198.7794 Iteration 3: log likelihood = -3198.7438 Iteration 4: log likelihood = -3198.7438 Negative binomial regression Number of obs = 5190 LR chi2(12) = 774.50 Dispersion = mean Prob > chi2 = 0.0000 Log likelihood = -3198.7438 Pseudo R2 = 0.1080 ------------------------------------------------------------------------------ DVISITS | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- SEX | .2166435 .0693873 3.12 0.002 .0806469 .3526402 AGE | -.2161581 1.281016 -0.17 0.866 -2.726903 2.294587 AGESQ | .609158 1.406185 0.43 0.665 -2.146914 3.36523 INCOME | -.1422016 .1081902 -1.31 0.189 -.3542504 .0698472 LEVYPLUS | .1180641 .0855379 1.38 0.168 -.0495872 .2857153 FREEPOOR | -.496611 .2068902 -2.40 0.016 -.9021084 -.0911135 FREEREPA | .1449816 .1169489 1.24 0.215 -.084234 .3741971 ILLNESS | .2143414 .0242276 8.85 0.000 .1668561 .2618266 ACTDAYS | .1437537 .007814 18.40 0.000 .1284385 .1590689 HSCORE | .0380601 .0137992 2.76 0.006 .0110142 .065106 CHCOND1 | .099355 .0787023 1.26 0.207 -.0548987 .2536087 CHCOND2 | .190327 .1044087 1.82 0.068 -.0143102 .3949642 _cons | -2.190007 .2335801 -9.38 0.000 -2.647815 -1.732198 -------------+---------------------------------------------------------------- /lnalpha | .0742145 .0956442 -.1132447 .2616737 -------------+---------------------------------------------------------------- alpha | 1.077038 .1030124 .8929321 1.299103 ------------------------------------------------------------------------------ Likelihood-ratio test of alpha=0: chibar2(01) = 313.60 Prob>=chibar2 = 0.000 . estimates store NB2MLOIM . . * Negbin2 MLE with bootstrap standard errors . * nbreg DVISITS $XLIST, dispersion(mean) vce(boot, reps(400) seed(10101) nodots) . * estimates store NB2Boot . . * Negbin2 MLE with four different ways to estimate standard errors . estimates table NB2Robust NB2MLHess NB2MLOPG NB2MLOIM, b(%9.3f) se -------------------------------------------------------------- Variable | NB2Robust NB2MLHess NB2MLOPG NB2MLOIM -------------+------------------------------------------------ DVISITS | SEX | 0.217 0.217 0.217 0.217 | 0.074 0.069 0.066 0.069 AGE | -0.216 -0.216 -0.216 -0.216 | 1.367 1.281 1.234 1.281 AGESQ | 0.609 0.609 0.609 0.609 | 1.473 1.406 1.380 1.406 INCOME | -0.142 -0.142 -0.142 -0.142 | 0.122 0.108 0.098 0.108 LEVYPLUS | 0.118 0.118 0.118 0.118 | 0.091 0.086 0.085 0.086 FREEPOOR | -0.497 -0.497 -0.497 -0.497 | 0.254 0.207 0.175 0.207 FREEREPA | 0.145 0.145 0.145 0.145 | 0.121 0.117 0.117 0.117 ILLNESS | 0.214 0.214 0.214 0.214 | 0.024 0.024 0.026 0.024 ACTDAYS | 0.144 0.144 0.144 0.144 | 0.009 0.008 0.007 0.008 HSCORE | 0.038 0.038 0.038 0.038 | 0.014 0.014 0.014 0.014 CHCOND1 | 0.099 0.099 0.099 0.099 | 0.083 0.079 0.077 0.079 CHCOND2 | 0.190 0.190 0.190 0.190 | 0.117 0.104 0.095 0.104 _cons | -2.190 -2.190 -2.190 -2.190 | 0.249 0.234 0.222 0.234 -------------+------------------------------------------------ lnalpha | _cons | 0.074 0.074 0.074 0.074 | 0.108 0.096 0.091 0.096 -------------------------------------------------------------- legend: b/se . . * ASIDE: Negbin2 ML estimated using Stata ml command . program lfnb2 1. version 11 2. args lnf theta1 a // theta1=x'b, a=alpha, lnf=lnf(y) 3. tempvar mu 4. local y $ML_y1 // Define y so program more readable 5. generate double `mu' = exp(`theta1') 6. quietly replace `lnf' = lngamma(`y'+(1/`a')) - lngamma((1/`a')) /// > - lnfactorial(`y') - (`y'+(1/`a'))*ln(1+`a'*`mu') /// > + `y'*ln(`a') + `y'*ln(`mu') 7. end . ml model lf lfnb2 (DVISITS = $XLIST) () . ml maximize initial: log likelihood = - (could not be evaluated) feasible: log likelihood = -6593.6234 rescale: log likelihood = -5730.7989 rescale eq: log likelihood = -4016.0931 Iteration 0: log likelihood = -4016.0931 (not concave) Iteration 1: log likelihood = -3910.7963 (not concave) Iteration 2: log likelihood = -3910.7905 (not concave) Iteration 3: log likelihood = -3672.4833 (not concave) Iteration 4: log likelihood = -3630.4662 (not concave) Iteration 5: log likelihood = -3491.1024 (not concave) Iteration 6: log likelihood = -3330.1697 Iteration 7: log likelihood = -3266.3185 Iteration 8: log likelihood = -3206.4172 Iteration 9: log likelihood = -3198.8164 Iteration 10: log likelihood = -3198.7439 Iteration 11: log likelihood = -3198.7438 Number of obs = 5190 Wald chi2(12) = 706.67 Log likelihood = -3198.7438 Prob > chi2 = 0.0000 ------------------------------------------------------------------------------ DVISITS | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- eq1 | SEX | .2166435 .0693873 3.12 0.002 .0806469 .3526402 AGE | -.2161583 1.281016 -0.17 0.866 -2.726903 2.294586 AGESQ | .6091583 1.406185 0.43 0.665 -2.146913 3.365229 INCOME | -.1422016 .1081901 -1.31 0.189 -.3542504 .0698472 LEVYPLUS | .118064 .0855379 1.38 0.168 -.0495872 .2857153 FREEPOOR | -.496611 .2068902 -2.40 0.016 -.9021084 -.0911136 FREEREPA | .1449816 .1169488 1.24 0.215 -.084234 .3741971 ILLNESS | .2143413 .0242276 8.85 0.000 .1668561 .2618266 ACTDAYS | .1437537 .007814 18.40 0.000 .1284386 .1590689 HSCORE | .0380601 .0137992 2.76 0.006 .0110142 .065106 CHCOND1 | .099355 .0787023 1.26 0.207 -.0548987 .2536087 CHCOND2 | .190327 .1044086 1.82 0.068 -.0143102 .3949642 _cons | -2.190007 .2335801 -9.38 0.000 -2.647815 -1.732198 -------------+---------------------------------------------------------------- eq2 | _cons | 1.077037 .1030123 10.46 0.000 .8751365 1.278937 ------------------------------------------------------------------------------ . . *** NB1 MLE . . * Negbin1 MLE with default standard errors . nbreg DVISITS $XLIST, dispersion(constant) Fitting Poisson model: Iteration 0: log likelihood = -4923.1976 Iteration 1: log likelihood = -3890.2934 Iteration 2: log likelihood = -3356.8559 Iteration 3: log likelihood = -3355.5431 Iteration 4: log likelihood = -3355.5413 Iteration 5: log likelihood = -3355.5413 Fitting constant-only model: Iteration 0: log likelihood = -3591.3465 Iteration 1: log likelihood = -3586.0046 Iteration 2: log likelihood = -3585.9916 Iteration 3: log likelihood = -3585.9916 Fitting full model: Iteration 0: log likelihood = -3276.9999 Iteration 1: log likelihood = -3229.3162 Iteration 2: log likelihood = -3226.8706 Iteration 3: log likelihood = -3226.859 Iteration 4: log likelihood = -3226.859 Negative binomial regression Number of obs = 5190 LR chi2(12) = 718.27 Dispersion = constant Prob > chi2 = 0.0000 Log likelihood = -3226.859 Pseudo R2 = 0.1001 ------------------------------------------------------------------------------ DVISITS | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- SEX | .1638501 .0652316 2.51 0.012 .0359984 .2917018 AGE | .2789488 1.160849 0.24 0.810 -1.996273 2.55417 AGESQ | .0205551 1.250843 0.02 0.987 -2.431052 2.472162 INCOME | -.1345763 .1022989 -1.32 0.188 -.3350785 .065926 LEVYPLUS | .2124024 .083491 2.54 0.011 .048763 .3760418 FREEPOOR | -.5375816 .2283607 -2.35 0.019 -.9851604 -.0900028 FREEREPA | .2081484 .1072239 1.94 0.052 -.0020065 .4183033 ILLNESS | .1958316 .0210602 9.30 0.000 .1545543 .2371088 ACTDAYS | .1123215 .0062328 18.02 0.000 .1001054 .1245376 HSCORE | .0357503 .011798 3.03 0.002 .0126267 .0588739 CHCOND1 | .13255 .0765784 1.73 0.083 -.0175408 .2826409 CHCOND2 | .1741327 .0969892 1.80 0.073 -.0159627 .364228 _cons | -2.201653 .22038 -9.99 0.000 -2.63359 -1.769716 -------------+---------------------------------------------------------------- /lndelta | -.7869279 .1036767 -.9901306 -.5837253 -------------+---------------------------------------------------------------- delta | .4552412 .0471979 .3715282 .5578165 ------------------------------------------------------------------------------ Likelihood-ratio test of delta=0: chibar2(01) = 257.36 Prob>=chibar2 = 0.000 . estimates store NB1MLHess . . * Negbin1 MLE with robust standard errors . nbreg DVISITS $XLIST, dispersion(constant) vce(robust) Fitting Poisson model: Iteration 0: log pseudolikelihood = -4923.1976 Iteration 1: log pseudolikelihood = -3890.2934 Iteration 2: log pseudolikelihood = -3356.8559 Iteration 3: log pseudolikelihood = -3355.5431 Iteration 4: log pseudolikelihood = -3355.5413 Iteration 5: log pseudolikelihood = -3355.5413 Fitting constant-only model: Iteration 0: log pseudolikelihood = -3591.3465 Iteration 1: log pseudolikelihood = -3586.0046 Iteration 2: log pseudolikelihood = -3585.9916 Iteration 3: log pseudolikelihood = -3585.9916 Fitting full model: Iteration 0: log pseudolikelihood = -3276.9999 Iteration 1: log pseudolikelihood = -3229.3162 Iteration 2: log pseudolikelihood = -3226.8706 Iteration 3: log pseudolikelihood = -3226.859 Iteration 4: log pseudolikelihood = -3226.859 Negative binomial regression Number of obs = 5190 Dispersion = constant Wald chi2(12) = 871.27 Log pseudolikelihood = -3226.859 Prob > chi2 = 0.0000 ------------------------------------------------------------------------------ | Robust DVISITS | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- SEX | .1638501 .0712176 2.30 0.021 .0242662 .303434 AGE | .2789488 1.208079 0.23 0.817 -2.088842 2.64674 AGESQ | .0205551 1.315093 0.02 0.988 -2.556981 2.598091 INCOME | -.1345763 .1101629 -1.22 0.222 -.3504915 .081339 LEVYPLUS | .2124024 .0843392 2.52 0.012 .0471006 .3777042 FREEPOOR | -.5375816 .2537494 -2.12 0.034 -1.034921 -.0402418 FREEREPA | .2081484 .1131071 1.84 0.066 -.0135375 .4298344 ILLNESS | .1958316 .0218244 8.97 0.000 .1530564 .2386067 ACTDAYS | .1123215 .0073409 15.30 0.000 .0979336 .1267093 HSCORE | .0357503 .0134405 2.66 0.008 .0094074 .0620933 CHCOND1 | .13255 .0797999 1.66 0.097 -.0238548 .2889549 CHCOND2 | .1741327 .1073244 1.62 0.105 -.0362193 .3844846 _cons | -2.201653 .22829 -9.64 0.000 -2.649093 -1.754213 -------------+---------------------------------------------------------------- /lndelta | -.7869279 .125188 -1.032292 -.5415639 -------------+---------------------------------------------------------------- delta | .4552412 .0569908 .3561896 .5818376 ------------------------------------------------------------------------------ . estimates store NB1Robust . . * Negbin1 MLE with OPG standard errors . nbreg DVISITS $XLIST, dispersion(mean) vce(opg) Fitting Poisson model: Iteration 0: log likelihood = -4923.1976 Iteration 1: log likelihood = -3890.2934 Iteration 2: log likelihood = -3356.8559 Iteration 3: log likelihood = -3355.5431 Iteration 4: log likelihood = -3355.5413 Iteration 5: log likelihood = -3355.5413 Fitting constant-only model: Iteration 0: log likelihood = -3657.9344 Iteration 1: log likelihood = -3589.7157 Iteration 2: log likelihood = -3586.0033 Iteration 3: log likelihood = -3585.9916 Iteration 4: log likelihood = -3585.9916 Fitting full model: Iteration 0: log likelihood = -3301.0284 Iteration 1: log likelihood = -3204.6437 Iteration 2: log likelihood = -3198.7794 Iteration 3: log likelihood = -3198.7438 Iteration 4: log likelihood = -3198.7438 Negative binomial regression Number of obs = 5190 LR chi2(12) = 774.50 Dispersion = mean Prob > chi2 = 0.0000 Log likelihood = -3198.7438 Pseudo R2 = 0.1080 ------------------------------------------------------------------------------ | OPG DVISITS | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- SEX | .2166435 .0656017 3.30 0.001 .0880665 .3452206 AGE | -.2161581 1.23418 -0.18 0.861 -2.635107 2.20279 AGESQ | .609158 1.380479 0.44 0.659 -2.096531 3.314847 INCOME | -.1422016 .0976648 -1.46 0.145 -.333621 .0492178 LEVYPLUS | .1180641 .0848782 1.39 0.164 -.0482943 .2844224 FREEPOOR | -.496611 .1750976 -2.84 0.005 -.8397959 -.1534261 FREEREPA | .1449816 .117429 1.23 0.217 -.0851751 .3751383 ILLNESS | .2143414 .0257348 8.33 0.000 .163902 .2647807 ACTDAYS | .1437537 .0074716 19.24 0.000 .1291096 .1583978 HSCORE | .0380601 .0142574 2.67 0.008 .0101161 .0660042 CHCOND1 | .099355 .0766507 1.30 0.195 -.0508777 .2495876 CHCOND2 | .190327 .0948246 2.01 0.045 .0044742 .3761799 _cons | -2.190007 .2224622 -9.84 0.000 -2.626025 -1.753989 -------------+---------------------------------------------------------------- /lnalpha | .0742145 .0914208 -.1049669 .2533959 -------------+---------------------------------------------------------------- alpha | 1.077038 .0984636 .9003543 1.288393 ------------------------------------------------------------------------------ Likelihood-ratio test of alpha=0: chibar2(01) = 313.60 Prob>=chibar2 = 0.000 . estimates store NB1MLOPG . . * Negbin1 MLE with OIM standard errors . nbreg DVISITS $XLIST, dispersion(constant) vce(oim) Fitting Poisson model: Iteration 0: log likelihood = -4923.1976 Iteration 1: log likelihood = -3890.2934 Iteration 2: log likelihood = -3356.8559 Iteration 3: log likelihood = -3355.5431 Iteration 4: log likelihood = -3355.5413 Iteration 5: log likelihood = -3355.5413 Fitting constant-only model: Iteration 0: log likelihood = -3591.3465 Iteration 1: log likelihood = -3586.0046 Iteration 2: log likelihood = -3585.9916 Iteration 3: log likelihood = -3585.9916 Fitting full model: Iteration 0: log likelihood = -3276.9999 Iteration 1: log likelihood = -3229.3162 Iteration 2: log likelihood = -3226.8706 Iteration 3: log likelihood = -3226.859 Iteration 4: log likelihood = -3226.859 Negative binomial regression Number of obs = 5190 LR chi2(12) = 718.27 Dispersion = constant Prob > chi2 = 0.0000 Log likelihood = -3226.859 Pseudo R2 = 0.1001 ------------------------------------------------------------------------------ DVISITS | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- SEX | .1638501 .0652316 2.51 0.012 .0359984 .2917018 AGE | .2789488 1.160849 0.24 0.810 -1.996273 2.55417 AGESQ | .0205551 1.250843 0.02 0.987 -2.431052 2.472162 INCOME | -.1345763 .1022989 -1.32 0.188 -.3350785 .065926 LEVYPLUS | .2124024 .083491 2.54 0.011 .048763 .3760418 FREEPOOR | -.5375816 .2283607 -2.35 0.019 -.9851604 -.0900028 FREEREPA | .2081484 .1072239 1.94 0.052 -.0020065 .4183033 ILLNESS | .1958316 .0210602 9.30 0.000 .1545543 .2371088 ACTDAYS | .1123215 .0062328 18.02 0.000 .1001054 .1245376 HSCORE | .0357503 .011798 3.03 0.002 .0126267 .0588739 CHCOND1 | .13255 .0765784 1.73 0.083 -.0175408 .2826409 CHCOND2 | .1741327 .0969892 1.80 0.073 -.0159627 .364228 _cons | -2.201653 .22038 -9.99 0.000 -2.63359 -1.769716 -------------+---------------------------------------------------------------- /lndelta | -.7869279 .1036767 -.9901306 -.5837253 -------------+---------------------------------------------------------------- delta | .4552412 .0471979 .3715282 .5578165 ------------------------------------------------------------------------------ Likelihood-ratio test of delta=0: chibar2(01) = 257.36 Prob>=chibar2 = 0.000 . estimates store NB1MLOIM . . * Negbin1 MLE with bootstrap standard errors . * nbreg DVISITS $XLIST, dispersion(mean) vce(boot, reps(400) seed(10101) nodots) . * estimates store NB1Boot . . * Negbin2 MLE with four different ways to estimate standard errors . estimates table NB1Robust NB1MLHess NB1MLOPG NB1MLOIM, b(%9.3f) se -------------------------------------------------------------- Variable | NB1Robust NB1MLHess NB1MLOPG NB1MLOIM -------------+------------------------------------------------ DVISITS | SEX | 0.164 0.164 0.217 0.164 | 0.071 0.065 0.066 0.065 AGE | 0.279 0.279 -0.216 0.279 | 1.208 1.161 1.234 1.161 AGESQ | 0.021 0.021 0.609 0.021 | 1.315 1.251 1.380 1.251 INCOME | -0.135 -0.135 -0.142 -0.135 | 0.110 0.102 0.098 0.102 LEVYPLUS | 0.212 0.212 0.118 0.212 | 0.084 0.083 0.085 0.083 FREEPOOR | -0.538 -0.538 -0.497 -0.538 | 0.254 0.228 0.175 0.228 FREEREPA | 0.208 0.208 0.145 0.208 | 0.113 0.107 0.117 0.107 ILLNESS | 0.196 0.196 0.214 0.196 | 0.022 0.021 0.026 0.021 ACTDAYS | 0.112 0.112 0.144 0.112 | 0.007 0.006 0.007 0.006 HSCORE | 0.036 0.036 0.038 0.036 | 0.013 0.012 0.014 0.012 CHCOND1 | 0.133 0.133 0.099 0.133 | 0.080 0.077 0.077 0.077 CHCOND2 | 0.174 0.174 0.190 0.174 | 0.107 0.097 0.095 0.097 _cons | -2.202 -2.202 -2.190 -2.202 | 0.228 0.220 0.222 0.220 -------------+------------------------------------------------ lndelta | _cons | -0.787 -0.787 -0.787 | 0.125 0.104 0.104 -------------+------------------------------------------------ lnalpha | _cons | 0.074 | 0.091 -------------------------------------------------------------- legend: b/se . . *** NB2 QGPMLE . . * Negbin2 QGPMLE estimated using glm (with default log link) . * Use alpha found earlier . display "alpha for NB2 : " alphanb2 alpha for NB2 : .28644145 . global aglm = alphanb2 . . * Negbin2 QGPMLE with Hessian standard errors . glm DVISITS $XLIST, family(nbinomial $aglm) Iteration 0: log likelihood = -3311.6315 Iteration 1: log likelihood = -3254.2516 Iteration 2: log likelihood = -3254.1099 Iteration 3: log likelihood = -3254.1099 Generalized linear models No. of obs = 5190 Optimization : ML Residual df = 5177 Scale parameter = 1 Deviance = 3809.779195 (1/df) Deviance = .7359048 Pearson = 6232.843038 (1/df) Pearson = 1.203949 Variance function: V(u) = u+(.2864)u^2 [Neg. Binomial] Link function : g(u) = ln(u) [Log] AIC = 1.259002 Log likelihood = -3254.109874 BIC = -40476.81 ------------------------------------------------------------------------------ | OIM DVISITS | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- SEX | .1878597 .0607905 3.09 0.002 .0687125 .3070069 AGE | .5112983 1.101468 0.46 0.643 -1.647539 2.670136 AGESQ | -.2272432 1.197255 -0.19 0.849 -2.573821 2.119334 INCOME | -.1737962 .0952024 -1.83 0.068 -.3603894 .012797 LEVYPLUS | .1128012 .0762651 1.48 0.139 -.0366756 .262278 FREEPOOR | -.4605906 .1877967 -2.45 0.014 -.8286654 -.0925158 FREEREPA | .1003907 .1009725 0.99 0.320 -.0975118 .2982932 ILLNESS | .1980457 .0203329 9.74 0.000 .158194 .2378974 ACTDAYS | .1324919 .0058202 22.76 0.000 .1210845 .1438992 HSCORE | .0337695 .0114535 2.95 0.003 .011321 .056218 CHCOND1 | .1038871 .0705455 1.47 0.141 -.0343796 .2421538 CHCOND2 | .1590955 .090503 1.76 0.079 -.0182872 .3364783 _cons | -2.202967 .2050591 -10.74 0.000 -2.604875 -1.801059 ------------------------------------------------------------------------------ . estimates store NB2QGPH . . * Negbin2 QGPMLE with robust standard errors . glm DVISITS $XLIST, family(nbinomial $aglm) vce(robust) Iteration 0: log pseudolikelihood = -3311.6315 Iteration 1: log pseudolikelihood = -3254.2516 Iteration 2: log pseudolikelihood = -3254.1099 Iteration 3: log pseudolikelihood = -3254.1099 Generalized linear models No. of obs = 5190 Optimization : ML Residual df = 5177 Scale parameter = 1 Deviance = 3809.779195 (1/df) Deviance = .7359048 Pearson = 6232.843038 (1/df) Pearson = 1.203949 Variance function: V(u) = u+(.2864)u^2 [Neg. Binomial] Link function : g(u) = ln(u) [Log] AIC = 1.259002 Log pseudolikelihood = -3254.109874 BIC = -40476.81 ------------------------------------------------------------------------------ | Robust DVISITS | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- SEX | .1878597 .0760759 2.47 0.014 .0387536 .3369658 AGE | .5112983 1.362334 0.38 0.707 -2.158826 3.181423 AGESQ | -.2272432 1.458772 -0.16 0.876 -3.086385 2.631898 INCOME | -.1737962 .1258583 -1.38 0.167 -.420474 .0728815 LEVYPLUS | .1128012 .0938866 1.20 0.230 -.0712133 .2968156 FREEPOOR | -.4605906 .2760557 -1.67 0.095 -1.00165 .0804687 FREEREPA | .1003907 .1239757 0.81 0.418 -.1425971 .3433785 ILLNESS | .1980457 .0235064 8.43 0.000 .1519741 .2441174 ACTDAYS | .1324919 .0078727 16.83 0.000 .1170617 .1479221 HSCORE | .0337695 .0138376 2.44 0.015 .0066484 .0608907 CHCOND1 | .1038871 .0873308 1.19 0.234 -.0672781 .2750523 CHCOND2 | .1590955 .1201493 1.32 0.185 -.0763928 .3945839 _cons | -2.202967 .2518036 -8.75 0.000 -2.696493 -1.709441 ------------------------------------------------------------------------------ . estimates store NB2QGPMLE . . * Following with canonical link does not converge . * glm DVISITS $XLIST, family(nbinomial 1) link(nbinomial) difficult . . * ASIDE: Negbin2 QGPMLE using method ML (should be same as glm) . global invaglm = 1/$aglm . program glmnb2 1. version 11 2. args lnf theta1 // theta1=x'b, lnf=lnf(y) 3. tempvar mu 4. local y $ML_y1 // Define y so program more readable 5. generate double `mu' = exp(`theta1') 6. quietly replace `lnf' = - (`y'+$invaglm)*ln(1+$aglm*`mu') + `y'*ln(`mu') 7. end . ml model lf glmnb2 (DVISITS = $XLIST), vce(robust) . ml maximize initial: log pseudolikelihood = -4958.226 alternative: log pseudolikelihood = -3936.3498 rescale: log pseudolikelihood = -3538.1397 Iteration 0: log pseudolikelihood = -3538.1397 Iteration 1: log pseudolikelihood = -3190.1113 Iteration 2: log pseudolikelihood = -2945.7753 Iteration 3: log pseudolikelihood = -2943.9937 Iteration 4: log pseudolikelihood = -2943.9929 Iteration 5: log pseudolikelihood = -2943.9929 Number of obs = 5190 Wald chi2(12) = 982.46 Log pseudolikelihood = -2943.9929 Prob > chi2 = 0.0000 ------------------------------------------------------------------------------ | Robust DVISITS | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- SEX | .1878597 .0760759 2.47 0.014 .0387536 .3369658 AGE | .5112984 1.362334 0.38 0.707 -2.158826 3.181423 AGESQ | -.2272433 1.458772 -0.16 0.876 -3.086385 2.631898 INCOME | -.1737962 .1258583 -1.38 0.167 -.420474 .0728815 LEVYPLUS | .1128012 .0938866 1.20 0.230 -.0712133 .2968156 FREEPOOR | -.4605906 .2760558 -1.67 0.095 -1.00165 .0804687 FREEREPA | .1003907 .1239757 0.81 0.418 -.1425971 .3433785 ILLNESS | .1980457 .0235064 8.43 0.000 .1519741 .2441174 ACTDAYS | .1324919 .0078727 16.83 0.000 .1170617 .1479221 HSCORE | .0337695 .0138376 2.44 0.015 .0066484 .0608907 CHCOND1 | .1038871 .0873308 1.19 0.234 -.0672781 .2750523 CHCOND2 | .1590955 .1201493 1.32 0.185 -.0763928 .3945839 _cons | -2.202967 .2518036 -8.75 0.000 -2.696493 -1.709441 ------------------------------------------------------------------------------ . . estimates table NB2Robust NB2QGPMLE NB2QGPH PRobust, b(%9.3f) se -------------------------------------------------------------- Variable | NB2Robust NB2QGPMLE NB2QGPH PRobust -------------+------------------------------------------------ DVISITS | SEX | 0.217 0.188 0.188 0.157 | 0.074 0.076 0.061 0.079 AGE | -0.216 0.511 0.511 1.056 | 1.367 1.362 1.101 1.364 AGESQ | 0.609 -0.227 -0.227 -0.849 | 1.473 1.459 1.197 1.460 INCOME | -0.142 -0.174 -0.174 -0.205 | 0.122 0.126 0.095 0.129 LEVYPLUS | 0.118 0.113 0.113 0.123 | 0.091 0.094 0.076 0.095 FREEPOOR | -0.497 -0.461 -0.461 -0.440 | 0.254 0.276 0.188 0.290 FREEREPA | 0.145 0.100 0.100 0.080 | 0.121 0.124 0.101 0.126 ILLNESS | 0.214 0.198 0.198 0.187 | 0.024 0.024 0.020 0.024 ACTDAYS | 0.144 0.132 0.132 0.127 | 0.009 0.008 0.006 0.008 HSCORE | 0.038 0.034 0.034 0.030 | 0.014 0.014 0.011 0.014 CHCOND1 | 0.099 0.104 0.104 0.114 | 0.083 0.087 0.071 0.091 CHCOND2 | 0.190 0.159 0.159 0.141 | 0.117 0.120 0.091 0.123 _cons | -2.190 -2.203 -2.203 -2.224 | 0.249 0.252 0.205 0.254 -------------+------------------------------------------------ lnalpha | _cons | 0.074 | 0.108 -------------------------------------------------------------- legend: b/se . . * Aside for the canonical link use instead in program glmnb2 . * generate double `mu' = $invaglm*exp(`theta1')/(1 - exp(`theta1')) . * but this does not converge . . * Following implements QGPPMLE using GMM based on the first-order conditions . gmm ( (DVISITS - exp({b1}*SEX+{b2}*AGE+{b2}*AGESQ+{b3}*INCOME+{b4}*LEVYPLUS /// > +{b5}*FREEPOOR+{b6}*FREEREPA+{b7}*ILLNESS+{b8}*ACTDAYS+{b9}*HSCORE /// > +{b10}*CHCOND1+{b11}*CHCOND2+{b0})) /// > / (1 + alphanb2*exp({b1}*SEX+{b2}*AGE+{b2}*AGESQ+{b3}*INCOME+{b4}*LEVYPLUS /// > +{b5}*FREEPOOR+{b6}*FREEREPA+{b7}*ILLNESS+{b8}*ACTDAYS+{b9}*HSCORE /// > +{b10}*CHCOND1+{b11}*CHCOND2+{b0})) ), instruments($XLIST) onestep Step 1 Iteration 0: GMM criterion Q(b) = .37229303 Iteration 1: GMM criterion Q(b) = .01131616 Iteration 2: GMM criterion Q(b) = .00003869 Iteration 3: GMM criterion Q(b) = 5.412e-06 Iteration 4: GMM criterion Q(b) = 5.406e-06 GMM estimation Number of parameters = 12 Number of moments = 13 Initial weight matrix: Unadjusted Number of obs = 5190 ------------------------------------------------------------------------------ | Robust | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- /b1 | .1876506 .0760512 2.47 0.014 .038593 .3367081 /b2 | .1520978 .1110665 1.37 0.171 -.0655885 .3697841 /b3 | -.1674461 .1224328 -1.37 0.171 -.40741 .0725179 /b4 | .1163823 .0924398 1.26 0.208 -.0647963 .2975609 /b5 | -.4599732 .2753538 -1.67 0.095 -.9996566 .0797103 /b6 | .1052424 .1220778 0.86 0.389 -.1340257 .3445106 /b7 | .197823 .023411 8.45 0.000 .1519383 .2437077 /b8 | .1324823 .00787 16.83 0.000 .1170573 .1479072 /b9 | .0340912 .0137577 2.48 0.013 .0071266 .0610558 /b10 | .1057899 .0862754 1.23 0.220 -.0633068 .2748865 /b11 | .1637277 .116111 1.41 0.159 -.0638457 .3913011 /b0 | -2.142931 .1353147 -15.84 0.000 -2.408142 -1.877719 ------------------------------------------------------------------------------ Instruments for equation 1: SEX AGE AGESQ INCOME LEVYPLUS FREEPOOR FREEREPA ILLNESS ACTDAYS HSCORE CHCOND1 CHCOND2 _cons . . estimates table NB2Robust NB2QGPMLE NB2QGPH PRobust, b(%9.3f) se -------------------------------------------------------------- Variable | NB2Robust NB2QGPMLE NB2QGPH PRobust -------------+------------------------------------------------ DVISITS | SEX | 0.217 0.188 0.188 0.157 | 0.074 0.076 0.061 0.079 AGE | -0.216 0.511 0.511 1.056 | 1.367 1.362 1.101 1.364 AGESQ | 0.609 -0.227 -0.227 -0.849 | 1.473 1.459 1.197 1.460 INCOME | -0.142 -0.174 -0.174 -0.205 | 0.122 0.126 0.095 0.129 LEVYPLUS | 0.118 0.113 0.113 0.123 | 0.091 0.094 0.076 0.095 FREEPOOR | -0.497 -0.461 -0.461 -0.440 | 0.254 0.276 0.188 0.290 FREEREPA | 0.145 0.100 0.100 0.080 | 0.121 0.124 0.101 0.126 ILLNESS | 0.214 0.198 0.198 0.187 | 0.024 0.024 0.020 0.024 ACTDAYS | 0.144 0.132 0.132 0.127 | 0.009 0.008 0.006 0.008 HSCORE | 0.038 0.034 0.034 0.030 | 0.014 0.014 0.011 0.014 CHCOND1 | 0.099 0.104 0.104 0.114 | 0.083 0.087 0.071 0.091 CHCOND2 | 0.190 0.159 0.159 0.141 | 0.117 0.120 0.091 0.123 _cons | -2.190 -2.203 -2.203 -2.224 | 0.249 0.252 0.205 0.254 -------------+------------------------------------------------ lnalpha | _cons | 0.074 | 0.108 -------------------------------------------------------------- legend: b/se . . *** TABLE 3.4: NB2 and NB1 MODEL ESTIMATORS AND STANDARD ERRORS . . estimates table NB2Robust NB2QGPMLE NB1Robust PRobust, b(%9.3f) se -------------------------------------------------------------- Variable | NB2Robust NB2QGPMLE NB1Robust PRobust -------------+------------------------------------------------ DVISITS | SEX | 0.217 0.188 0.164 0.157 | 0.074 0.076 0.071 0.079 AGE | -0.216 0.511 0.279 1.056 | 1.367 1.362 1.208 1.364 AGESQ | 0.609 -0.227 0.021 -0.849 | 1.473 1.459 1.315 1.460 INCOME | -0.142 -0.174 -0.135 -0.205 | 0.122 0.126 0.110 0.129 LEVYPLUS | 0.118 0.113 0.212 0.123 | 0.091 0.094 0.084 0.095 FREEPOOR | -0.497 -0.461 -0.538 -0.440 | 0.254 0.276 0.254 0.290 FREEREPA | 0.145 0.100 0.208 0.080 | 0.121 0.124 0.113 0.126 ILLNESS | 0.214 0.198 0.196 0.187 | 0.024 0.024 0.022 0.024 ACTDAYS | 0.144 0.132 0.112 0.127 | 0.009 0.008 0.007 0.008 HSCORE | 0.038 0.034 0.036 0.030 | 0.014 0.014 0.013 0.014 CHCOND1 | 0.099 0.104 0.133 0.114 | 0.083 0.087 0.080 0.091 CHCOND2 | 0.190 0.159 0.174 0.141 | 0.117 0.120 0.107 0.123 _cons | -2.190 -2.203 -2.202 -2.224 | 0.249 0.252 0.228 0.254 -------------+------------------------------------------------ lnalpha | _cons | 0.074 | 0.108 -------------+------------------------------------------------ lndelta | _cons | -0.787 | 0.125 -------------------------------------------------------------- legend: b/se . . /* Following not run to save time but cited in discussion of Table 3.4 > * Two checks: > * (1) correct standard errors if DVISITS_se observed Coef. > * is close to DVISITS Bootstrap Std. Error > * (2) variablity of the s.e. is DVISITS_se Bootstrap Std. Error > * NB2 Robust sandwich se's > bootstrap _b _se, reps(400) seed(10101): nbreg DVISITS $XLIST, dispersion(mean) vce(robust) > * NB2 default se's > bootstrap _b _se, reps(400) seed(10101): nbreg DVISITS $XLIST, dispersion(mean) > */ . . *** FIGURE 3.1 . . * The following creates Figure 3.1 manually . * where the predicted probabilities come from . * Average Predicted probabilities for y = 0, 1, ... , 10 . * countfit DVISITS, maxcount(10) prm nograph noestimates nofit . * countfit DVISITS, maxcount(10) nbreg nograph noestimates nofit . * countfit DVISITS $XLIST, maxcount(10) prm nograph noestimates nofit . * countfit DVISITS $XLIST, maxcount(10) nbreg nograph noestimates nofit . clear . input count sample poissintonly nb2intonly poissreg nb2reg count sample poissin~y nb2into~y poissreg nb2reg 1. 0 .7979 .7395347 .8011167 .7733644 .803997 2. 1 .1507 .2231428 .1343514 .1788264 .1398705 3. 2 .0335 .0336649 .0411049 .0323732 .032438 4. 3 .0058 .0033859 .0144702 .0087688 .0104049 5. 4 .0046 .0002554 .0054274 .0036505 .004566 6. 5 .0017 .0000154 .0021107 .0017036 .0025236 7. 6 .0023 .0000008 .0008403 .0007746 .0016031 8. 7 .0023 .0000000 .0003401 .0003316 .0011016 9. 8 .0010 .0000000 .0001393 .0001325 .0007925 10. 9 .0002 .0000000 .0000576 .0000494 .0005869 11. end . label variable sample "Number of doctor visits" . label variable sample "Sample frequency" . label variable poissintonly "Poisson no regressors" . label variable nb2intonly "NB2 no regressors" . label variable poissreg "Poisson with regressors" . label variable nb2reg "NB2 with regressors" . drop if count > 4 (5 observations deleted) . set scheme s1mono . graph bar (mean) sample poissintonly poissreg, over(count) /// > saving(racd03graph1, replace) ytitle("Sample and predicted frequencies") /// > legend( ring(0) rows(3) pos(3) label(1 "Sample frequency") /// > label(2 "Poisson no regressors") label(3 "Poisson with regressors") ) (file racd03graph1.gph saved) . graph bar (mean) sample nb2intonly nb2reg, over(count) /// > saving(racd03graph2, replace) ytitle("Sample and predicted frequencies") /// > legend( ring(0) rows(3) pos(3) label(1 "Sample frequency") /// > label(2 "NB2 no regressors") label(3 "NB2 with regressors") ) (file racd03graph2.gph saved) . graph combine racd03graph1.gph racd03graph2.gph, iscale(0.9) ysize(3) xsize(6) . graph export racd03fig1.eps, replace (file racd03fig1.eps written in EPS format) . graph export racd03fig1.wmf, replace (file c:\acdbookrevision\stata_final_programs_2013\racd03fig1.wmf written in Windows Metafile format) . use racd03data.dta, replace . . ********** 3.3.6 SIMULATION . . * From Cameron and Trivedi (1986) NB with mean mu and variance mu + a*mu^j . * is generated from Poisson(xgamma) where . * xgamma is gamma with mean mu and variance alpha*mu^j . * Since rgamma(a,b) yields gamma with mean ab and variance ab^2 . * we need rgamma(mu^(2-j)/a, a*mu^(j-1)) . . * Test that code works with mu=2 and a=2 . * Should yield NB2 with mean 3 and variance 3 + 2*3^2 = 21 . * and NB1 with meam 3 and variance 3 + 2*3 = 9 . clear . set seed 10101 . set obs 100000 obs was 0, now 100000 . generate mu = 3 . scalar a = 2 . * NB2 has variance mu + a*mu^2 so set j = 2 . generate gammaNB2 = rgamma(1/a, a*mu) . generate xNB2 = rpoisson(gammaNB2) (43 missing values generated) . * NB1 has variance j + a*mu^2 so set j = 1 . generate gammaNB1 = rgamma(mu/a, a) . generate xNB1 = rpoisson(gammaNB1) . tabstat xNB2 xNB1, stat(mean var min max) col(stat) variable | mean variance min max -------------+---------------------------------------- xNB2 | 2.994208 20.80347 0 56 xNB1 | 2.99792 8.941825 0 32 ------------------------------------------------------ . . *** Generate Poisson, NB1 and NB2 with n = 10,000 . clear . set obs 10000 obs was 0, now 10000 . set seed 10101 . generate x = runiform() . scalar a = 2 . generate mu = exp(0 + 2*x) . generate yP = rpoisson(mu) . generate gammaNB2 = rgamma(1/a, a*mu) . generate yNB2 = rpoisson(gammaNB2) (3 missing values generated) . generate gammaNB1 = rgamma(mu/a, a) . generate yNB1 = rpoisson(gammaNB1) . summarize x mu gammaNB2 gammaNB1 yP yNB2 yNB1 Variable | Obs Mean Std. Dev. Min Max -------------+-------------------------------------------------------- x | 10000 .4987486 .2886023 .0001192 .9998879 mu | 10000 3.185981 1.782515 1.000238 7.3874 gammaNB2 | 10000 3.169733 5.573155 1.51e-07 87.29626 gammaNB1 | 10000 3.199752 3.076172 1.33e-06 23.13055 yP | 10000 3.1821 2.497632 0 16 -------------+-------------------------------------------------------- yNB2 | 9997 3.204861 5.93189 0 102 yNB1 | 10000 3.1984 3.520835 0 27 . . * POISSON regressions - with P, NB1 and NB2 as dgp . * All should be consistent . poisson yP x, vce(robust) Iteration 0: log pseudolikelihood = -18640.465 Iteration 1: log pseudolikelihood = -18640.46 Iteration 2: log pseudolikelihood = -18640.46 Poisson regression Number of obs = 10000 Wald chi2(1) = 8606.40 Prob > chi2 = 0.0000 Log pseudolikelihood = -18640.46 Pseudo R2 = 0.2018 ------------------------------------------------------------------------------ | Robust yP | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- x | 1.975465 .0212941 92.77 0.000 1.93373 2.017201 _cons | .014833 .0149929 0.99 0.322 -.0145525 .0442186 ------------------------------------------------------------------------------ . estimates store P_Prob . poisson yNB1 x, vce(robust) Iteration 0: log pseudolikelihood = -24982.318 Iteration 1: log pseudolikelihood = -24982.312 Iteration 2: log pseudolikelihood = -24982.312 Poisson regression Number of obs = 10000 Wald chi2(1) = 2930.24 Prob > chi2 = 0.0000 Log pseudolikelihood = -24982.312 Pseudo R2 = 0.1595 ------------------------------------------------------------------------------ | Robust yNB1 | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- x | 1.976713 .0365167 54.13 0.000 1.905141 2.048284 _cons | .0191272 .0258091 0.74 0.459 -.0314577 .0697121 ------------------------------------------------------------------------------ . estimates store NB1_Prob . poisson yNB2 x, vce(robust) Iteration 0: log pseudolikelihood = -37654.621 Iteration 1: log pseudolikelihood = -37654.614 Iteration 2: log pseudolikelihood = -37654.614 Poisson regression Number of obs = 9997 Wald chi2(1) = 1057.75 Prob > chi2 = 0.0000 Log pseudolikelihood = -37654.614 Pseudo R2 = 0.1161 ------------------------------------------------------------------------------ | Robust yNB2 | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- x | 2.021443 .0621542 32.52 0.000 1.899623 2.143262 _cons | -.0082794 .0368711 -0.22 0.822 -.0805454 .0639866 ------------------------------------------------------------------------------ . estimates store NB2_Prob . . * NB2 regressions - with NB1 and NB2 as dgp . * Note that do not estimate for Poisson dgp since half the time generated Poisson . * will be underdispersed and cannot use NB2 then . * All should be consistent but check standard errors . nbreg yNB1 x Fitting Poisson model: Iteration 0: log likelihood = -24982.318 Iteration 1: log likelihood = -24982.312 Iteration 2: log likelihood = -24982.312 Fitting constant-only model: Iteration 0: log likelihood = -23048.372 Iteration 1: log likelihood = -23048.257 Iteration 2: log likelihood = -23048.257 Fitting full model: Iteration 0: log likelihood = -21963.512 Iteration 1: log likelihood = -21693.676 Iteration 2: log likelihood = -21666.46 Iteration 3: log likelihood = -21666.353 Iteration 4: log likelihood = -21666.353 Negative binomial regression Number of obs = 10000 LR chi2(1) = 2763.81 Dispersion = mean Prob > chi2 = 0.0000 Log likelihood = -21666.353 Pseudo R2 = 0.0600 ------------------------------------------------------------------------------ yNB1 | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- x | 1.980886 .035352 56.03 0.000 1.911597 2.050174 _cons | .0166931 .0221209 0.75 0.450 -.0266631 .0600493 -------------+---------------------------------------------------------------- /lnalpha | -.5099326 .0254761 -.5598648 -.4600004 -------------+---------------------------------------------------------------- alpha | .6005361 .0152993 .5712863 .6312834 ------------------------------------------------------------------------------ Likelihood-ratio test of alpha=0: chibar2(01) = 6631.92 Prob>=chibar2 = 0.000 . estimates store NB1_NB2def . nbreg yNB1 x, vce(robust) Fitting Poisson model: Iteration 0: log pseudolikelihood = -24982.318 Iteration 1: log pseudolikelihood = -24982.312 Iteration 2: log pseudolikelihood = -24982.312 Fitting constant-only model: Iteration 0: log pseudolikelihood = -23048.372 Iteration 1: log pseudolikelihood = -23048.257 Iteration 2: log pseudolikelihood = -23048.257 Fitting full model: Iteration 0: log pseudolikelihood = -21963.512 Iteration 1: log pseudolikelihood = -21693.676 Iteration 2: log pseudolikelihood = -21666.46 Iteration 3: log pseudolikelihood = -21666.353 Iteration 4: log pseudolikelihood = -21666.353 Negative binomial regression Number of obs = 10000 Dispersion = mean Wald chi2(1) = 2591.30 Log pseudolikelihood = -21666.353 Prob > chi2 = 0.0000 ------------------------------------------------------------------------------ | Robust yNB1 | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- x | 1.980886 .0389135 50.90 0.000 1.904617 2.057155 _cons | .0166931 .0270345 0.62 0.537 -.0362935 .0696797 -------------+---------------------------------------------------------------- /lnalpha | -.5099326 .0270242 -.562899 -.4569662 -------------+---------------------------------------------------------------- alpha | .6005361 .016229 .5695555 .6332018 ------------------------------------------------------------------------------ . estimates store NB1_NB2rob . nbreg yNB2 x Fitting Poisson model: Iteration 0: log likelihood = -37654.621 Iteration 1: log likelihood = -37654.614 Iteration 2: log likelihood = -37654.614 Fitting constant-only model: Iteration 0: log likelihood = -23059.016 Iteration 1: log likelihood = -21768.085 Iteration 2: log likelihood = -21767.104 Iteration 3: log likelihood = -21767.104 Fitting full model: Iteration 0: log likelihood = -21241.719 Iteration 1: log likelihood = -21153.562 Iteration 2: log likelihood = -21148.774 Iteration 3: log likelihood = -21148.767 Iteration 4: log likelihood = -21148.767 Negative binomial regression Number of obs = 9997 LR chi2(1) = 1236.67 Dispersion = mean Prob > chi2 = 0.0000 Log likelihood = -21148.767 Pseudo R2 = 0.0284 ------------------------------------------------------------------------------ yNB2 | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- x | 2.022014 .0553378 36.54 0.000 1.913554 2.130475 _cons | -.0086253 .0330705 -0.26 0.794 -.0734423 .0561917 -------------+---------------------------------------------------------------- /lnalpha | .732058 .0196341 .6935758 .7705401 -------------+---------------------------------------------------------------- alpha | 2.079355 .0408263 2.000857 2.160933 ------------------------------------------------------------------------------ Likelihood-ratio test of alpha=0: chibar2(01) = 3.3e+04 Prob>=chibar2 = 0.000 . estimates store NB2_NB2def . nbreg yNB2 x, vce(robust) Fitting Poisson model: Iteration 0: log pseudolikelihood = -37654.621 Iteration 1: log pseudolikelihood = -37654.614 Iteration 2: log pseudolikelihood = -37654.614 Fitting constant-only model: Iteration 0: log pseudolikelihood = -23059.016 Iteration 1: log pseudolikelihood = -21768.085 Iteration 2: log pseudolikelihood = -21767.104 Iteration 3: log pseudolikelihood = -21767.104 Fitting full model: Iteration 0: log pseudolikelihood = -21241.719 Iteration 1: log pseudolikelihood = -21153.562 Iteration 2: log pseudolikelihood = -21148.774 Iteration 3: log pseudolikelihood = -21148.767 Iteration 4: log pseudolikelihood = -21148.767 Negative binomial regression Number of obs = 9997 Dispersion = mean Wald chi2(1) = 1271.60 Log pseudolikelihood = -21148.767 Prob > chi2 = 0.0000 ------------------------------------------------------------------------------ | Robust yNB2 | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- x | 2.022014 .0567033 35.66 0.000 1.910878 2.133151 _cons | -.0086253 .0339976 -0.25 0.800 -.0752593 .0580087 -------------+---------------------------------------------------------------- /lnalpha | .732058 .0197124 .6934223 .7706936 -------------+---------------------------------------------------------------- alpha | 2.079355 .0409892 2.00055 2.161265 ------------------------------------------------------------------------------ . estimates store NB2_NB2rob . . * NB1 regressions - with NB1 and NB2 as dgp . * Note that do not estimate for Poisson dgp since half the time generated Poisson . * will be underdispersed and cannot use NB2 then . * All should be consistent but check standard errors . nbreg yNB1 x, dispersion(constant) Fitting Poisson model: Iteration 0: log likelihood = -24982.318 Iteration 1: log likelihood = -24982.312 Iteration 2: log likelihood = -24982.312 Fitting constant-only model: Iteration 0: log likelihood = -24338.833 Iteration 1: log likelihood = -23048.527 Iteration 2: log likelihood = -23048.257 Iteration 3: log likelihood = -23048.257 Fitting full model: Iteration 0: log likelihood = -23048.257 Iteration 1: log likelihood = -22555.301 Iteration 2: log likelihood = -21444.572 Iteration 3: log likelihood = -21399.126 Iteration 4: log likelihood = -21398.976 Iteration 5: log likelihood = -21398.976 Negative binomial regression Number of obs = 10000 LR chi2(1) = 3298.56 Dispersion = constant Prob > chi2 = 0.0000 Log likelihood = -21398.976 Pseudo R2 = 0.0716 ------------------------------------------------------------------------------ yNB1 | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- x | 1.984823 .0334893 59.27 0.000 1.919185 2.050461 _cons | .0138248 .0239108 0.58 0.563 -.0330396 .0606892 -------------+---------------------------------------------------------------- /lndelta | .6632732 .0261172 .6120843 .714462 -------------+---------------------------------------------------------------- delta | 1.941136 .0506971 1.844271 2.043087 ------------------------------------------------------------------------------ Likelihood-ratio test of delta=0: chibar2(01) = 7166.67 Prob>=chibar2 = 0.000 . estimates store NB1_NB1def . nbreg yNB1 x, dispersion(constant) vce(robust) Fitting Poisson model: Iteration 0: log pseudolikelihood = -24982.318 Iteration 1: log pseudolikelihood = -24982.312 Iteration 2: log pseudolikelihood = -24982.312 Fitting constant-only model: Iteration 0: log pseudolikelihood = -24338.833 Iteration 1: log pseudolikelihood = -23048.527 Iteration 2: log pseudolikelihood = -23048.257 Iteration 3: log pseudolikelihood = -23048.257 Fitting full model: Iteration 0: log pseudolikelihood = -23048.257 Iteration 1: log pseudolikelihood = -22555.301 Iteration 2: log pseudolikelihood = -21444.572 Iteration 3: log pseudolikelihood = -21399.126 Iteration 4: log pseudolikelihood = -21398.976 Iteration 5: log pseudolikelihood = -21398.976 Negative binomial regression Number of obs = 10000 Dispersion = constant Wald chi2(1) = 3506.12 Log pseudolikelihood = -21398.976 Prob > chi2 = 0.0000 ------------------------------------------------------------------------------ | Robust yNB1 | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- x | 1.984823 .0335204 59.21 0.000 1.919124 2.050522 _cons | .0138248 .0239094 0.58 0.563 -.0330367 .0606863 -------------+---------------------------------------------------------------- /lndelta | .6632732 .0255088 .6132768 .7132695 -------------+---------------------------------------------------------------- delta | 1.941136 .049516 1.846472 2.040652 ------------------------------------------------------------------------------ . estimates store NB1_NB1rob . nbreg yNB2 x, dispersion(constant) Fitting Poisson model: Iteration 0: log likelihood = -37654.621 Iteration 1: log likelihood = -37654.614 Iteration 2: log likelihood = -37654.614 Fitting constant-only model: Iteration 0: log likelihood = -27995.674 Iteration 1: log likelihood = -22090.287 Iteration 2: log likelihood = -21768.866 Iteration 3: log likelihood = -21767.104 Iteration 4: log likelihood = -21767.104 Fitting full model: Iteration 0: log likelihood = -21767.104 Iteration 1: log likelihood = -21399.375 Iteration 2: log likelihood = -21381.439 Iteration 3: log likelihood = -21381.402 Iteration 4: log likelihood = -21381.402 Negative binomial regression Number of obs = 9997 LR chi2(1) = 771.40 Dispersion = constant Prob > chi2 = 0.0000 Log likelihood = -21381.402 Pseudo R2 = 0.0177 ------------------------------------------------------------------------------ yNB2 | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- x | 1.217482 .0437732 27.81 0.000 1.131688 1.303276 _cons | .4964225 .0306802 16.18 0.000 .4362903 .5565546 -------------+---------------------------------------------------------------- /lndelta | 1.977396 .0251195 1.928162 2.026629 -------------+---------------------------------------------------------------- delta | 7.223905 .1814608 6.876861 7.588462 ------------------------------------------------------------------------------ Likelihood-ratio test of delta=0: chibar2(01) = 3.3e+04 Prob>=chibar2 = 0.000 . estimates store NB2_NB1def . nbreg yNB2 x, dispersion(constant) vce(robust) Fitting Poisson model: Iteration 0: log pseudolikelihood = -37654.621 Iteration 1: log pseudolikelihood = -37654.614 Iteration 2: log pseudolikelihood = -37654.614 Fitting constant-only model: Iteration 0: log pseudolikelihood = -27995.674 Iteration 1: log pseudolikelihood = -22090.287 Iteration 2: log pseudolikelihood = -21768.866 Iteration 3: log pseudolikelihood = -21767.104 Iteration 4: log pseudolikelihood = -21767.104 Fitting full model: Iteration 0: log pseudolikelihood = -21767.104 Iteration 1: log pseudolikelihood = -21399.375 Iteration 2: log pseudolikelihood = -21381.439 Iteration 3: log pseudolikelihood = -21381.402 Iteration 4: log pseudolikelihood = -21381.402 Negative binomial regression Number of obs = 9997 Dispersion = constant Wald chi2(1) = 800.22 Log pseudolikelihood = -21381.402 Prob > chi2 = 0.0000 ------------------------------------------------------------------------------ | Robust yNB2 | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- x | 1.217482 .0430386 28.29 0.000 1.133128 1.301836 _cons | .4964225 .0276706 17.94 0.000 .442189 .5506559 -------------+---------------------------------------------------------------- /lndelta | 1.977396 .0288683 1.920815 2.033976 -------------+---------------------------------------------------------------- delta | 7.223905 .2085418 6.826519 7.644424 ------------------------------------------------------------------------------ . estimates store NB2_NB1rob . . estimates table P_Prob NB1_Prob NB2_Prob, b(%7.4f) se(%7.4f) stats(N ll) stfmt(%9.1f) /// > modelwidth(9) equations(1) title("Poisson with dgp Poisson, NB1, NB2") Poisson with dgp Poisson, NB1, NB2 -------------------------------------------------- Variable | P_Prob NB1_Prob NB2_Prob -------------+------------------------------------ x | 1.9755 1.9767 2.0214 | 0.0213 0.0365 0.0622 _cons | 0.0148 0.0191 -0.0083 | 0.0150 0.0258 0.0369 -------------+------------------------------------ N | 10000 10000 9997 ll | -18640.5 -24982.3 -37654.6 -------------------------------------------------- legend: b/se . estimates table NB1_NB2def NB1_NB2rob NB2_NB2def NB2_NB2rob, b(%7.4f) se(%7.4f) /// > stats(N ll) stfmt(%9.1f) modelwidth(9) equations(1) /// > title("NB2 MLE with dgp NB1, NB2; default, robust se's") NB2 MLE with dgp NB1, NB2; default, robust se's -------------------------------------------------------------- Variable | NB1_NB2~f NB1_NB2~b NB2_NB2~f NB2_NB2~b -------------+------------------------------------------------ #1 | x | 1.9809 1.9809 2.0220 2.0220 | 0.0354 0.0389 0.0553 0.0567 _cons | 0.0167 0.0167 -0.0086 -0.0086 | 0.0221 0.0270 0.0331 0.0340 -------------+------------------------------------------------ lnalpha | _cons | -0.5099 -0.5099 0.7321 0.7321 | 0.0255 0.0270 0.0196 0.0197 -------------+------------------------------------------------ Statistics | N | 10000 10000 9997 9997 ll | -21666.4 -21666.4 -21148.8 -21148.8 -------------------------------------------------------------- legend: b/se . estimates table NB1_NB1def NB1_NB1rob NB2_NB1def NB2_NB1rob, b(%7.4f) se(%7.4f) /// > stats(N ll) stfmt(%9.1f) modelwidth(9) equations(1) /// > title("NB2 MLE with dgp NB1, NB2; default, robust se's") NB2 MLE with dgp NB1, NB2; default, robust se's -------------------------------------------------------------- Variable | NB1_NB1~f NB1_NB1~b NB2_NB1~f NB2_NB1~b -------------+------------------------------------------------ #1 | x | 1.9848 1.9848 1.2175 1.2175 | 0.0335 0.0335 0.0438 0.0430 _cons | 0.0138 0.0138 0.4964 0.4964 | 0.0239 0.0239 0.0307 0.0277 -------------+------------------------------------------------ lndelta | _cons | 0.6633 0.6633 1.9774 1.9774 | 0.0261 0.0255 0.0251 0.0289 -------------+------------------------------------------------ Statistics | N | 10000 10000 9997 9997 ll | -21399.0 -21399.0 -21381.4 -21381.4 -------------------------------------------------------------- legend: b/se . . *** TABLE 3.5: SIMULATION RESULTS (NB1_NB2rob means NB1 dgp and NB2 MLE with robust se's) . . * For alpha goes to earlier command output as here ln(alpha) is given . estimates table NB2_Prob NB2_NB1rob NB2_NB2rob NB1_Prob NB1_NB1rob NB1_NB2rob NB1_NB2def, /// > b(%7.4f) se(%7.4f) stats(N ll) stfmt(%9.1f) modelwidth(9) equations(1) /// > title("NB2 MLE with dgp NB1, NB2; default, robust se's") NB2 MLE with dgp NB1, NB2; default, robust se's -------------------------------------------------------------------------------------------------- Variable | NB2_Prob NB2_NB1~b NB2_NB2~b NB1_Prob NB1_NB1~b NB1_NB2~b NB1_NB2~f -------------+------------------------------------------------------------------------------------ #1 | x | 2.0214 1.2175 2.0220 1.9767 1.9848 1.9809 1.9809 | 0.0622 0.0430 0.0567 0.0365 0.0335 0.0389 0.0354 _cons | -0.0083 0.4964 -0.0086 0.0191 0.0138 0.0167 0.0167 | 0.0369 0.0277 0.0340 0.0258 0.0239 0.0270 0.0221 -------------+------------------------------------------------------------------------------------ lndelta | _cons | 1.9774 0.6633 | 0.0289 0.0255 -------------+------------------------------------------------------------------------------------ lnalpha | _cons | 0.7321 -0.5099 -0.5099 | 0.0197 0.0270 0.0255 -------------+------------------------------------------------------------------------------------ Statistics | N | 9997 9997 9997 10000 10000 10000 10000 ll | -37654.6 -21381.4 -21148.8 -24982.3 -21399.0 -21666.4 -21666.4 -------------------------------------------------------------------------------------------------- legend: b/se . . ********** 3.4 OVERDISPERSION TESTS . . use racd03data.dta, clear . . * Raw overdispersion . quietly summarize DVISITS . display "Overdispersion: variance/ mean ratio is " r(var) " / " r(mean) " = " r(var)/r(mean) Overdispersion: variance/ mean ratio is . / .3017341 = . . . * LR test statistic against NB2 . * Stata command lrtest does not work as LR test is for 2 different model commands . quietly poisson DVISITS $XLIST . scalar llpoisson = e(ll) . quietly nbreg DVISITS $XLIST, dispersion(mean) . scalar llnb2 = e(ll) . display "LR test against NB2 = 2* (" llnb2 " - " llpoisson ") = " 2*(llnb2 - llpoisson) LR test against NB2 = 2* (-3198.7438 - -3355.5413) = 313.59502 . . * LR test statistic against NB1 . quietly nbreg DVISITS $XLIST, dispersion(constant) . scalar llnb1 = e(ll) . display "LR test against NB1 = 2* (" llnb1 " - " llpoisson ") = " 2*(llnb1 - llpoisson) LR test against NB1 = 2* (-3226.859 - -3355.5413) = 257.36473 . . * Wald test against NB2 . * Use output from nbreg DVISITS $XLIST, dispersion(mean) . . * Wald test against NB1 . * Use output from nbreg DVISITS $XLIST, dispersion(constant) . . * LM test against NB2 . capture drop mu . quietly poisson DVISITS $XLIST . predict mu, n . generate ystar = ((DVISITS - mu)^2 - DVISITS) / mu . regress ystar mu, noconstant Source | SS df MS Number of obs = 5190 -------------+------------------------------ F( 1, 5189) = 56.32 Model | 1169.70113 1 1169.70113 Prob > F = 0.0000 Residual | 107770.171 5189 20.7689673 R-squared = 0.0107 -------------+------------------------------ Adj R-squared = 0.0105 Total | 108939.872 5190 20.9903415 Root MSE = 4.5573 ------------------------------------------------------------------------------ ystar | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- mu | .9574298 .1275783 7.50 0.000 .7073225 1.207537 ------------------------------------------------------------------------------ . regress ystar mu, noconstant vce(robust) Linear regression Number of obs = 5190 F( 1, 5189) = 66.48 Prob > F = 0.0000 R-squared = 0.0107 Root MSE = 4.5573 ------------------------------------------------------------------------------ | Robust ystar | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- mu | .9574298 .1174219 8.15 0.000 .7272335 1.187626 ------------------------------------------------------------------------------ . . * LM test against NB1 . regress ystar Source | SS df MS Number of obs = 5190 -------------+------------------------------ F( 0, 5189) = 0.00 Model | 0 0 . Prob > F = . Residual | 108048.49 5189 20.8226037 R-squared = 0.0000 -------------+------------------------------ Adj R-squared = 0.0000 Total | 108048.49 5189 20.8226037 Root MSE = 4.5632 ------------------------------------------------------------------------------ ystar | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- _cons | .4144272 .0633408 6.54 0.000 .2902524 .5386019 ------------------------------------------------------------------------------ . regress ystar, vce(robust) Linear regression Number of obs = 5190 F( 0, 5189) = 0.00 Prob > F = . R-squared = 0.0000 Root MSE = 4.5632 ------------------------------------------------------------------------------ | Robust ystar | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- _cons | .4144272 .0633408 6.54 0.000 .2902524 .5386019 ------------------------------------------------------------------------------ . . ********** 3.6 POISSON MARGINAL EFFECTS AND PREDICTION . . *** Table 3.6 OLS column . * OLS coefficients are OLS marginal effects . regress DVISITS $XLIST, vce(robust) // Table 3.5 OLS column Linear regression Number of obs = 5190 F( 12, 5177) = 23.04 Prob > F = 0.0000 R-squared = 0.2018 Root MSE = .71388 ------------------------------------------------------------------------------ | Robust DVISITS | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- SEX | .033811 .0229929 1.47 0.141 -.0112648 .0788868 AGE | .203201 .4475822 0.45 0.650 -.6742492 1.080651 AGESQ | -.0621028 .5149627 -0.12 0.904 -1.071647 .9474416 INCOME | -.0573227 .0348968 -1.64 0.101 -.1257351 .0110897 LEVYPLUS | .0351789 .0217826 1.61 0.106 -.0075243 .077882 FREEPOOR | -.1033142 .0476909 -2.17 0.030 -.1968086 -.0098198 FREEREPA | .0332409 .043345 0.77 0.443 -.0517336 .1182155 ILLNESS | .0599457 .0099355 6.03 0.000 .0404678 .0794236 ACTDAYS | .1031916 .0097408 10.59 0.000 .0840956 .1222876 HSCORE | .0169765 .0071747 2.37 0.018 .0029111 .0310419 CHCOND1 | .0043844 .0222637 0.20 0.844 -.039262 .0480307 CHCOND2 | .0416174 .0464145 0.90 0.370 -.0493745 .1326094 _cons | .0276322 .0733923 0.38 0.707 -.1162477 .1715121 ------------------------------------------------------------------------------ . . *** Table 3.6 QMLE, AME, MEM and Elast columns . * Poisson marginal effects done the easy way using calculus method . * and ignoring the quadratic in age . poisson DVISITS $XLIST, vce(robust) Iteration 0: log pseudolikelihood = -4923.1976 Iteration 1: log pseudolikelihood = -3890.2934 Iteration 2: log pseudolikelihood = -3356.8559 Iteration 3: log pseudolikelihood = -3355.5431 Iteration 4: log pseudolikelihood = -3355.5413 Iteration 5: log pseudolikelihood = -3355.5413 Poisson regression Number of obs = 5190 Wald chi2(12) = 964.02 Prob > chi2 = 0.0000 Log pseudolikelihood = -3355.5413 Pseudo R2 = 0.1576 ------------------------------------------------------------------------------ | Robust DVISITS | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- SEX | .156882 .0792209 1.98 0.048 .0016118 .3121522 AGE | 1.056299 1.364474 0.77 0.439 -1.618021 3.73062 AGESQ | -.8487041 1.459683 -0.58 0.561 -3.709631 2.012223 INCOME | -.2053206 .1292572 -1.59 0.112 -.45866 .0480188 LEVYPLUS | .1231854 .0951652 1.29 0.196 -.0633348 .3097057 FREEPOOR | -.4400609 .2900225 -1.52 0.129 -1.008494 .1283726 FREEREPA | .0797984 .1257953 0.63 0.526 -.1667558 .3263527 ILLNESS | .1869484 .0239387 7.81 0.000 .1400295 .2338674 ACTDAYS | .1268465 .0077698 16.33 0.000 .1116179 .142075 HSCORE | .030081 .0142359 2.11 0.035 .0021791 .0579829 CHCOND1 | .1140853 .0908541 1.26 0.209 -.0639854 .2921561 CHCOND2 | .1411583 .1227226 1.15 0.250 -.0993737 .3816902 _cons | -2.223848 .2544567 -8.74 0.000 -2.722574 -1.725122 ------------------------------------------------------------------------------ . margins, dydx(*) // Table 3.6 AME column Average marginal effects Number of obs = 5190 Model VCE : Robust Expression : Predicted number of events, predict() dy/dx w.r.t. : SEX AGE AGESQ INCOME LEVYPLUS FREEPOOR FREEREPA ILLNESS ACTDAYS HSCORE CHCOND1 CHCOND2 ------------------------------------------------------------------------------ | Delta-method | dy/dx Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- SEX | .0473366 .024003 1.97 0.049 .0002916 .0943817 AGE | .3187216 .4124949 0.77 0.440 -.4897535 1.127197 AGESQ | -.256083 .4409922 -0.58 0.561 -1.120412 .6082459 INCOME | -.0619522 .0391506 -1.58 0.114 -.138686 .0147816 LEVYPLUS | .0371692 .0285961 1.30 0.194 -.018878 .0932165 FREEPOOR | -.1327814 .0874291 -1.52 0.129 -.3041394 .0385766 FREEREPA | .0240779 .037872 0.64 0.525 -.0501499 .0983057 ILLNESS | .0564087 .007417 7.61 0.000 .0418717 .0709457 ACTDAYS | .0382739 .003007 12.73 0.000 .0323803 .0441675 HSCORE | .0090765 .0042949 2.11 0.035 .0006585 .0174944 CHCOND1 | .0344234 .0273604 1.26 0.208 -.0192019 .0880488 CHCOND2 | .0425923 .0369898 1.15 0.250 -.0299064 .1150909 ------------------------------------------------------------------------------ . margins, dydx(*) atmeans // Table 3.6 MEM column Conditional marginal effects Number of obs = 5190 Model VCE : Robust Expression : Predicted number of events, predict() dy/dx w.r.t. : SEX AGE AGESQ INCOME LEVYPLUS FREEPOOR FREEREPA ILLNESS ACTDAYS HSCORE CHCOND1 CHCOND2 at : SEX = .5206166 (mean) AGE = .4063854 (mean) AGESQ = .2070766 (mean) INCOME = .5831599 (mean) LEVYPLUS = .4427746 (mean) FREEPOOR = .0427746 (mean) FREEREPA = .2102119 (mean) ILLNESS = 1.431985 (mean) ACTDAYS = .8618497 (mean) HSCORE = 1.217534 (mean) CHCOND1 = .4030829 (mean) CHCOND2 = .1165703 (mean) ------------------------------------------------------------------------------ | Delta-method | dy/dx Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- SEX | .0357194 .0180784 1.98 0.048 .0002864 .0711524 AGE | .2405017 .3108328 0.77 0.439 -.3687195 .8497228 AGESQ | -.1932357 .332465 -0.58 0.561 -.844855 .4583836 INCOME | -.0467481 .0294151 -1.59 0.112 -.1044006 .0109045 LEVYPLUS | .0280473 .0215155 1.30 0.192 -.0141224 .0702169 FREEPOOR | -.1001945 .0657527 -1.52 0.128 -.2290675 .0286785 FREEREPA | .0181688 .0285719 0.64 0.525 -.037831 .0741686 ILLNESS | .042565 .0053681 7.93 0.000 .0320437 .0530863 ACTDAYS | .0288808 .0020565 14.04 0.000 .0248501 .0329116 HSCORE | .0068489 .0032296 2.12 0.034 .000519 .0131789 CHCOND1 | .0259753 .0206209 1.26 0.208 -.014441 .0663916 CHCOND2 | .0321394 .0278903 1.15 0.249 -.0225246 .0868034 ------------------------------------------------------------------------------ . margins, eyex(*) // Table 3.5 Elast column Average marginal effects Number of obs = 5190 Model VCE : Robust Expression : Predicted number of events, predict() ey/ex w.r.t. : SEX AGE AGESQ INCOME LEVYPLUS FREEPOOR FREEREPA ILLNESS ACTDAYS HSCORE CHCOND1 CHCOND2 ------------------------------------------------------------------------------ | Delta-method | ey/ex Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- SEX | .0816753 .0412437 1.98 0.048 .0008391 .1625116 AGE | .4292646 .5545024 0.77 0.439 -.6575401 1.516069 AGESQ | -.1757467 .3022662 -0.58 0.561 -.7681777 .4166842 INCOME | -.1197347 .0753776 -1.59 0.112 -.2674721 .0280026 LEVYPLUS | .0545434 .0421367 1.29 0.196 -.0280431 .1371298 FREEPOOR | -.0188234 .0124056 -1.52 0.129 -.0431379 .0054911 FREEREPA | .0167746 .0264437 0.63 0.526 -.0350541 .0686032 ILLNESS | .2677073 .0342798 7.81 0.000 .2005201 .3348945 ACTDAYS | .1093226 .0066964 16.33 0.000 .0961979 .1224473 HSCORE | .0366246 .0173327 2.11 0.035 .0026532 .0705961 CHCOND1 | .0459858 .0366217 1.26 0.209 -.0257914 .1177631 CHCOND2 | .0164549 .0143058 1.15 0.250 -.011584 .0444938 ------------------------------------------------------------------------------ . . * Following discussed in text . * Gives Treatment eEffect for binary regressors . * Gives correct AME and MEM for the quadratic in AGE . poisson DVISITS i.SEX c.AGE##c.AGE c.INCOME i.LEVYPLUS i.FREEPOOR i.FREEREPA /// > c.ILLNESS c.ACTDAYS c.HSCORE i.CHCOND1 i.CHCOND2, vce(robust) Iteration 0: log pseudolikelihood = -4923.1976 Iteration 1: log pseudolikelihood = -3890.2934 Iteration 2: log pseudolikelihood = -3356.8559 Iteration 3: log pseudolikelihood = -3355.5431 Iteration 4: log pseudolikelihood = -3355.5413 Iteration 5: log pseudolikelihood = -3355.5413 Poisson regression Number of obs = 5190 Wald chi2(12) = 964.02 Prob > chi2 = 0.0000 Log pseudolikelihood = -3355.5413 Pseudo R2 = 0.1576 ------------------------------------------------------------------------------ | Robust DVISITS | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- 1.SEX | .156882 .0792209 1.98 0.048 .0016118 .3121522 AGE | 1.056299 1.364474 0.77 0.439 -1.618021 3.730619 | c.AGE#c.AGE | -.8487036 1.459683 -0.58 0.561 -3.70963 2.012222 | INCOME | -.2053206 .1292571 -1.59 0.112 -.4586599 .0480188 1.LEVYPLUS | .1231854 .0951652 1.29 0.196 -.0633348 .3097057 1.FREEPOOR | -.4400609 .2900225 -1.52 0.129 -1.008494 .1283726 1.FREEREPA | .0797984 .1257953 0.63 0.526 -.1667558 .3263527 ILLNESS | .1869484 .0239387 7.81 0.000 .1400295 .2338674 ACTDAYS | .1268465 .0077698 16.33 0.000 .1116179 .142075 HSCORE | .030081 .0142359 2.11 0.035 .0021791 .0579829 1.CHCOND1 | .1140853 .0908541 1.26 0.209 -.0639854 .2921561 1.CHCOND2 | .1411583 .1227226 1.15 0.250 -.0993737 .3816902 _cons | -2.223848 .2544567 -8.74 0.000 -2.722574 -1.725122 ------------------------------------------------------------------------------ . margins, dydx(*) Average marginal effects Number of obs = 5190 Model VCE : Robust Expression : Predicted number of events, predict() dy/dx w.r.t. : 1.SEX AGE INCOME 1.LEVYPLUS 1.FREEPOOR 1.FREEREPA ILLNESS ACTDAYS HSCORE 1.CHCOND1 1.CHCOND2 ------------------------------------------------------------------------------ | Delta-method | dy/dx Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- 1.SEX | .0466044 .0232474 2.00 0.045 .0010403 .0921686 AGE | .0760413 .0649717 1.17 0.242 -.051301 .2033835 INCOME | -.0619522 .0391506 -1.58 0.114 -.138686 .0147816 1.LEVYPLUS | .0375736 .0292403 1.28 0.199 -.0197363 .0948836 1.FREEPOOR | -.1087454 .0577384 -1.88 0.060 -.2219106 .0044198 1.FREEREPA | .0244398 .0390335 0.63 0.531 -.0520644 .100944 ILLNESS | .0564087 .007417 7.61 0.000 .0418717 .0709457 ACTDAYS | .0382739 .003007 12.73 0.000 .0323803 .0441675 HSCORE | .0090765 .0042949 2.11 0.035 .0006585 .0174944 1.CHCOND1 | .0346488 .027731 1.25 0.211 -.019703 .0890005 1.CHCOND2 | .0443413 .0400876 1.11 0.269 -.0342289 .1229115 ------------------------------------------------------------------------------ Note: dy/dx for factor levels is the discrete change from the base level. . margins, dydx(*) atmeans Conditional marginal effects Number of obs = 5190 Model VCE : Robust Expression : Predicted number of events, predict() dy/dx w.r.t. : 1.SEX AGE INCOME 1.LEVYPLUS 1.FREEPOOR 1.FREEREPA ILLNESS ACTDAYS HSCORE 1.CHCOND1 1.CHCOND2 at : 0.SEX = .4793834 (mean) 1.SEX = .5206166 (mean) AGE = .4063854 (mean) INCOME = .5831599 (mean) 0.LEVYPLUS = .5572254 (mean) 1.LEVYPLUS = .4427746 (mean) 0.FREEPOOR = .9572254 (mean) 1.FREEPOOR = .0427746 (mean) 0.FREEREPA = .7897881 (mean) 1.FREEREPA = .2102119 (mean) ILLNESS = 1.431985 (mean) ACTDAYS = .8618497 (mean) HSCORE = 1.217534 (mean) 0.CHCOND1 = .5969171 (mean) 1.CHCOND1 = .4030829 (mean) 0.CHCOND2 = .8834297 (mean) 1.CHCOND2 = .1165703 (mean) ------------------------------------------------------------------------------ | Delta-method | dy/dx Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- 1.SEX | .0369316 .0188214 1.96 0.050 .0000423 .073821 AGE | .0864681 .0675555 1.28 0.201 -.0459382 .2188745 INCOME | -.0484415 .0313139 -1.55 0.122 -.1098156 .0129326 1.LEVYPLUS | .0292874 .0224741 1.30 0.193 -.0147611 .0733358 1.FREEPOOR | -.0855881 .0464512 -1.84 0.065 -.1766308 .0054547 1.FREEREPA | .0192725 .0308851 0.62 0.533 -.0412613 .0798062 ILLNESS | .0441069 .0065024 6.78 0.000 .0313624 .0568515 ACTDAYS | .029927 .0029461 10.16 0.000 .0241527 .0357013 HSCORE | .007097 .0033326 2.13 0.033 .0005652 .0136289 1.CHCOND1 | .0272303 .0216383 1.26 0.208 -.0151799 .0696405 1.CHCOND2 | .035185 .0317665 1.11 0.268 -.0270763 .0974463 ------------------------------------------------------------------------------ Note: dy/dx for factor levels is the discrete change from the base level. . . * Following computes standardized coefficients . * Table 3.6 SSC column . capture drop one . generate one = 1 . matrix accum Cov = $XLIST, deviations noconstant (obs=5190) . quietly sum one . matrix Cov = Cov / (r(N)-1) . matrix Stdev = (vecdiag(cholesky(diag(vecdiag(Cov)))))' . // Need to add back constant as last entry in Stdev to make conformable with b . matrix Stdev = Stdev \ 0 . matrix list Stdev Stdev[13,1] r1 SEX .49962291 AGE .20478182 AGESQ .18563646 INCOME .3689067 LEVYPLUS .49676231 FREEPOOR .20236797 FREEREPA .40749832 ILLNESS 1.3841524 ACTDAYS 2.8876284 HSCORE 2.1242665 CHCOND1 .4905644 CHCOND2 .32093852 r13 0 . quietly poisson DVISITS $XLIST, vce(robust) . matrix b = e(b)' . matrix bstandardized = hadamard(b,Stdev) . matrix list bstandardized // Table 3.6 SSC column bstandardized[13,1] y1 DVISITS:SEX .07838182 DVISITS:AGE .21631093 DVISITS:AGESQ -.15755043 DVISITS:INCOME -.07574414 DVISITS:LEVYPLUS .06119388 DVISITS:FREEPOOR -.08905424 DVISITS:FREEREPA .03251773 DVISITS:ILLNESS .25876512 DVISITS:ACTDAYS .3662855 DVISITS:HSCORE .06390007 DVISITS:CHCOND1 .05596619 DVISITS:CHCOND2 .04530313 DVISITS:_cons 0 . . ********** 3.7 OTHER MODELS . . use racd03data.dta, clear . . * Binary Poisson . generate BINARYVISIT = DVISITS > 0 . tabulate BINARYVISIT BINARYVISIT | Freq. Percent Cum. ------------+----------------------------------- 0 | 4,141 79.79 79.79 1 | 1,049 20.21 100.00 ------------+----------------------------------- Total | 5,190 100.00 . . * Poisson ML program lfpois to be called by command ml method lf . program lfbinarypois 1. version 10.1 2. args lnf theta1 // theta1=x'b, lnf=lnf(y) 3. tempvar lnyfact mu p 4. local y "$ML_y1" // Define y so program more readable 5. generate double `lnyfact' = lnfactorial(`y') 6. generate double `mu' = exp(`theta1') 7. generate double `p' = 1 - exp(-`mu') 8. quietly replace `lnf' = `y'*ln(`p') + ln(1-`p') - `y'*ln(1-`p') 9. end . ml model lf lfbinarypois (BINARYVISIT = $XLIST), vce(robust) . ml check Test 1: Calling lfbinarypois to check if it computes log pseudolikelihood and does not alter coefficient vector... Passed. Test 2: Calling lfbinarypois again to check if the same log pseudolikelihood value is returned... Passed. Test 3: Calling lfbinarypois to check if 1st derivatives are computed... test not relevant for type lf evaluators. Test 4: Calling lfbinarypois again to check if the same 1st derivatives are returned... test not relevant for type lf evaluators. Test 5: Calling lfbinarypois to check if 2nd derivatives are computed... test not relevant for type lf evaluators. Test 6: Calling lfbinarypois again to check if the same 2nd derivatives are returned... test not relevant for type lf evaluators. ------------------------------------------------------------------------------ Searching for alternate values for the coefficient vector to verify that lfbinarypois returns different results when fed a different coefficient vector: Searching... initial: log pseudolikelihood = - (could not be evaluated) searching for feasible values + feasible: log pseudolikelihood = -14886.656 improving initial values .......... improve: log pseudolikelihood = -14886.656 continuing with tests... ------------------------------------------------------------------------------ Test 7: Calling lfbinarypois to check log pseudolikelihood at the new values... Passed. Test 8: Calling lfbinarypois requesting 1st derivatives at the new values... test not relevant for type lf evaluators. Test 9: Calling lfbinarypois requesting 2nd derivatives at the new values... test not relevant for type lf evaluators. ------------------------------------------------------------------------------ lfbinarypois HAS PASSED ALL TESTS ------------------------------------------------------------------------------ Test 10: Does lfbinarypois produce unanticipated output? This is a minor issue. Stata has been running lfbinarypois with all output suppressed. This time Stata will not suppress the output. If you see any unanticipated output, you need to place quietly in front of some of the commands in lfbinarypois. -------------------------------------------------------------- begin execution ---------------------------------------------------------------- end execution . ml search initial: log pseudolikelihood = -14886.656 rescale: log pseudolikelihood = -4622.1502 . ml maximize initial: log pseudolikelihood = -4622.1502 rescale: log pseudolikelihood = -4622.1502 Iteration 0: log pseudolikelihood = -4622.1502 Iteration 1: log pseudolikelihood = -2364.0232 Iteration 2: log pseudolikelihood = -2304.7414 Iteration 3: log pseudolikelihood = -2303.782 Iteration 4: log pseudolikelihood = -2303.7784 Iteration 5: log pseudolikelihood = -2303.7784 Number of obs = 5190 Wald chi2(12) = 610.57 Log pseudolikelihood = -2303.7784 Prob > chi2 = 0.0000 ------------------------------------------------------------------------------ | Robust BINARYVISIT | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- SEX | .2061259 .071847 2.87 0.004 .0653084 .3469434 AGE | -1.000849 1.283692 -0.78 0.436 -3.516839 1.515141 AGESQ | 1.473944 1.405104 1.05 0.294 -1.280009 4.227896 INCOME | .0018279 .1088 0.02 0.987 -.2114163 .2150721 LEVYPLUS | .2218097 .0870455 2.55 0.011 .0512038 .3924157 FREEPOOR | -.5717048 .2322152 -2.46 0.014 -1.026838 -.1165713 FREEREPA | .3455172 .1223096 2.82 0.005 .1057947 .5852397 ILLNESS | .2074296 .0232989 8.90 0.000 .1617646 .2530946 ACTDAYS | .0993124 .0082463 12.04 0.000 .0831499 .1154749 HSCORE | .04358 .015178 2.87 0.004 .0138317 .0733284 CHCOND1 | .1198 .0800389 1.50 0.134 -.0370733 .2766733 CHCOND2 | .2267205 .1091817 2.08 0.038 .0127283 .4407128 _cons | -2.318976 .2374827 -9.76 0.000 -2.784434 -1.853519 ------------------------------------------------------------------------------ . . * CLOGLOG model is the same ! . cloglog DVISITS $XLIST, vce(robust) // Table 3.7 BP column Iteration 0: log pseudolikelihood = -2446.2384 Iteration 1: log pseudolikelihood = -2304.8611 Iteration 2: log pseudolikelihood = -2303.7792 Iteration 3: log pseudolikelihood = -2303.7784 Iteration 4: log pseudolikelihood = -2303.7784 Complementary log-log regression Number of obs = 5190 Zero outcomes = 4141 Nonzero outcomes = 1049 Wald chi2(12) = 610.57 Log pseudolikelihood = -2303.7784 Prob > chi2 = 0.0000 ------------------------------------------------------------------------------ | Robust DVISITS | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- SEX | .2061259 .071847 2.87 0.004 .0653084 .3469434 AGE | -1.000849 1.283692 -0.78 0.436 -3.516839 1.515141 AGESQ | 1.473944 1.405104 1.05 0.294 -1.280009 4.227896 INCOME | .0018279 .1088 0.02 0.987 -.2114163 .215072 LEVYPLUS | .2218097 .0870455 2.55 0.011 .0512038 .3924157 FREEPOOR | -.5717048 .2322152 -2.46 0.014 -1.026838 -.1165713 FREEREPA | .3455172 .1223096 2.82 0.005 .1057947 .5852397 ILLNESS | .2074296 .0232989 8.90 0.000 .1617646 .2530946 ACTDAYS | .0993124 .0082463 12.04 0.000 .0831499 .1154749 HSCORE | .04358 .015178 2.87 0.004 .0138317 .0733284 CHCOND1 | .1198 .0800389 1.50 0.134 -.0370732 .2766733 CHCOND2 | .2267205 .1091817 2.08 0.038 .0127283 .4407128 _cons | -2.318976 .2374827 -9.76 0.000 -2.784434 -1.853519 ------------------------------------------------------------------------------ . estimates store CLOGLOG . . * Compare to binary logit and probit . probit DVISITS $XLIST, vce(robust) Iteration 0: log pseudolikelihood = -2612.2652 Iteration 1: log pseudolikelihood = -2273.8846 Iteration 2: log pseudolikelihood = -2271.6122 Iteration 3: log pseudolikelihood = -2271.6115 Iteration 4: log pseudolikelihood = -2271.6115 Probit regression Number of obs = 5190 Wald chi2(12) = 541.46 Prob > chi2 = 0.0000 Log pseudolikelihood = -2271.6115 Pseudo R2 = 0.1304 ------------------------------------------------------------------------------ | Robust DVISITS | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- SEX | .1498603 .0462357 3.24 0.001 .0592401 .2404806 AGE | -1.180531 .862017 -1.37 0.171 -2.870053 .5089916 AGESQ | 1.624826 .959646 1.69 0.090 -.2560457 3.505697 INCOME | .0032784 .071177 0.05 0.963 -.136226 .1427828 LEVYPLUS | .1529976 .0539566 2.84 0.005 .0472446 .2587505 FREEPOOR | -.3499512 .134044 -2.61 0.009 -.6126725 -.0872298 FREEREPA | .2417192 .0801207 3.02 0.003 .0846854 .398753 ILLNESS | .156049 .0166213 9.39 0.000 .1234719 .1886261 ACTDAYS | .0935461 .0076002 12.31 0.000 .0786499 .1084423 HSCORE | .0356943 .0106316 3.36 0.001 .0148567 .0565318 CHCOND1 | .057915 .0502944 1.15 0.250 -.0406603 .1564902 CHCOND2 | .1508315 .0733483 2.06 0.040 .0070714 .2945916 _cons | -1.353913 .15423 -8.78 0.000 -1.656198 -1.051628 ------------------------------------------------------------------------------ . logit DVISITS $XLIST, vce(robust) Iteration 0: log pseudolikelihood = -2612.2652 Iteration 1: log pseudolikelihood = -2297.7556 Iteration 2: log pseudolikelihood = -2278.6779 Iteration 3: log pseudolikelihood = -2278.2012 Iteration 4: log pseudolikelihood = -2278.2009 Iteration 5: log pseudolikelihood = -2278.2009 Logistic regression Number of obs = 5190 Wald chi2(12) = 470.67 Prob > chi2 = 0.0000 Log pseudolikelihood = -2278.2009 Pseudo R2 = 0.1279 ------------------------------------------------------------------------------ | Robust DVISITS | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- SEX | .260689 .0836438 3.12 0.002 .0967502 .4246279 AGE | -1.976087 1.536669 -1.29 0.198 -4.987903 1.035729 AGESQ | 2.736668 1.706439 1.60 0.109 -.6078916 6.081227 INCOME | .0074574 .1282804 0.06 0.954 -.2439676 .2588824 LEVYPLUS | .2670067 .0985694 2.71 0.007 .0738143 .4601992 FREEPOOR | -.6803834 .2584529 -2.63 0.008 -1.186942 -.173825 FREEREPA | .4162405 .1444865 2.88 0.004 .1330521 .6994288 ILLNESS | .263485 .028873 9.13 0.000 .206895 .320075 ACTDAYS | .158077 .0138359 11.43 0.000 .1309592 .1851949 HSCORE | .0634296 .0186791 3.40 0.001 .0268193 .1000399 CHCOND1 | .102007 .0904905 1.13 0.260 -.0753512 .2793652 CHCOND2 | .2667977 .1296673 2.06 0.040 .0126545 .520941 _cons | -2.289901 .2770794 -8.26 0.000 -2.832967 -1.746836 ------------------------------------------------------------------------------ . . * Ordered probit . * Transform to 8 or more (as only one observation 9) . generate DVISITS8ormore = DVISITS . replace DVISITS8ormore = 8 if DVISITS > 8 (1 real change made) . oprobit DVISITS8ormore $XLIST, vce(robust) Iteration 0: log pseudolikelihood = -3532.9632 Iteration 1: log pseudolikelihood = -3141.8883 Iteration 2: log pseudolikelihood = -3138.1006 Iteration 3: log pseudolikelihood = -3138.098 Iteration 4: log pseudolikelihood = -3138.098 Ordered probit regression Number of obs = 5190 Wald chi2(12) = 688.11 Prob > chi2 = 0.0000 Log pseudolikelihood = -3138.098 Pseudo R2 = 0.1118 -------------------------------------------------------------------------------- | Robust DVISITS8ormore | Coef. Std. Err. z P>|z| [95% Conf. Interval] ---------------+---------------------------------------------------------------- SEX | .1318851 .0444632 2.97 0.003 .0447388 .2190313 AGE | -.5341869 .8197301 -0.65 0.515 -2.140828 1.072455 AGESQ | .8573049 .9059467 0.95 0.344 -.918318 2.632928 INCOME | -.062211 .0705469 -0.88 0.378 -.2004804 .0760584 LEVYPLUS | .1370307 .0522984 2.62 0.009 .0345278 .2395337 FREEPOOR | -.3460449 .1355777 -2.55 0.011 -.6117724 -.0803174 FREEREPA | .1783822 .0746215 2.39 0.017 .0321268 .3246376 ILLNESS | .1504846 .015439 9.75 0.000 .1202246 .1807445 ACTDAYS | .1005754 .0065085 15.45 0.000 .0878189 .1133319 HSCORE | .031862 .0094767 3.36 0.001 .013288 .050436 CHCOND1 | .0616017 .0487196 1.26 0.206 -.0338869 .1570903 CHCOND2 | .1353215 .070455 1.92 0.055 -.0027678 .2734108 ---------------+---------------------------------------------------------------- /cut1 | 1.378705 .1478453 1.088934 1.668477 /cut2 | 2.317589 .151183 2.021276 2.613903 /cut3 | 2.892994 .1551917 2.588823 3.197164 /cut4 | 3.090366 .1584576 2.779795 3.400937 /cut5 | 3.331566 .158581 3.020753 3.642379 /cut6 | 3.466128 .1610627 3.150451 3.781805 /cut7 | 3.712493 .1788635 3.361927 4.063059 /cut8 | 4.168501 .2172623 3.742675 4.594327 -------------------------------------------------------------------------------- . estimates store OPROBIT . . * Now rescale the Ordered Probit coefficients . matrix b = e(b) . quietly regress DVISITS $XLIST . matrix boprobitrescaled = e(rmse)*b' . display "Rescale coefficients by multiplying by: " e(rmse) Rescale coefficients by multiplying by: .71388175 . matrix list boprobitrescaled // Table 3.7 OrdProb column boprobitrescaled[20,1] y1 DVISITS8ormore:SEX .09415035 DVISITS8ormore:AGE -.3813463 DVISITS8ormore:AGESQ .61201429 DVISITS8ormore:INCOME -.04441131 DVISITS8ormore:LEVYPLUS .09782372 DVISITS8ormore:FREEPOOR -.24703514 DVISITS8ormore:FREEREPA .12734379 DVISITS8ormore:ILLNESS .10742818 DVISITS8ormore:ACTDAYS .07179893 DVISITS8ormore:HSCORE .0227457 DVISITS8ormore:CHCOND1 .04397631 DVISITS8ormore:CHCOND2 .09660356 cut1:_cons .98423264 cut2:_cons 1.6544848 cut3:_cons 2.0652554 cut4:_cons 2.206156 cut5:_cons 2.378344 cut6:_cons 2.4744056 cut7:_cons 2.6502811 cut8:_cons 2.9758167 . . * OLS with dependent variable y . regress DVISITS $XLIST, vce(robust) Linear regression Number of obs = 5190 F( 12, 5177) = 23.04 Prob > F = 0.0000 R-squared = 0.2018 Root MSE = .71388 ------------------------------------------------------------------------------ | Robust DVISITS | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- SEX | .033811 .0229929 1.47 0.141 -.0112648 .0788868 AGE | .203201 .4475822 0.45 0.650 -.6742492 1.080651 AGESQ | -.0621028 .5149627 -0.12 0.904 -1.071647 .9474416 INCOME | -.0573227 .0348968 -1.64 0.101 -.1257351 .0110897 LEVYPLUS | .0351789 .0217826 1.61 0.106 -.0075243 .077882 FREEPOOR | -.1033142 .0476909 -2.17 0.030 -.1968086 -.0098198 FREEREPA | .0332409 .043345 0.77 0.443 -.0517336 .1182155 ILLNESS | .0599457 .0099355 6.03 0.000 .0404678 .0794236 ACTDAYS | .1031916 .0097408 10.59 0.000 .0840956 .1222876 HSCORE | .0169765 .0071747 2.37 0.018 .0029111 .0310419 CHCOND1 | .0043844 .0222637 0.20 0.844 -.039262 .0480307 CHCOND2 | .0416174 .0464145 0.90 0.370 -.0493745 .1326094 _cons | .0276322 .0733923 0.38 0.707 -.1162477 .1715121 ------------------------------------------------------------------------------ . estimates store OLSY // Table 3.7 y column . predict pOLSY, xb . generate resOLSY = DVISITS - pOLSY . quietly sum, detail . display "Skewness: " r(skewness) " Kurtosis: " r(kurtosis) Skewness: 3.566847 Kurtosis: 26.445391 . . * OLS with dependent variable ln(y+0.1) . generate LNDVISITS = ln(DVISITS + 0.1) . regress LNDVISITS $XLIST, vce(robust) // Table 3.7 lny column Linear regression Number of obs = 5190 F( 12, 5177) = 52.19 Prob > F = 0.0000 R-squared = 0.1721 Root MSE = .97983 ------------------------------------------------------------------------------ | Robust LNDVISITS | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- SEX | .0814928 .0298901 2.73 0.006 .0228955 .1400901 AGE | -.5659196 .5828345 -0.97 0.332 -1.708521 .5766821 AGESQ | .8771172 .6700677 1.31 0.191 -.4364985 2.190733 INCOME | -.0193598 .0451984 -0.43 0.668 -.1079678 .0692483 LEVYPLUS | .0796925 .0308905 2.58 0.010 .019134 .140251 FREEPOOR | -.1815168 .0572554 -3.17 0.002 -.2937616 -.0692721 FREEREPA | .1390223 .0568498 2.45 0.015 .0275726 .2504719 ILLNESS | .1096774 .0128764 8.52 0.000 .0844342 .1349205 ACTDAYS | .1058193 .0078054 13.56 0.000 .0905174 .1211213 HSCORE | .0289177 .0087604 3.30 0.001 .0117435 .0460919 CHCOND1 | .0219201 .0314016 0.70 0.485 -.0396403 .0834806 CHCOND2 | .1019354 .0565126 1.80 0.071 -.0088532 .2127241 _cons | -2.114624 .0987971 -21.40 0.000 -2.308308 -1.920939 ------------------------------------------------------------------------------ . estimates store OLSLNY . predict pOLSLNY, xb . generate resOLSLNY = LNDVISITS - pOLSLNY . quietly sum, detail . display "Skewness: " r(skewness) " Kurtosis: " r(kurtosis) Skewness: 1.24342 Kurtosis: 3.9932273 . . * OLS with dependent variable sqrt(y) . generate SQRTDVISITS = sqrt(DVISITS) . regress SQRTDVISITS $XLIST, vce(robust) // Table 3.7 sqrty column Linear regression Number of obs = 5190 F( 12, 5177) = 44.72 Prob > F = 0.0000 R-squared = 0.1886 Root MSE = .44723 ------------------------------------------------------------------------------ | Robust SQRTDVISITS | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- SEX | .0340355 .0137554 2.47 0.013 .0070691 .0610018 AGE | -.1605487 .2691814 -0.60 0.551 -.6882579 .3671604 AGESQ | .2915928 .3096217 0.94 0.346 -.3153964 .898582 INCOME | -.0167669 .0208961 -0.80 0.422 -.057732 .0241983 LEVYPLUS | .0337061 .0140193 2.40 0.016 .0062223 .0611898 FREEPOOR | -.0810564 .027077 -2.99 0.003 -.1341387 -.027974 FREEREPA | .0538427 .0261417 2.06 0.039 .0025939 .1050916 ILLNESS | .0483804 .0059633 8.11 0.000 .0366897 .060071 ACTDAYS | .0544319 .0041722 13.05 0.000 .0462526 .0626113 HSCORE | .0129843 .0041001 3.17 0.002 .0049463 .0210223 CHCOND1 | .0086196 .0142406 0.61 0.545 -.0192981 .0365373 CHCOND2 | .0428074 .026519 1.61 0.107 -.0091811 .0947958 _cons | .0699893 .0453227 1.54 0.123 -.0188623 .1588408 ------------------------------------------------------------------------------ . estimates store OLSSQRTY . predict pOLSSQY, xb . generate resOLSSQY = SQRTDVISITS - pOLSSQY . quietly sum, detail . display "Skewness: " r(skewness) " Kurtosis: " r(kurtosis) Skewness: 1.4278829 Kurtosis: 5.4665049 . . * Poisson QMLE . poisson DVISITS $XLIST, vce(robust) Iteration 0: log pseudolikelihood = -4923.1976 Iteration 1: log pseudolikelihood = -3890.2934 Iteration 2: log pseudolikelihood = -3356.8559 Iteration 3: log pseudolikelihood = -3355.5431 Iteration 4: log pseudolikelihood = -3355.5413 Iteration 5: log pseudolikelihood = -3355.5413 Poisson regression Number of obs = 5190 Wald chi2(12) = 964.02 Prob > chi2 = 0.0000 Log pseudolikelihood = -3355.5413 Pseudo R2 = 0.1576 ------------------------------------------------------------------------------ | Robust DVISITS | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- SEX | .156882 .0792209 1.98 0.048 .0016118 .3121522 AGE | 1.056299 1.364474 0.77 0.439 -1.618021 3.73062 AGESQ | -.8487041 1.459683 -0.58 0.561 -3.709631 2.012223 INCOME | -.2053206 .1292572 -1.59 0.112 -.45866 .0480188 LEVYPLUS | .1231854 .0951652 1.29 0.196 -.0633348 .3097057 FREEPOOR | -.4400609 .2900225 -1.52 0.129 -1.008494 .1283726 FREEREPA | .0797984 .1257953 0.63 0.526 -.1667558 .3263527 ILLNESS | .1869484 .0239387 7.81 0.000 .1400295 .2338674 ACTDAYS | .1268465 .0077698 16.33 0.000 .1116179 .142075 HSCORE | .030081 .0142359 2.11 0.035 .0021791 .0579829 CHCOND1 | .1140853 .0908541 1.26 0.209 -.0639854 .2921561 CHCOND2 | .1411583 .1227226 1.15 0.250 -.0993737 .3816902 _cons | -2.223848 .2544567 -8.74 0.000 -2.722574 -1.725122 ------------------------------------------------------------------------------ . estimates store POISSON . predict pPOISS, n . generate resPOISS = DVISITS - pPOISS . quietly sum, detail . display "Skewness: " r(skewness) " Kurtosis: " r(kurtosis) Skewness: 3.1246985 Kurtosis: 25.642737 . . * Nonlinear least squares with same conditionam mean as Poisson . generate one = 1 . nl (DVISITS = exp({xb: $XLIST one})), vce(robust) // Table 3.7 NLS (obs = 5190) Iteration 0: residual SS = 3043.388 Iteration 1: residual SS = 2729.354 Iteration 2: residual SS = 2714.721 Iteration 3: residual SS = 2714.387 Iteration 4: residual SS = 2714.372 Iteration 5: residual SS = 2714.371 Iteration 6: residual SS = 2714.371 Iteration 7: residual SS = 2714.371 Iteration 8: residual SS = 2714.371 Iteration 9: residual SS = 2714.371 Iteration 10: residual SS = 2714.371 Iteration 11: residual SS = 2714.371 Iteration 12: residual SS = 2714.371 Iteration 13: residual SS = 2714.371 Iteration 14: residual SS = 2714.371 Iteration 15: residual SS = 2714.371 Nonlinear regression Number of obs = 5190 R-squared = 0.2815 Adj R-squared = 0.2797 Root MSE = .724095 Res. dev. = 11364.56 ------------------------------------------------------------------------------ | Robust DVISITS | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- /xb_SEX | -.0570771 .137424 -0.42 0.678 -.3264862 .212332 /xb_AGE | 3.626041 1.995592 1.82 0.069 -.2861619 7.538243 /xb_AGESQ | -3.675901 2.160576 -1.70 0.089 -7.911542 .559741 /xb_INCOME | -.3940749 .1953428 -2.02 0.044 -.7770294 -.0111204 /xb_LEVYPLUS | .2138633 .1451309 1.47 0.141 -.0706545 .4983811 /xb_FREEPOOR | -.2322004 .4281278 -0.54 0.588 -1.071512 .6071108 /xb_FREEREPA | -.0029155 .193104 -0.02 0.988 -.3814808 .3756498 /xb_ILLNESS | .1396042 .0384706 3.63 0.000 .0641856 .2150227 /xb_ACTDAYS | .1209979 .0085272 14.19 0.000 .104281 .1377147 /xb_HSCORE | .0229036 .022301 1.03 0.304 -.0208158 .066623 /xb_CHCOND1 | .079467 .1457874 0.55 0.586 -.2063378 .3652719 /xb_CHCOND2 | -.055081 .177085 -0.31 0.756 -.4022423 .2920803 /xb_one | -2.233898 .3645483 -6.13 0.000 -2.948567 -1.51923 ------------------------------------------------------------------------------ . estimates store NL . . *** TABLE 3.7: BINARY PROBIT, ORDERED PROBIT, OLS (y, lny, sqrty) POISS NLS (most of table) . . estimates table CLOGLOG OLSY OLSLNY OLSSQRTY POISSON, b(%9.3f) t eq(1) stats(ll) -------------------------------------------------------------------------- Variable | CLOGLOG OLSY OLSLNY OLSSQRTY POISSON -------------+------------------------------------------------------------ SEX | 0.206 0.034 0.081 0.034 0.157 | 2.87 1.47 2.73 2.47 1.98 AGE | -1.001 0.203 -0.566 -0.161 1.056 | -0.78 0.45 -0.97 -0.60 0.77 AGESQ | 1.474 -0.062 0.877 0.292 -0.849 | 1.05 -0.12 1.31 0.94 -0.58 INCOME | 0.002 -0.057 -0.019 -0.017 -0.205 | 0.02 -1.64 -0.43 -0.80 -1.59 LEVYPLUS | 0.222 0.035 0.080 0.034 0.123 | 2.55 1.61 2.58 2.40 1.29 FREEPOOR | -0.572 -0.103 -0.182 -0.081 -0.440 | -2.46 -2.17 -3.17 -2.99 -1.52 FREEREPA | 0.346 0.033 0.139 0.054 0.080 | 2.82 0.77 2.45 2.06 0.63 ILLNESS | 0.207 0.060 0.110 0.048 0.187 | 8.90 6.03 8.52 8.11 7.81 ACTDAYS | 0.099 0.103 0.106 0.054 0.127 | 12.04 10.59 13.56 13.05 16.33 HSCORE | 0.044 0.017 0.029 0.013 0.030 | 2.87 2.37 3.30 3.17 2.11 CHCOND1 | 0.120 0.004 0.022 0.009 0.114 | 1.50 0.20 0.70 0.61 1.26 CHCOND2 | 0.227 0.042 0.102 0.043 0.141 | 2.08 0.90 1.80 1.61 1.15 _cons | -2.319 0.028 -2.115 0.070 -2.224 | -9.76 0.38 -21.40 1.54 -8.74 -------------+------------------------------------------------------------ ll | -2303.778 -5608.556 -7252.014 -3181.506 -3355.541 -------------------------------------------------------------------------- legend: b/t . . * For TABLE 3.7 OrdProb column use the earlier rescaled coefficients . matrix list boprobitrescaled boprobitrescaled[20,1] y1 DVISITS8ormore:SEX .09415035 DVISITS8ormore:AGE -.3813463 DVISITS8ormore:AGESQ .61201429 DVISITS8ormore:INCOME -.04441131 DVISITS8ormore:LEVYPLUS .09782372 DVISITS8ormore:FREEPOOR -.24703514 DVISITS8ormore:FREEREPA .12734379 DVISITS8ormore:ILLNESS .10742818 DVISITS8ormore:ACTDAYS .07179893 DVISITS8ormore:HSCORE .0227457 DVISITS8ormore:CHCOND1 .04397631 DVISITS8ormore:CHCOND2 .09660356 cut1:_cons .98423264 cut2:_cons 1.6544848 cut3:_cons 2.0652554 cut4:_cons 2.206156 cut5:_cons 2.378344 cut6:_cons 2.4744056 cut7:_cons 2.6502811 cut8:_cons 2.9758167 . . * For TABLE 3.7 NL column . estimates table NL, b(%9.3f) t stats(ll) -------------------------- Variable | NL -------------+------------ xb_SEX | _cons | -0.057 | -0.42 -------------+------------ xb_AGE | _cons | 3.626 | 1.82 -------------+------------ xb_AGESQ | _cons | -3.676 | -1.70 -------------+------------ xb_INCOME | _cons | -0.394 | -2.02 -------------+------------ xb_LEVYPLUS | _cons | 0.214 | 1.47 -------------+------------ xb_FREEPOOR | _cons | -0.232 | -0.54 -------------+------------ xb_FREEREPA | _cons | -0.003 | -0.02 -------------+------------ xb_ILLNESS | _cons | 0.140 | 3.63 -------------+------------ xb_ACTDAYS | _cons | 0.121 | 14.19 -------------+------------ xb_HSCORE | _cons | 0.023 | 1.03 -------------+------------ xb_CHCOND1 | _cons | 0.079 | 0.55 -------------+------------ xb_CHCOND2 | _cons | -0.055 | -0.31 -------------+------------ xb_one | _cons | -2.234 | -6.13 -------------+------------ Statistics | ll | -5682.281 -------------------------- legend: b/t . . ********** CLOSE OUTPUT . . * log close . * clear . * exit . end of do-file . exit, clear