\begin{Schunk}
\begin{Sinput}
 library(faraway)
 library(MASS)
 gavote$undercount <- gavote$ballots - gavote$votes
 myNB1<- glm.nb(undercount ~ rural + perAA + equip, data = gavote)
 summary(myNB1)
\end{Sinput}
\begin{Soutput}
Call:
glm.nb(formula = undercount ~ rural + perAA + equip, data = gavote, 
    init.theta = 1.392872977, link = log)

Deviance Residuals: 
    Min       1Q   Median       3Q      Max  
-4.0391  -0.9568  -0.2554   0.3143   3.5058  

Coefficients:
            Estimate Std. Error z value Pr(>|z|)    
(Intercept)   5.2137     0.1619  32.202  < 2e-16 ***
ruralurban    0.9094     0.1660   5.478 4.30e-08 ***
perAA         0.4746     0.4444   1.068  0.28556    
equipOS-CC    0.5481     0.1696   3.231  0.00124 ** 
equipOS-PC    0.9117     0.2102   4.338 1.44e-05 ***
equipPAPER   -1.3644     0.6177  -2.209  0.02720 *  
equipPUNCH    1.4606     0.2442   5.982 2.20e-09 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

(Dispersion parameter for Negative Binomial(1.3929) family taken to be 1)

    Null deviance: 358.48  on 158  degrees of freedom
Residual deviance: 180.33  on 152  degrees of freedom
AIC: 2228.8

Number of Fisher Scoring iterations: 1


              Theta:  1.393 
          Std. Err.:  0.146 

 2 x log-likelihood:  -2212.833 
\end{Soutput}
\begin{Sinput}
 predictOMatic(myNB1)
\end{Sinput}
\begin{Soutput}
$rural
  rural     perAA equip      fit
1 rural 0.2429811 LEVER 206.2314
2 urban 0.2429811 LEVER 512.0371

$perAA
  rural  perAA equip      fit
1 rural 0.0000 LEVER 183.7701
2 rural 0.1115 LEVER 193.7562
3 rural 0.2330 LEVER 205.2568
4 rural 0.3480 LEVER 216.7704
5 rural 0.7650 LEVER 264.2083

$equip
  rural     perAA equip       fit
1 rural 0.2429811 LEVER 206.23142
2 rural 0.2429811 OS-CC 356.76262
3 rural 0.2429811 OS-PC 513.21477
4 rural 0.2429811 PUNCH 888.53690
5 rural 0.2429811 PAPER  52.69805
\end{Soutput}
\end{Schunk}
