Description Usage Arguments Details Value Author(s) References See Also Examples
View source: R/residuals.BTm.R
Computes residuals from a model object of class "BTm"
. In additional
to the usual options for objects inheriting from class "glm"
, a
"grouped"
option is implemented to compute player-specific residuals
suitable for diagnostic checking of a predictor involving player-level
covariates.
1 2 3 4 5 6 7 |
object |
a model object for which |
type |
the type of residuals which should be returned. The
alternatives are: |
by |
the grouping factor to use when |
... |
arguments to pass on other methods. |
For type
other than "grouped"
see residuals.glm()
.
For type = "grouped"
the residuals returned are weighted means of
working residuals, with weights equal to the binomial denominators in the
fitted model. These are suitable for diagnostic model checking, for example
plotting against candidate predictors.
A numeric vector of length equal to the number of players, with a
"weights"
attribute.
David Firth and Heather Turner
Firth, D. (2005) Bradley-Terry models in R. Journal of Statistical Software 12(1), 1–12.
Turner, H. and Firth, D. (2012) Bradley-Terry models in R: The BradleyTerry2 package. Journal of Statistical Software, 48(9), 1–21.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | ##
## See ?springall
##
springall.model <- BTm(cbind(win.adj, loss.adj),
col, row,
~ flav[..] + gel[..] +
flav.2[..] + gel.2[..] + flav.gel[..] + (1 | ..),
data = springall)
res <- residuals(springall.model, type = "grouped")
with(springall$predictors, plot(flav, res))
with(springall$predictors, plot(gel, res))
## Weighted least-squares regression of these residuals on any variable
## already included in the model yields slope coefficient zero:
lm(res ~ flav, weights = attr(res, "weights"),
data = springall$predictors)
lm(res ~ gel, weights = attr(res, "weights"),
data = springall$predictors)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.