Negative Binomial Generalized Linear Model (Regression)
book
Article ID: KB0080749
calendar_today
Updated On:
Products
Versions
Spotfire S+
All supported versions
Description
How to calculate a Negative Binomial generalized linear model including a theta parameter.
Issue/Introduction
Negative Binomial Generalized Linear Model (Regression)
Environment
Product: TIBCO Spotfire S+
Version: All supported versions
OS: All supported operating systems
--------------------
Resolution
The MASS library (written by Dr. Venables and Professor Ripley) contains the function 'glm.nb', which is a modification of the system function glm() to include estimation of the additional parameter, theta, for a Negative Binomial generalized linear model. To load the MASS library in your S-PLUS session, type:
> library(MASS) [1] "This library is not supported by Insightful, Corp."
Once you have the library loaded, you can view the help file for glm.nb by typing the following at the command line:
> ?glm.nb
Here is an example that uses this function:
> glm.nb(Days ~ Sex/(Age + Eth*Lrn), data = quine) Call: glm.nb(formula = Days ~ Sex/(Age + Eth * Lrn), data = quine, init.theta = 1.59799070541236, link = log)
Degrees of Freedom: 146 Total; 132 Residual Residual Deviance: 167.5558222
Unfortunately, the MASS library functions are not supported by S+ Technical Support, but you can view the website to the MASS (Modern Applied Statistics with S) book and software at:
http://www.stats.ox.ac.uk/pub/MASS4/index.html
"Modern Applied Statistics with S" contains a discussion on the Negative Binomial Family on pages 206-208.