[R] R-equivalent Stata command: poisson or quasipoisson?

Ben Bolker bbolker at gmail.com
Sun Sep 12 18:58:37 CEST 2010


Wil M Contreras Arbaje <wil.contreras <at> gmail.com> writes:

> 
> Thanks Bill!
> 
> Not asking for help with Stata at all, on the contrary: the article  
> mentioned using Stata to fit the model described earlier, and I wasn't  
> sure how to do the same in R (which is what I've used since college).
> 
> Thanks again, I'll play around a bit glmRob, see what happens (though  
> it's slightly worrisome that I won't be able to obtain similar  
> results, if only for 'contrast').
> 
> Cheers,
> 
> Wil


  I find it very hard to tell from Stata's help page, but my best guess
would be that the previously mentioned Stata command is more or less
equivalent to R's quasipoisson -- the 'robust' specification seems to
apply only to the standard error calculation, not to the fitting process.
What's unclear about 'robust' is that in other (least-squares fitting)
contexts in Stata, it means 'Huber-White sandwich estimators', i.e.
estimators that are robust to heteroscedasticity.  I suppose this is
more general (but also more data-hungry) than the simple expedient of
scaling the standard errors by a single estimated overdispersion parameter.

  The best thing, of course, would be to try a test case in both
systems.  Or it seems that
http://www.stata.com/bookstore/lrm.html (chapter 9) would be helpful.
(I checked the stata list archives for 'quasipoisson' and found only
a post from the author ...)

  Somewhat heretically, I prefer polycultures to monocultures; I like
R for many reasons, but I'm glad that there are other systems out there
with independent implementations and different sets of advantages
and drawbacks.

> 
> On Sep 12, 2010, at 12:36 AM, <Bill.Venables <at> csiro.au> <Bill.Venables
<at> csiro.au 
>  > wrote:
> 
> > In R, the glm families poisson and quasipoisson will give you the  
> > same estimates.  Their standard errors will (usually) be different,  
> > though, and family = quasipoisson does not give you an AIC (since it  
> > does not maximise a true likelihood; it uses quasi-likelihood  
> > estimation).
> >
> > I hope you are not asking this list for help with Stata. We've never  
> > heard of it.  It looks to me, though, that what you are doing below  
> > is fitting a robust poisson glm.  If so, it is something different  
> > again.  There is a package 'robust' which has a glmRob() fitting  
> > function in it that may do something similar, but there is so much  
> > tweaking allowed with robust fits the chance of getting the same  
> > result as with some other system (or even with R if you do it again,  
> > mostly) is effectively zero.
> >
> > Tip: use R and forget the others.  It makes life so much easier all  
> > round.
> >
> >
> > -----Original Message-----
> > From: r-help-bounces <at> r-project.org [mailto:r-help-bounces <at>
r-project.org 
> > ] On Behalf Of Wil M Contreras Arbaje
> > Sent: Sunday, 12 September 2010 11:27 AM
> > To: r-help <at> r-project.org
> > Subject: [R] R-equivalent Stata command: poisson or quasipoisson?
> >
> > Hello R-help,
> >
> > According to a research article that covers the topic I'm analyzing,
> > in Stata, a Poisson pseudo-maximum-likelihood (PPML) estimation can be
> > obtained with the command
> >
> > 	poisson depvar_ij ln(indepvar1_ij) ln(indepvar2_ij) ...
> > ln(indepvarN_ij), robust
> >
> > I looked up Stata help for the command, to understand syntax and such:
> >
> > 	www.stata.com/help.cgi?poisson
> >
> > Which simply says that the command fits a Poisson regression of depvar
> > on indepvars. However, in my google-searching, I noticed that pseudo-
> > maximum-likelihood estimation is sometimes called 'quasi-maximum,' and
> > that R has a "quasipoisson" family that seems to allow for
> > overdispersion. So, am I missing something, or should I specify
> > "quasipoisson" when implementing this estimation?
> >
> > Thanks a lot!
> >
> > Cheers,
> >
> >
> > Wil
> >
> > ______________________________________________
> > 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