[R] Negative Binomial Model
Achim Zeileis
Achim.Zeileis at wu-wien.ac.at
Wed May 14 11:11:31 CEST 2008
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:
https://stat.ethz.ch/pipermail/r-help/2008-May/161640.html
hth,
Z
> Thank you,
>
> Mike Ryckman
> Department of Political Science
> University of Arizona
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>
More information about the R-help
mailing list