------------------------------------------------------------------------------ log: c:\bill\jpsm\drvisits.log log type: text opened on: 25 May 2006, 13:48:11 . * open stata data set; . use c:\bill\jpsm\drvisits; . * generate new variables; . gen incomel=ln(income); . * get distribution of dr visits; . tabulate drvisits; annual doc | visits | Freq. Percent Cum. ------------+----------------------------------- 0 | 911 17.19 17.19 1 | 595 11.23 28.42 2 | 530 10.00 38.42 3 | 502 9.47 47.90 4 | 449 8.47 56.37 5 | 391 7.38 63.75 6 | 317 5.98 69.73 7 | 257 4.85 74.58 8 | 213 4.02 78.60 9 | 191 3.60 82.20 10 | 144 2.72 84.92 11 | 122 2.30 87.22 12 | 99 1.87 89.09 13 | 79 1.49 90.58 14 | 80 1.51 92.09 15 | 66 1.25 93.34 16 | 56 1.06 94.40 17 | 56 1.06 95.45 18 | 34 0.64 96.09 19 | 26 0.49 96.58 20 | 17 0.32 96.91 21 | 21 0.40 97.30 22 | 20 0.38 97.68 23 | 11 0.21 97.89 24 | 15 0.28 98.17 25 | 4 0.08 98.24 26 | 12 0.23 98.47 27 | 9 0.17 98.64 28 | 6 0.11 98.75 29 | 4 0.08 98.83 30 | 5 0.09 98.92 31 | 6 0.11 99.04 32 | 2 0.04 99.08 33 | 2 0.04 99.11 34 | 3 0.06 99.17 35 | 2 0.04 99.21 36 | 2 0.04 99.25 37 | 4 0.08 99.32 38 | 2 0.04 99.36 39 | 5 0.09 99.45 40 | 2 0.04 99.49 41 | 1 0.02 99.51 42 | 4 0.08 99.58 43 | 2 0.04 99.62 44 | 2 0.04 99.66 47 | 1 0.02 99.68 48 | 2 0.04 99.72 49 | 1 0.02 99.74 50 | 1 0.02 99.75 51 | 1 0.02 99.77 53 | 2 0.04 99.81 55 | 1 0.02 99.83 56 | 1 0.02 99.85 58 | 2 0.04 99.89 61 | 1 0.02 99.91 63 | 1 0.02 99.92 65 | 1 0.02 99.94 66 | 1 0.02 99.96 68 | 1 0.02 99.98 89 | 1 0.02 100.00 ------------+----------------------------------- Total | 5,299 100.00 . * get descriptive statistics; . sum; Variable | Obs Mean Std. Dev. Min Max -------------+-------------------------------------------------------- drvisits | 5299 5.567088 6.686262 0 89 age65 | 5299 .3361012 .4724185 0 1 age70 | 5299 .2802416 .4491595 0 1 age75 | 5299 .2002265 .4002075 0 1 age80 | 5299 .109832 .3127098 0 1 -------------+-------------------------------------------------------- chronic | 5299 .628043 .4833726 0 1 excel | 5299 .0751085 .2635912 0 1 good | 5299 .379883 .4854033 0 1 fair | 5299 .330251 .4703478 0 1 hs_drop | 5299 .5023589 .5000416 0 1 -------------+-------------------------------------------------------- hs_grad | 5299 .2926967 .4550433 0 1 black | 5299 .1251179 .3308838 0 1 hispanic | 5299 .0326477 .1777295 0 1 female | 5299 .5970938 .4905285 0 1 mcaid | 5299 .1017173 .3023047 0 1 -------------+-------------------------------------------------------- income | 5299 25515.9 28980.13 14 548224 incomel | 5299 9.754733 .8911269 2.639057 13.21444 . * run poisson regression; . poisson drvisits age65 age70 age75 age80 chronic excel good fair female > black hispanic hs_drop hs_grad mcaid incomel; Iteration 0: log likelihood = -22275.374 Iteration 1: log likelihood = -22275.351 Iteration 2: log likelihood = -22275.351 Poisson regression Number of obs = 5299 LR chi2(15) = 3334.46 Prob > chi2 = 0.0000 Log likelihood = -22275.351 Pseudo R2 = 0.0696 ------------------------------------------------------------------------------ drvisits | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- age65 | .2144282 .026267 8.16 0.000 .1629458 .2659106 age70 | .286831 .0263077 10.90 0.000 .2352689 .3383931 age75 | .2801504 .0269802 10.38 0.000 .2272702 .3330307 age80 | .24314 .0292045 8.33 0.000 .1859001 .3003798 chronic | .4997173 .0137789 36.27 0.000 .4727111 .5267235 excel | -.7836622 .0305392 -25.66 0.000 -.8435178 -.7238065 good | -.4774853 .0159987 -29.85 0.000 -.5088422 -.4461284 fair | -.2578352 .0155473 -16.58 0.000 -.2883073 -.2273631 female | .0960976 .0123182 7.80 0.000 .0719543 .1202409 black | -.2838081 .0202163 -14.04 0.000 -.3234314 -.2441849 hispanic | -.2051023 .0368764 -5.56 0.000 -.2773788 -.1328258 hs_drop | -.2323802 .016066 -14.46 0.000 -.263869 -.2008914 hs_grad | -.1200559 .016517 -7.27 0.000 -.1524287 -.0876831 mcaid | .1535708 .0203414 7.55 0.000 .1137025 .1934392 incomel | .0211453 .0072946 2.90 0.004 .0068481 .0354425 _cons | 1.348084 .0804659 16.75 0.000 1.190374 1.505795 ------------------------------------------------------------------------------ . * run neg binomial regression; . nbreg drvisits age65 age70 age75 age80 chronic excel good fair female > black hispanic hs_drop hs_grad mcaid incomel, dispersion(constant); Fitting Poisson model: Iteration 0: log likelihood = -22275.374 Iteration 1: log likelihood = -22275.351 Iteration 2: log likelihood = -22275.351 Fitting constant-only model: Iteration 0: log likelihood = -17434.216 Iteration 1: log likelihood = -15076.44 Iteration 2: log likelihood = -14841.425 Iteration 3: log likelihood = -14840.935 Iteration 4: log likelihood = -14840.935 Fitting full model: Iteration 0: log likelihood = -14840.935 Iteration 1: log likelihood = -14540.408 Iteration 2: log likelihood = -14519.799 Iteration 3: log likelihood = -14519.721 Iteration 4: log likelihood = -14519.721 Negative binomial (constant dispersion) Number of obs = 5299 LR chi2(15) = 642.43 Prob > chi2 = 0.0000 Log likelihood = -14519.721 Pseudo R2 = 0.0216 ------------------------------------------------------------------------------ drvisits | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- age65 | .1034281 .054664 1.89 0.058 -.0037113 .2105675 age70 | .2039634 .0546788 3.73 0.000 .0967949 .3111319 age75 | .2094928 .0560412 3.74 0.000 .0996541 .3193314 age80 | .2227169 .0605925 3.68 0.000 .1039579 .341476 chronic | .5091666 .0292189 17.43 0.000 .4518986 .5664347 excel | -.5272908 .0594584 -8.87 0.000 -.6438271 -.4107545 good | -.3422506 .0353507 -9.68 0.000 -.4115368 -.2729645 fair | -.1526385 .0351632 -4.34 0.000 -.2215571 -.0837198 female | .1321966 .0263028 5.03 0.000 .0806441 .183749 black | -.3300031 .0438969 -7.52 0.000 -.4160395 -.2439668 hispanic | -.1527763 .0763018 -2.00 0.045 -.3023251 -.0032275 hs_drop | -.1912903 .0344335 -5.56 0.000 -.2587787 -.1238018 hs_grad | -.0869843 .0354543 -2.45 0.014 -.1564733 -.0174952 mcaid | .1341325 .0442797 3.03 0.002 .0473459 .2209191 incomel | .0379834 .0155687 2.44 0.015 .0074693 .0684975 _cons | 1.11029 .17092 6.50 0.000 .7752924 1.445287 -------------+---------------------------------------------------------------- /lndelta | 1.65017 .0286445 1.594027 1.706312 -------------+---------------------------------------------------------------- delta | 5.207863 .1491766 4.923538 5.508607 ------------------------------------------------------------------------------ Likelihood-ratio test of delta=0: chibar2(01) = 1.6e+04 Prob>=chibar2 = 0.000 . log close; log: c:\bill\jpsm\drvisits.log log type: text closed on: 25 May 2006, 13:48:15 ------------------------------------------------------------------------------