
Estimate Player Stat Ratings Using Bayesian Conjugate Priors
Source:R/stat_ratings.R
estimate_player_stat_ratings.RdFor each player, estimates "true stat rating" at a reference date using all prior matches. Uses conjugate Bayesian updating with exponential time decay.
Usage
estimate_player_stat_ratings(
stat_data,
ref_date = NULL,
params = NULL,
stat_defs = NULL,
compute_ci = TRUE
)Arguments
- stat_data
data.table from
prepare_stat_rating_data.- ref_date
Date to estimate ratings as of. Only matches before this date are used. If NULL, uses one day after the latest match.
- params
Named list from
default_stat_rating_params.- stat_defs
data.frame from
stat_rating_definitions.- compute_ci
Logical. If TRUE (default), compute credible intervals.
Value
data.table with one row per player containing:
player_id, role_group, n_matches, wt_matches,
ref_date, and for each stat: {stat}_rating,
{stat}_rating_lower, {stat}_rating_upper.
Details
Rate stats (per-ball): Gamma-Poisson model. Raw event counts
are decay-weighted; the Gamma prior is centered on the role mean with
strength controlled by prior_strength. Posterior mean gives the
estimated per-ball rate.
Efficiency stats (proportions): Beta-Binomial model. Successes
and attempts are decay-weighted; the Beta prior is centered on the
role mean with strength controlled by prior_strength.