Re: [R] Negative Binomial Model

From: Ted Harding <>
Date: Wed, 14 May 2008 10:38:28 +0100 (BST)

On 14-May-08 09:11:31, Achim Zeileis wrote:

> On Wed, 14 May 2008, Mike Ryckman wrote:

>> Hello,
>> I am trying to run a negative binomial regression model in R and
>> can't get the standard errors to match the output I get from the
>> Stata nbreg command. I've tried a few different options but
>> haven't had much luck. The closest I've found is:
>> gamlss(formula, family = NBI, sigma.formula = ~ 1,data=dataframe)
>> ...But this is still a little off most of the time and pretty far off
>> at
>> other
>> times (compared with the Stata output). The glm.nb from the MASS
>> package
>> produces the correct coefficients, but different (usually very
>> different)
>> standard errors.
>> Could anybody explain this and point me in the right direction? I'd
>> really
>> appreciate it.
> Well, you don't really give us enough information to know (a
> reproducible 
> R example and the desired standard errors from Stata would have been 
> helpful). My guess is that Stata uses some sort of "robust" standard 
> errors, i.e., sandwich standard errors. Try something like:
>    library("MASS")
>    library("sandwich")
>    library("lmtest")
>    fm <- glm.nb(...)
>    coeftest(fm, vcov = sandwich)
> See also the following thread for some more discussion for count data 
> regression in R and Stata:

Better links for following this thread are:


Then click on "Next message:" for the second. Unfortunately, at that point the thread broke (Paul next responded to the list as a reply to an off-list message I sent him). So to continue, next take Achim's URL above:

and thereafter continue to click on "Next message:" until the thread runs out.

That was a very helpful thread, for me!
Best wishes,

E-Mail: (Ted Harding) <> Fax-to-email: +44 (0)870 094 0861
Date: 14-May-08                                       Time: 10:38:24
------------------------------ XFMail ------------------------------

______________________________________________ mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Wed 14 May 2008 - 11:44:07 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 14 May 2008 - 16:30:38 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive