add1.BTm: Add or Drop Single Terms to/from a Bradley Terry Model

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/add1.BTm.R

Description

Add or drop single terms within the limit specified by the scope argument. For models with no random effects, compute an analysis of deviance table, otherwise compute the Wald statistic of the parameters that have been added to or dropped from the model.

Usage

1
2
## S3 method for class 'BTm'
add1(object, scope, scale = 0, test = c("none", "Chisq", "F"), x = NULL, ...)

Arguments

object

a fitted object of class inheriting from "BTm".

scope

a formula specifying the model including all terms to be considered for adding or dropping.

scale

an estimate of the dispersion. Not implemented for models with random effects.

test

should a p-value be returned? The F test is only appropriate for models with no random effects for which the dispersion has been estimated. The Chisq test is a likelihood ratio test for models with no random effects, otherwise a Wald test.

x

a model matrix containing columns for all terms in the scope. Useful if add1 is to be called repeatedly. Warning: no checks are done on its validity.

...

further arguments passed to add1.glm().

Details

The hierarchy is respected when considering terms to be added or dropped: all main effects contained in a second-order interaction must remain, and so on.

In a scope formula . means ‘what is already there’.

For drop1, a missing scope is taken to mean that all terms in the model may be considered for dropping.

If scope includes player covariates and there are players with missing values over these covariates, then a separate ability will be estimated for these players in all fitted models. Similarly if there are missing values in any contest-level variables in scope, the corresponding contests will be omitted from all models.

If formula includes random effects, the same random effects structure will apply to all models.

Value

An object of class "anova" summarizing the differences in fit between the models.

Author(s)

Heather Turner

See Also

BTm(), anova.BTm()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
result <- rep(1, nrow(flatlizards$contests))
BTmodel1 <- BTm(result, winner, loser,
                ~ throat.PC1[..] + throat.PC3[..] + (1|..),
                data = flatlizards,
                tol = 1e-4, sigma = 2, trace = TRUE)

drop1(BTmodel1)

add1(BTmodel1, ~ . + head.length[..] + SVL[..], test = "Chisq")

BTmodel2 <- update(BTmodel1, formula = ~ . + head.length[..])

drop1(BTmodel2, test = "Chisq")

BradleyTerry2 documentation built on Feb. 3, 2020, 5:08 p.m.