alrtest is a helper function to simulate the functions lmtest::waldtest() and lmtest::lrtest() for adjusted chantrics objects. The method can be employed to compare nested models (see details).

alrtest(object, ...)



a chantrics object as returned from adj_loglik().


further object specifications (see details), as well as named parameters that will be passed to chandwich::compare_models(). The type of adjustment, out of "vertical", "cholesky", "spectral", "none", as specified in the parameter type, can also be specified here.


An object of class "anova" inheriting from class "data.frame". The columns are as follows:


The residual number of degrees of freedom in the model.


The increase in residual degrees of freedom with respect to the model in the row above.


The adjusted likelihood ratio statistic.


The p-value of the test that the model above is a "significantly better" model as the one in the current row.


This function is a helper function that creates an interface to anova.chantrics() that is similar to lmtest::waldtest() and lmtest::lrtest().

The standard method is to compare the fitted model object object with the models in .... Instead of passing the fitted models into ..., other specifications are possible. Note that the types of specifications cannot be mixed, except between numerics/characters. The type of the second object supplied determines the algorithm used.

  • "chantrics" objects: When supplying two or more "chantrics" objects, they will be sorted as in anova.chantrics(). Then, the ALRTS will be computed consecutively between the two neighbouring models. Note that all models must be nested. For details refer to anova.chantrics().

  • "numeric": If the second object is "numeric" or "character", then "numeric" objects corresponding element in attr(terms(object1), "term.labels") will be turned into their corresponding "character" element and will be handled as in "character" below.

  • "character": If the second object is "numeric" or "character", then the "character" objects are consecutively included in an update formula like update(object1, . ~ . - object2)

  • "formula": If the second object is a "formula", then the second model will be computed as update(object1, object2).

Then, the adjusted likelihood ratio test statistic (ALRTS), as described in Section 3.5 of Chandler and Bate (2007), is computed by anova.chantrics().

If a single unnamed object is passed in ..., sequential ANOVA is performed on object.


R. E. Chandler and S. Bate, Inference for clustered data using the independence loglikelihood, Biometrika, 94 (2007), pp. 167–183. doi: 10.1093/biomet/asm015 .

See also

anova.chantrics() for the implementation of the computations of the test statistics.

lmtest::waldtest() and lmtest::lrtest() for syntax.