Method function to perform sequential likelihood ratio tests for Negative Binomial generalized linear models.

# S3 method for class 'negbin'
anova(object, ..., test = "Chisq")

Arguments

object

Fitted model object of class "negbin", inheriting from classes "glm" and "lm", specifying a Negative Binomial fitted GLM. Typically the output of glm.nb().

...

Zero or more additional fitted model objects of class "negbin". They should form a nested sequence of models, but need not be specified in any particular order.

test

Argument to match the test argument of anova.glm. Ignored (with a warning if changed) if a sequence of two or more Negative Binomial fitted model objects is specified, but possibly used if only one object is specified.

Note

If only one fitted model object is specified, a sequential analysis of deviance table is given for the fitted model. The theta parameter is kept fixed. If more than one fitted model object is specified they must all be of class "negbin" and likelihood ratio tests are done of each model within the next. In this case theta is assumed to have been re-estimated for each model.

Details

This function is a method for the generic function anova() for class "negbin". It can be invoked by calling anova(x) for an object x of the appropriate class, or directly by calling anova.negbin(x) regardless of the class of the object.

References

Venables, W. N. and Ripley, B. D. (2002) Modern Applied Statistics with S. Fourth edition. Springer.

Examples

m1 <- glm.nb(Days ~ Eth*Age*Lrn*Sex, quine, link = log)
m2 <- update(m1, . ~ . - Eth:Age:Lrn:Sex)
anova(m2, m1)
#> Likelihood ratio tests of Negative Binomial Models
#> 
#> Response: Days
#>                                                                                                                                       Model
#> 1 Eth + Age + Lrn + Sex + Eth:Age + Eth:Lrn + Age:Lrn + Eth:Sex + Age:Sex + Lrn:Sex + Eth:Age:Lrn + Eth:Age:Sex + Eth:Lrn:Sex + Age:Lrn:Sex
#> 2                                                                                                                     Eth * Age * Lrn * Sex
#>     theta Resid. df    2 x log-lik.   Test    df LR stat.   Pr(Chi)
#> 1 1.90799       120       -1040.728                                
#> 2 1.92836       118       -1039.324 1 vs 2     2 1.403843 0.4956319
anova(m2)
#> Warning: tests made without re-estimating 'theta'
#> Analysis of Deviance Table
#> 
#> Model: Negative Binomial(1.908), link: log
#> 
#> Response: Days
#> 
#> Terms added sequentially (first to last)
#> 
#> 
#>             Df Deviance Resid. Df Resid. Dev  Pr(>Chi)    
#> NULL                          145     270.03              
#> Eth          1  19.0989       144     250.93 1.241e-05 ***
#> Age          3  16.3483       141     234.58  0.000962 ***
#> Lrn          1   3.5449       140     231.04  0.059730 .  
#> Sex          1   0.3989       139     230.64  0.527666    
#> Eth:Age      3  14.6030       136     216.03  0.002189 ** 
#> Eth:Lrn      1   0.0447       135     215.99  0.832601    
#> Age:Lrn      2   1.7482       133     214.24  0.417240    
#> Eth:Sex      1   1.1470       132     213.09  0.284183    
#> Age:Sex      3  21.9746       129     191.12 6.603e-05 ***
#> Lrn:Sex      1   0.0277       128     191.09  0.867712    
#> Eth:Age:Lrn  2   9.0099       126     182.08  0.011054 *  
#> Eth:Age:Sex  3   4.8218       123     177.26  0.185319    
#> Eth:Lrn:Sex  1   3.3160       122     173.94  0.068608 .  
#> Age:Lrn:Sex  2   6.3941       120     167.55  0.040882 *  
#> ---
#> Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1