--- On Sat, 11/7/09, Kathryn L Adeney wrote:
> I am trying to account for time-at-risk ("risktime") as an
> offset variable in a logistic regression model. As far
> as I understand, it should not matter whether I use the
> option "exposure(risktime)" or "offset(lnrisktime)", where
> lnrisktime = ln(risktime), in the glm. However, I get
> two different results depending on how I specify the
> option. Is this a glitch that anyone else has come
> across?
If you created lnrisktime as a float variable (the default)
you will get slightly different results differing in the
last one or two digits. These differences will disappear
if you create lnrisktime as a double. If this is the
problem that you came across then this is not a glitch
but a sign that Stata performs internal computations at
high precision. Below is an example where these two work
exactly as expected once lnpyears was created as a double.
*------------ begin example --------------------
webuse dollhill3, clear
tab agecat, gen(agecat)
gen double lnpyears = ln(pyears)
glm deaths smokes agecat1 agecat2 agecat3, ///
exposure(pyears) link(log) family(poisson)
glm deaths smokes agecat1 agecat2 agecat3, ///
offset(lnpyears) link(log) family(poisson)
*----------------- end example ------------------
Hope this helps,
Maarten
-----------------------------------------
Maarten L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen
Germany
http://home.fsw.vu.nl/m.buis/
-----------------------------------------
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/