Skip to contents

Add all model terms to scale and nominal formulae and perform likelihood ratio tests. These tests can be viewed as goodness-of-fit tests. With the logit link, nominal_test provides likelihood ratio tests of the proportional odds assumption. The scale_test tests can be given a similar interpretation.

Usage

nominal_test(object, ...)

# S3 method for class 'clm'
nominal_test(object, scope, trace=FALSE, ...)

scale_test(object, ...)

# S3 method for class 'clm'
scale_test(object, scope, trace=FALSE, ...)

Arguments

object

for the clm method an object of class "clm", i.e., the result of a call to clm.

scope

a formula or character vector specifying the terms to add to scale or nominal. In nominal_test terms in scope already in nominal are ignored. In scale_test terms in scope already in scale are ignored.

In nominal_test the default is to add all terms from formula (location part) and scale that are not also in nominal.

In scale_test the default is to add all terms from formula (location part) that are not also in scale.

trace

if TRUE additional information may be given on the fits as they are tried.

...

arguments passed to or from other methods.

Value

A table of class "anova" containing columns for the change in degrees of freedom, AIC, the likelihood ratio statistic and a p-value based on the asymptotic chi-square distribtion of the likelihood ratio statistic under the null hypothesis.

Details

The definition of AIC is only up to an additive constant because the likelihood function is only defined up to an additive constant.

Author

Rune Haubo B Christensen

Examples


## Fit cumulative link model:
fm <- clm(rating ~ temp + contact, data=wine)
summary(fm)
#> formula: rating ~ temp + contact
#> data:    wine
#> 
#>  link  threshold nobs logLik AIC    niter max.grad cond.H 
#>  logit flexible  72   -86.49 184.98 6(0)  4.01e-12 2.7e+01
#> 
#> Coefficients:
#>            Estimate Std. Error z value Pr(>|z|)    
#> tempwarm     2.5031     0.5287   4.735 2.19e-06 ***
#> contactyes   1.5278     0.4766   3.205  0.00135 ** 
#> ---
#> Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
#> 
#> Threshold coefficients:
#>     Estimate Std. Error z value
#> 1|2  -1.3444     0.5171  -2.600
#> 2|3   1.2508     0.4379   2.857
#> 3|4   3.4669     0.5978   5.800
#> 4|5   5.0064     0.7309   6.850
## test partial proportional odds assumption for temp and contact:
nominal_test(fm)
#> Tests of nominal effects
#> 
#> formula: rating ~ temp + contact
#>         Df  logLik    AIC    LRT Pr(>Chi)
#> <none>     -86.492 184.98                
#> temp     3 -84.904 187.81 3.1750   0.3654
#> contact  3 -86.209 190.42 0.5667   0.9040
## no evidence of non-proportional odds.
## test if there are signs of scale effects:
scale_test(fm)
#> Tests of scale effects
#> 
#> formula: rating ~ temp + contact
#>         Df  logLik    AIC     LRT Pr(>Chi)
#> <none>     -86.492 184.98                 
#> temp     1 -86.439 186.88 0.10492   0.7460
#> contact  1 -86.355 186.71 0.27330   0.6011
## no evidence of scale effects.

## tests of scale and nominal effects for the housing data from MASS:
if(require(MASS)) {
    fm1 <- clm(Sat ~ Infl + Type + Cont, weights = Freq, data = housing)
    scale_test(fm1)
    nominal_test(fm1)
    ## Evidence of multiplicative/scale effect of 'Cont'. This is a breach
    ## of the proportional odds assumption.
}
#> Tests of nominal effects
#> 
#> formula: Sat ~ Infl + Type + Cont
#>        Df  logLik    AIC    LRT Pr(>Chi)
#> <none>    -1739.6 3495.1                
#> Infl    2 -1739.0 3498.0 1.1065   0.5751
#> Type    3 -1736.7 3495.4 5.7337   0.1253
#> Cont    1 -1738.3 3494.7 2.4446   0.1179