Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: using constraints with nbreg


From   Maarten buis <maartenbuis@yahoo.co.uk>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: using constraints with nbreg
Date   Sat, 21 Oct 2006 08:46:33 +0100 (BST)

--- Wendy Regoeczi <w.regoeczi@csuohio.edu> wrote:
> I am trying analyze negative binomial regression models. I have read
> that if you add the natural logarithm of the population at risk to 
> the regression model and give it a fixed coefficient of one, the 
> model becomes an analysis of rates rather than counts, which is what
> I want. But I am having trouble figuring out how to use the 
> "constraint" option in nbreg to accomplish this. Can anyone tell me
> what the correct syntax is?

Wendy:
This is such a common thing to do that there are special options for
that; see: -help nbreg-. You can add the variable population_at_risk to
the exposure option, or the variable ln_population_at_risk to the
offset option. The variable names in your dataset will of course
probably differ. An example of the three methods, a constraint, the
exposure option, and the offset option, is shown below. Just copy the
text between *---begin example--- and *----end example--- into do
do-file editor and press the do button.
HTH,
Maarten

*---------------- begin example -------------
sysuse census, clear
gen lnpop65p = ln(pop65p)
constraint 1 lnpop65p = 1
xi: nbreg death popurban i.region lnpop65p, constraint(1)
xi: nbreg death popurban i.region, exposure(pop65p)
xi: nbreg death popurban i.region, offset(lnpop65p) 
*----------------- end example ---------------



-----------------------------------------
Maarten L. Buis
Department of Social Research Methodology
Vrije Universiteit Amsterdam
Boelelaan 1081
1081 HV Amsterdam
The Netherlands

visiting adress:
Buitenveldertselaan 3 (Metropolitan), room Z434

+31 20 5986715

http://home.fsw.vu.nl/m.buis/
-----------------------------------------

Send instant messages to your online friends http://uk.messenger.yahoo.com 
*
*   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/



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