# Re: st: adjust after poisson

 From khigbee@stata.com To statalist@hsphsun2.harvard.edu Subject Re: st: adjust after poisson Date Fri, 08 Nov 2002 18:35:57 -0600

```Timothy J. Wade <tjwade@cal.berkeley.edu> asks:

> I'm trying to obtain adjusted rates by month after the following  poisson
> regression:
>
>   xi: poisson count i.monthnum cycle,  exposure(pyear)
>
> when I type: . adjust cycle, by(monthnum)  exp
>
> I get the following error:
> offset (ln(pyear)) not constant within by()
>
> however, when I use type the same adjust command with the "nooffset"
> option. I get returned results that look approximately correct (see below).
>
> My questions are: are the rates given after adjust with the nooffset option
> the correct adjusted rates? Also, why do I need to specify the nooffset
> Thanks very much in advance!
>
> (stata 7.0/Windows)
>
> . adjust cycle, by(month)  exp nooffset
> ----------------------
>   monthnum |    exp(xb)
> ----------+-----------
>          1 |    2.38068
>          2 |    2.67684
>          3 |    2.18642
>          4 |    2.20107
>          5 |    2.09517
>          6 |    1.70584
>          7 |    2.01013
>          8 |    1.86005
>          9 |    1.64766
>         10 |    1.68153
>         11 |    2.37351
>         12 |    2.15014
> ----------------------
>       Key:  exp(xb)  =  exp(xb)

See the entry for 14oct2002 in -help whatsnew-.  The -adjust-
command used to arbitrarily take one of the offsets within each
group defined by the by() option and use it in the prediction.
This is arbitrary, and hence no longer allowed.  Instead, it
checks that offsets (or exposures) were not specified, and if
they were it checks to see if they are constant within the by()
groups.

The answers with and without the -nooffset- option will be
different.  The -adjust- command is really just a convienent
front-end for -predict-.  You can get a feel for what predict
does with the -nooffset- option by running -predict- on your data
with and without it and observing the difference in the
predictions.

I ran a nonsense example using the auto data.  I do not show
the output for the sake of brevity.

use auto
xi : poisson mpg weight i.rep , offset(trunk)

adjust weight , by(rep)              /* <--- gives error */

predict double z1
predict double z2 , nooffset
list z1 z2

z1 and z2 are different, and so would be the results from -adjust-.

When I say

Stata preserves your data, sets up a dataset with "somevar"
replaced by its mean and does the prediction for each group
defined by "catvar".  What should -adjust- do with the offset (or
exposure) that has different values within each group?

burden back on the user to figure out how they would like to
collapse (see -help collapse-) such data before producing
predictions for each group.

Ken Higbee    khigbee@stata.com
StataCorp     1-800-STATAPC

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```