------------------------------------------------------------------------------- log: I:\Web\LearnEconometrics\data\stata\poisson.log log type: text opened on: 21 Apr 2008, 11:36:09 . webuse rod93, clear . tab cohort, gen(coh) cohort | Freq. Percent Cum. ------------+----------------------------------- 1 | 7 33.33 33.33 2 | 7 33.33 66.67 3 | 7 33.33 100.00 ------------+----------------------------------- Total | 21 100.00 . generate logexp=ln(exposure) Poisson regression. Mean and variance are equal. . poisson deaths coh2 coh3 exposure age_mos Iteration 0: log likelihood = -230.05184 Iteration 1: log likelihood = -229.23937 Iteration 2: log likelihood = -229.23858 Iteration 3: log likelihood = -229.23858 Poisson regression Number of obs = 21 LR chi2(4) = 196.91 Prob > chi2 = 0.0000 Log likelihood = -229.23858 Pseudo R2 = 0.3005 ------------------------------------------------------------------------------ deaths | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- coh2 | -.0636587 .0617978 -1.03 0.303 -.1847801 .0574627 coh3 | -.0938548 .0598842 -1.57 0.117 -.2112257 .0235162 exposure | .000088 .0000154 5.72 0.000 .0000579 .0001182 age_mos | -.027683 .003184 -8.69 0.000 -.0339236 -.0214424 _cons | 4.658944 .0443266 105.10 0.000 4.572065 4.745822 ------------------------------------------------------------------------------ This is the NegBin I regression. Use the dispersion(constant) option. delta is the estimated dispersion parameter. Note that Stata tests the hypothesis that this parameter is zero. It is not at the 5% level. . nbreg deaths coh2 coh3 exposure age_mos, dispersion(constant) Fitting Poisson model: Iteration 0: log likelihood = -230.05184 Iteration 1: log likelihood = -229.23937 Iteration 2: log likelihood = -229.23858 Iteration 3: log likelihood = -229.23858 Fitting constant-only model: Iteration 0: log likelihood = -203.26893 Iteration 1: log likelihood = -123.74488 Iteration 2: log likelihood = -119.11485 Iteration 3: log likelihood = -108.56039 Iteration 4: log likelihood = -108.56018 Iteration 5: log likelihood = -108.56018 Fitting full model: Iteration 0: log likelihood = -108.56018 Iteration 1: log likelihood = -105.83459 Iteration 2: log likelihood = -102.81339 Iteration 3: log likelihood = -102.785 Iteration 4: log likelihood = -102.78493 Iteration 5: log likelihood = -102.78493 Negative binomial regression Number of obs = 21 LR chi2(4) = 11.55 Dispersion = constant Prob > chi2 = 0.0210 Log likelihood = -102.78493 Pseudo R2 = 0.0532 ------------------------------------------------------------------------------ deaths | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- coh2 | -.0935709 .2304857 -0.41 0.685 -.5453145 .3581728 coh3 | -.1000696 .2211086 -0.45 0.651 -.5334345 .3332954 exposure | .0000848 .0000486 1.74 0.081 -.0000105 .0001801 age_mos | -.0238025 .0096215 -2.47 0.013 -.0426604 -.0049446 _cons | 4.620333 .1644738 28.09 0.000 4.297971 4.942696 -------------+---------------------------------------------------------------- /lndelta | 2.65334 .3357755 1.995233 3.311448 -------------+---------------------------------------------------------------- delta | 14.2014 4.768481 7.353914 27.42482 ------------------------------------------------------------------------------ Likelihood-ratio test of delta=0: chibar2(01) = 252.91 Prob>=chibar2 = 0.000 Removing the dispersion(constant) option estimates NegBin II. Not much change usually occurs, so this is probably the best option. . nbreg deaths coh2 coh3 exposure age_mos Fitting Poisson model: Iteration 0: log likelihood = -230.05184 Iteration 1: log likelihood = -229.23937 Iteration 2: log likelihood = -229.23858 Iteration 3: log likelihood = -229.23858 Fitting constant-only model: Iteration 0: log likelihood = -114.33669 Iteration 1: log likelihood = -110.33038 Iteration 2: log likelihood = -108.56521 Iteration 3: log likelihood = -108.56018 Iteration 4: log likelihood = -108.56018 Fitting full model: Iteration 0: log likelihood = -103.20523 Iteration 1: log likelihood = -102.19559 Iteration 2: log likelihood = -100.97396 Iteration 3: log likelihood = -100.96805 Iteration 4: log likelihood = -100.96805 Negative binomial regression Number of obs = 21 LR chi2(4) = 15.18 Dispersion = mean Prob > chi2 = 0.0043 Log likelihood = -100.96805 Pseudo R2 = 0.0699 ------------------------------------------------------------------------------ deaths | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- coh2 | -.1277147 .2270809 -0.56 0.574 -.572785 .3173556 coh3 | -.151844 .2193673 -0.69 0.489 -.581796 .2781079 exposure | .0000985 .00004 2.46 0.014 .00002 .0001769 age_mos | -.0295334 .0072027 -4.10 0.000 -.0436505 -.0154163 _cons | 4.69223 .1732631 27.08 0.000 4.35264 5.031819 -------------+---------------------------------------------------------------- /lnalpha | -1.891769 .3239058 -2.526612 -1.256925 -------------+---------------------------------------------------------------- alpha | .1508048 .0488466 .0799293 .2845276 ------------------------------------------------------------------------------ Likelihood-ratio test of alpha=0: chibar2(01) = 256.54 Prob>=chibar2 = 0.000 You can also predict the conditional mean and the incidence rate (the incidence rate = exp(xb), the predicted number of events when exposure is 1.) . predict count (option n assumed; predicted number of events) . predict rate, ir . list rate count +---------------------+ | rate count | |---------------------| 1. | 110.4851 110.4851 | 2. | 108.443 108.443 | 3. | 103.2923 103.2923 | 4. | 97.43195 97.43195 | 5. | 86.19945 86.19945 | |---------------------| 6. | 74.65661 74.65661 | 7. | 31.17305 31.17305 | 8. | 98.44086 98.44086 | 9. | 97.79316 97.79316 | 10. | 94.29 94.29 | |---------------------| 11. | 92.26912 92.26912 | 12. | 87.8938 87.8938 | 13. | 101.9226 101.9226 | 14. | 46.03299 46.03299 | 15. | 96.96953 96.96953 | |---------------------| 16. | 97.08006 97.08006 | 17. | 94.02188 94.02188 | 18. | 92.85877 92.85877 | 19. | 86.80122 86.80122 | 20. | 71.27377 71.27377 | |---------------------| 21. | 11.6327 11.6327 | +---------------------+ Finally, use mfx to get marginal effects. Note how it handles dummies. . mfx Marginal effects after nbreg y = predicted number of events (predict) = 77.657776 ------------------------------------------------------------------------------ variable | dy/dx Std. Err. z P>|z| [ 95% C.I. ] X ---------+-------------------------------------------------------------------- coh2*| -9.715756 16.941 -0.57 0.566 -42.9187 23.4872 .333333 coh3*| -11.50824 16.254 -0.71 0.479 -43.3659 20.3494 .333333 exposure | .0076478 .00315 2.43 0.015 .001482 .013814 4606.27 age_mos | -2.293495 .58127 -3.95 0.000 -3.43277 -1.15422 23.7143 ------------------------------------------------------------------------------ (*) dy/dx is for discrete change of dummy variable from 0 to 1 . log close log: I:\Web\LearnEconometrics\data\stata\poisson.log log type: text closed on: 21 Apr 2008, 11:39:14 -------------------------------------------------------------------------------