Skip to contents

Comparison of cumulative link models in likelihood ratio tests. The models may differ by terms in location, scale and nominal formulae, in link, threshold function and random effect structure.

Usage

# S3 method for class 'clm2'
anova(object, ..., test = c("Chisq", "none"))
# S3 method for class 'clmm2'
anova(object, ..., test = c("Chisq", "none"))

Arguments

object

a clm2 object.

...

one or more additional clm2 objects.

test

if test = "none" the p-value for the likelihood ratio test is suppressed.

Value

The method returns an object of class Anova (for printing) and data.frame with the following elements

Model

character description of the cumulative link models being compared. Location, scale and nominal formulae are separated by "|"s in this order.

Resid.df

the residual degrees of freedom

-2logLik

twice the negative log likelihood (proportional to the deviance)

Test

indication of which models are being compared.

DF

the difference in the degrees of freedom in the models being compared, i.e. the degrees of freedom for the chi-squared test.

LR stat.

the likelihood ratio statistic.

Pr(Chi)

the p-value from the likelihood ratio test. Absent if test = "none".

Author

Rune Haubo B Christensen

See also

clm2, addterm, dropterm and anova.default

Examples

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