Skip to contents

Type I, II, and III analysis of deviance (ANODE) tables for cumulative link models and comparison of cumulative link models with likelihood ratio tests. Models may differ by terms in location, scale and nominal formulae, in link, threshold function.

Usage

# S3 method for class 'clm'
anova(object, ..., type = c("I", "II", "III", "1", "2", "3"))

Arguments

object

a clm object.

...

optionally one or more additional clm objects.

type

the type of hypothesis test if anova is called with a single model; ignored if more than one model is passed to the method.

Details

The ANODE table returned when anova is called with a single model apply only to terms in formula, that is, terms in nominal and scale are ignored.

Value

An analysis of deviance table based on Wald chi-square test if called with a single model and a comparison of models with likelihood ratio tests if called with more than one model.

Author

Rune Haubo B Christensen

See also

Examples


## Analysis of deviance tables with Wald chi-square tests:
fm <- clm(rating ~ temp * contact, scale=~contact, data=wine)
anova(fm, type="I")
#> Type I Analysis of Deviance Table with Wald chi-square tests
#> 
#>              Df   Chisq Pr(>Chisq)    
#> temp          1 17.1046  3.538e-05 ***
#> contact       1  9.1574   0.002477 ** 
#> temp:contact  1  0.1097   0.740512    
#> ---
#> Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
anova(fm, type="II")
#> Type II Analysis of Deviance Table with Wald chi-square tests
#> 
#>              Df   Chisq Pr(>Chisq)    
#> temp          1 17.1046  3.538e-05 ***
#> contact       1  9.1574   0.002477 ** 
#> temp:contact  1  0.1097   0.740512    
#> ---
#> Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
anova(fm, type="III")
#> Type III Analysis of Deviance Table with Wald chi-square tests
#> 
#>              Df   Chisq Pr(>Chisq)    
#> temp          1 17.1046  3.538e-05 ***
#> contact       1  9.1574   0.002477 ** 
#> temp:contact  1  0.1097   0.740512    
#> ---
#> Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

options(contrasts = c("contr.treatment", "contr.poly"))
m1 <- clm2(SURENESS ~ PROD, scale = ~PROD, data = soup,
          link = "logistic")

## anova
anova(m1, update(m1, scale = ~.-PROD))
#> Likelihood ratio tests of cumulative link models
#> 
#> Response: SURENESS
#>            Model Resid. df -2logLik   Test    Df LR stat.  Pr(Chi)
#> 1    PROD | 1 |       1841 5380.664                               
#> 2 PROD | PROD |       1840 5375.489 1 vs 2     1 5.174937 0.022915
mN1 <- clm2(SURENESS ~ 1, nominal = ~PROD, data = soup,
           link = "logistic")
anova(m1, mN1)
#> Likelihood ratio tests of cumulative link models
#> 
#> Response: SURENESS
#>            Model Resid. df -2logLik   Test    Df LR stat.   Pr(Chi)
#> 1 PROD | PROD |       1840 5375.489                                
#> 2    1 |  | PROD      1837 5370.114 1 vs 2     3 5.375473 0.1462793
anova(m1, update(m1, scale = ~.-PROD), mN1)
#> Likelihood ratio tests of cumulative link models
#> 
#> Response: SURENESS
#>            Model Resid. df -2logLik   Test    Df LR stat.   Pr(Chi)
#> 1    PROD | 1 |       1841 5380.664                                
#> 2 PROD | PROD |       1840 5375.489 1 vs 2     1 5.174937 0.0229150
#> 3    1 |  | PROD      1837 5370.114 2 vs 3     3 5.375473 0.1462793

## Fit model from polr example:
if(require(MASS)) {
    fm1 <- clm2(Sat ~ Infl + Type + Cont, weights = Freq, data = housing)
    anova(fm1, update(fm1, scale =~ Cont))
}
#> Likelihood ratio tests of cumulative link models
#> 
#> Response: Sat
#>                          Model Resid. df -2logLik   Test    Df LR stat.
#> 1     Infl + Type + Cont |  |       1673 3479.149                      
#> 2 Infl + Type + Cont | Cont |       1672 3473.493 1 vs 2     1 5.655882
#>      Pr(Chi)
#> 1           
#> 2 0.01739692