[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
Re: st: adjust after poisson
Timothy J. Wade <firstname.lastname@example.org> asks:
> I'm trying to obtain adjusted rates by month after the following poisson
> 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
> option in adjust?
> 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()
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
I ran a nonsense example using the auto data. I do not show
the output for the sake of brevity.
xi : poisson mpg weight i.rep , offset(trunk)
adjust weight , by(rep) /* <--- gives error */
adjust weight , by(rep) nooffset
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
adjust somevar , by(catvar)
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?
The decision was made that -adjust- would complain and put the
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 email@example.com
* For searches and help try: