foot_abilities {footBayes}R Documentation

Plot football abilities from Stan and MLE models

Description

Depicts teams' abilities either from the Stan models fitted via the stan_foot function or from MLE models fitted via the mle_foot function.

Usage

foot_abilities(object, data, type = c("attack", "defense", "both"), team, ...)

Arguments

object

An object either of class stanfit as given by stan_foot function or class list containing the Maximum Likelihood Estimates (MLE) for the model parameters fitted with mle_foot.

data

A data frame, or a matrix containing the following mandatory items: home team, away team, home goals, away goals.

type

Type of ability in Poisson models: one among "defense", "attack" or "both".

team

Valid team names.

...

Optional graphical parameters.

Value

Abilities plots for the selected teams: for Poisson models only, red denotes the attack, blue the defense.

Author(s)

Leonardo Egidi legidi@units.it

Examples

## Not run: 
require(dplyr)
require(tidyverse)

data("italy")
italy <- as_tibble(italy)

### no dynamics, no prediction

italy_2000_2002<- italy %>%
 dplyr::select(Season, home, visitor, hgoal, vgoal) %>%
 dplyr::filter(Season=="2000" |  Season=="2001" | Season =="2002")

fit1 <- stan_foot(data = italy_2000_2002,
                model="double_pois") # double poisson

fit2 <- stan_foot(data = italy_2000_2002,
                model="biv_pois")    # bivariate poisson

fit3 <- stan_foot(data = italy_2000_2002,
                model="skellam")     # skellam

fit4 <- stan_foot(data = italy_2000_2002,
                model="student_t")   # student_t

foot_abilities(fit1, italy_2000_2002)
foot_abilities(fit2, italy_2000_2002)
foot_abilities(fit3, italy_2000_2002)
foot_abilities(fit4, italy_2000_2002)

### seasonal dynamics, predict the last season

fit5 <-stan_foot(data = italy_2000_2002,
                       model="biv_pois", predict =306,
                       dynamic_type = "seasonal")   # bivariate poisson
foot_abilities(fit5, italy_2000_2002)


## End(Not run)

[Package footBayes version 0.2.0 Index]