pp_foot {footBayes}R Documentation

Posterior predictive checks for football models

Description

The function provides posterior predictive plots to check the adequacy of the Bayesian models as returned by the stan_foot function.

Usage

pp_foot(data, object, type = c("aggregated", "matches"), coverage = 0.95)

Arguments

data

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

object

An object of class stanfit as given by stan_foot function.

type

Type of plots, one among "aggregated" or "matches".

coverage

Argument to specify the width 1-\alpha of posterior probability intervals. Default is 0.95.

Value

Posterior predictive plots: when "aggregated" (default) is selected, the function returns a frequency plot for some pre-selected goal-difference values, along with their correspondent Bayesian p-values, computed as Pr(y_rep \ge y)|y), where y_rep is a data replication from the posterior predictive distribution (more details in Gelman et al., 2013). Bayesian p-values very close to 0 or 1 could exhibit possible model misfits.

When "matches" is selected an ordered-frequency plot for all the goal-differences in the considered matches is provided, along with the empirical Bayesian coverage at level 1-\alpha.

Author(s)

Leonardo Egidi legidi@units.it

References

Gelman, A., Carlin, J. B., Stern, H. S., Dunson, D. B., Vehtari, A., & Rubin, D. B. (2013). Bayesian data analysis. CRC press.

Examples


## Not run: 
require(dplyr)

data("italy")
italy_2000<- italy %>%
 dplyr::select(Season, home, visitor, hgoal,vgoal) %>%
 dplyr::filter(Season=="2000")

fit <- stan_foot(italy_2000, "double_pois", iter = 200)

pp_foot(italy_2000, fit)


## End(Not run)


[Package footBayes version 0.2.0 Index]