[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: computing expected values for GLM with nbreg

Subject   st: computing expected values for GLM with nbreg
Date   Sun, 21 Jun 2009 14:09:14 -0400

The predict command following nbreg will give you the expected number of events, or counts. So, with y as the response term and xvars as the predictors, type the following on the command line:

. nbreg y xvars
. predict mu

where mu is the term I used for the fitted or predicted count. If you want to use all of the residuals and fit tests that come
with using the -glm- command, then following the use of -nbreg-, type

glm y xvars, fam(nb `e(alpha)')
predict mu2 /// or whatever postestimaton statistic you wish; this is same as mu above.

The `e(alpha)' captures the return code saved by -nbreg- for the value of the ancillary parameter. If you forget, just use the value of alpha displayed in the -nbreg- output. So

glm y xvars, fam(nb .33333)

The log link is the default link with the negative binomial family with -glm-, which is the same parameterization as -nbreg-. It does not need to be typed as an option.

Joseph Hilbe


Date: Sat, 20 Jun 2009 22:20:50 -0400
Subject: st: computing expected values for GLM with nbreg

I am running a negative binomial model - because my data are time series I switched to running the model through the GLM command so I could control for autocorrelation and heterosk. w/ HAC variance estimates. I want to compute expected values to make the interpretation a little more tranparent. When using the nbreg command previously I used clarify to get expected values. Clarify won't run after GLM, and looking through STATA help I see no postestimation command for getting expected values. Does anyone know how I might go about getting expected values through STATA with this set up -- would I be better of doing hand calculations?

Thanks for any help,
Ashlie Delshad
*   For searches and help try:

© Copyright 1996–2022 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index