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(object, data, type = c("aggregated", "matches"), coverage = 0.95)
Arguments
object |
An object of class |
data |
A data frame containing match data with columns:
|
type |
Type of plots, one among |
coverage |
Argument to specify the width |
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:
library(dplyr)
data("italy")
italy_2000 <- italy %>%
dplyr::select(Season, home, visitor, hgoal,vgoal) %>%
dplyr::filter(Season=="2000")
colnames(italy_2000) <- c("periods", "home_team", "away_team", "home_goals", "away_goals")
fit <- stan_foot(italy_2000, "double_pois", iter = 200)
pp_foot(fit, italy_2000)
## End(Not run)