pp_foot | R Documentation |
The function provides posterior predictive plots to check the adequacy of the Bayesian models as
returned by the stan_foot
function.
pp_foot(object, data, type = "aggregated", coverage = 0.95)
object |
An object either of class |
data |
A data frame containing match data with columns:
|
type |
Type of plots, one among |
coverage |
Argument to specify the width |
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
.
A list with elements:
pp_plot
: A ggplot
object for the selected type
of plot.
pp_table
: A data frame of summary statistics:
For "aggregated"
: Goal differences and their Bayesian p‑values.
For "matches"
: Nominal 1-alpha
and observed empirical Bayesian coverage.
Leonardo Egidi legidi@units.it and Roberto Macrì Demartino roberto.macridemartino@deams.units.it
Gelman, A., Carlin, J. B., Stern, H. S., Dunson, D. B., Vehtari, A., & Rubin, D. B. (2013). Bayesian data analysis. CRC press.
## Not run:
if (instantiate::stan_cmdstan_exists()) {
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_sampling = 200)
pp_foot(fit, italy_2000)
}
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.