Learn R Programming

fbRanks (version 2.0)

residuals.fbRanks: Residuals function for fbRanks Objects

Description

The rank.teams function outputs fbRanks objects. residuals(fbRanks)., where fbRanks is one's output from a rank.teams call, returns the model response residuals (data minus fitted values) for each match in the fbRanks$scores data frame. The output is organized as a list by team. If you just want the response residuals for each match, that is in fbRanks$scores$home.residuals and $away.residuals.

Usage

"residuals"(object, ...)

Arguments

object
A fbRanks object.
...
Other filters to apply when returning residuals. These must match column names in either x$teams or x$scores. For example, if x$teams has a column named 'country' with values 'UK','Canada' and 'Germany', you can pass in country="UK" to only show UK residuals.

Value

A list of the response residuals (data minus fitted values) for each team. It's rather verbose. You probably want to assign it to a variable and work with that. Look at predict.fbRanks. That provides similar output in the $scores variable.

See Also

predict.fbRanks

Examples

Run this code

data(B00data) #load a set of games
#fit a model using just the matches from the RCL D1 league
x=rank.teams(scores=B00.scores, teams=B00.teams, venue="RCL D1")

#Show the predicted versus actual scores
b00.resids=residuals(x)

## Not run: 
# #you can compare to the residuals for a model to fit to all the data (including RCL D1)
# x=rank.teams(scores=B00.scores, teams=B00.teams)
# 
# #Just a printing of the ranks with no extra info shown.
# b00.resids=residuals(x, venue="RCL D1")
# ## End(Not run)

Run the code above in your browser using DataLab