Looks up the league's running average and calculates the blended baseline for a specific match date. Uses the most recent data BEFORE the match date to prevent data leakage.
Usage
get_league_baseline_as_of(
event_name,
match_date,
league_lookup,
global_avg_runs,
blend_halflife = LEAGUE_BASELINE_BLEND_HALFLIFE
)Examples
if (FALSE) { # \dontrun{
league_lookup <- build_league_running_averages(conn, "t20")
baseline <- get_league_baseline_as_of(
"Indian Premier League", "2024-04-01", league_lookup, 1.138
)
} # }
