[R] Comparing Negative Binomial Regression in Stata and R. Constants differ?

Prof Brian Ripley ripley at stats.ox.ac.uk
Thu Dec 4 17:16:27 CET 2003


On Thu, 4 Dec 2003, Paul E. Johnson wrote:

> I looked for examples of count data that might interest the students and 
> found this project about dropout rates in Los Angeles High Schools.  It 
> is discussed in the UCLA stats help pages for the Stata users:
> http://www.ats.ucla.edu/stat/stata/library/count.htm
> and
> See: http://www.ats.ucla.edu/stat/stata/library/longutil.htm
> 
> To replicate those results, I used R's excellent foreign package to 
> bring the lahigh data in, then did
> poisReg1 <- glm(daysabs~gender+ 
> mathnce+langnce,family=poisson(link=log), data=lahigh)
> library(MASS)
> negbinReg1 <- glm.nb(daysabs~gender+ mathnce+langnce,link=log, data=lahigh)
> 
> The parameter estimates of the coefficients are the just about the same, 
> except for the intercept estimates.  Below I pasted in the Negative 
> Binomial results I got from R along with the Stata results that they 

Actually, from V&R's MASS package, excellent or otherwise but worthy of 
credit!

> report.  In the Stata output, they report alpha, same as 1/theta from 
> the R glm.nb output.  Except for minor differences in standard errors, 
> only the intercept estimates markedly differ.

What are the variable codings used?  Intercepts depend on coding of 
factors, and that applies to any sort of regression.

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595




More information about the R-help mailing list