plot_logStrength {footBayes} | R Documentation |
Plot Rankings for btdFoot Objects
Description
Visualizes team rankings based on whether the ranking is dynamic or static.
Usage
plot_logStrength(x, teams = NULL, ...)
Arguments
x |
An object of class |
teams |
An optional character vector specifying team names to include in the rankings plot. If |
... |
Additional arguments passed to |
Details
Dynamic Ranking: Plots Rank Points over Periods for each team with lines and points.
Static Ranking: Plots Rank Points on the x-axis against Team Names on the y-axis with horizontal lines and points.
Value
A ggplot object representing the rankings plot.
Author(s)
Roberto Macrì Demartino roberto.macridemartino@phd.unipd.it.
Examples
## Not run:
library(dplyr)
data("italy")
italy_2020_2021_rank <- italy %>%
select(Season, home, visitor, hgoal, vgoal) %>%
filter(Season == "2020" | Season == "2021") %>%
mutate(match_outcome = case_when(
hgoal > vgoal ~ 1, # Home team wins
hgoal == vgoal ~ 2, # Draw
hgoal < vgoal ~ 3 # Away team wins
)) %>%
mutate(periods = case_when(
row_number() <= 190 ~ 1,
row_number() <= 380 ~ 2,
row_number() <= 570 ~ 3,
TRUE ~ 4
)) %>% # Assign periods based on match number
select(periods, home_team = home,
away_team = visitor, match_outcome)
fit_rank_dyn <- btd_foot(
data = italy_2020_2021_rank,
dynamic_rank = TRUE,
rank_measure = "median",
iter = 1000,
cores = 2,
chains = 2)
plot_logStrength(fit_rank_dyn)
plot_logStrength(fit_rank_dyn, teams = c("AC Milan", "AS Roma", "Juventus", "Inter"))
## End(Not run)
[Package footBayes version 1.0.0 Index]