Description Usage Arguments Value References Examples
Calculates the WElo and Elo rates according to \insertCiteangelini2021weighted;textualwelo. In particular, the Elo updating system defines the rates (for player i) as:
E_{i}(t+1) = E_{i}(t) + K_i(t) ≤ft[W_{i}(t)- \hat{p}_{i,j}(t) \right],
where E_{i}(t) is the Elo rate at time t, W_{i}(t) is the outcome (1 or 0) for player i in the match at time t,
K_i(t) is a scale factor, and \hat{p}_{i,j}(t) is the probability of winning for match at time t, calculated using tennis_prob
.
The scale factor K_i(t) determines how much the rates change over time. By default, according to \insertCitekovalchik_2016;textualwelo, it is defined as
K_i(t)=250/≤ft(N_i(t)+5\right)^{0.4},
where N_i(t) is the number of matches disputed by player i up to time t. Alternately, K_i(t) can be multiplied by 1.1 if the match at time t is a Grand Slam match or is played on a given surface. Finally, it can be fixed to a constant value. The WElo rating system is defined as:
E_{i}^\ast(t+1) = E_{i}^\ast(t) + K_i(t) ≤ft[W_{i}(t)- \hat{p}_{i,j}^\ast(t) \right] f(W_{i,j}(t)),
where E_{i}^\ast(t+1) denotes the WElo rate for player i, \hat{p}_{i,j}^\ast(t) the probability of winning using tennis_prob
and
the WElo rates, and f(W_{i,j}(t)) represents a function whose values depend on the games (by default) or sets won in the previous match.
In particular, when parameter 'W' is set to "GAMES", f(W_{i,j}(t)) is defined as:
f(W_{i,j}(t)) \equiv f(G_{i,j}(t))= ≤ft\{ \begin{array}{ll} \frac{NG_i(t)}{NG_i(t)+NG_j(t)} \quad if~player~i~has~won~match~t;\\ \frac{NG_j(t)}{NG_i(t)+NG_j(t)} \quad if~player~i~has~lost~match~t, \end{array} \right.
where NG_i(t) and NG_j(t) represent the number of games won by player i and player j in match t, respectively. When parameter 'W' is set to "SET", f(W_{i,j}(t)) is:
f(W_{i,j}(t)) \equiv f(S_{i,j}(t))= ≤ft\{ \begin{array}{ll} \frac{NS_i(t)}{NS_i(t)+NS_j(t)} \quad if~player~i~has~won~match~t;\\ \frac{NS_j(t)}{NS_i(t)+NS_j(t)} \quad if~player~i~has~lost~match~t, \end{array} \right.
where NS_i(t) and NS_j(t) represent the number of sets won by player i and player j in match t, respectively. The scale factor K_i(t) is the same as the Elo model.
1 2 3 4 5 6 7 8 9 10 |
x |
Data cleaned through the function |
W |
optional Weights to use for the WElo rating system. Valid choices are: "GAMES" (by default) and "SETS" |
SP |
optional Starting points for calculating the rates. 1500 by default |
K |
optional Scale factor determining how much the WElo and Elo rates change over time. Valid choices are: "Kovalchik" (by default), "Grand_Slam", "Surface_Hard", "Surface_Grass", "Surface_Clay" and, finally, a constant value K. The first option ("Kovalchik") is equal to what was suggested by \insertCitekovalchik_2016;textualwelo, Putting K to "Grand_Slam" lets the Kovalchik scale factor multiplied by 1.1, if the match is a Grand Slam match. Similarly, the choices "Surface_Hard", "Surface_Grass" and "Surface_Clay" make the Kovalchik scale factor increased by 1.1 if, respectively, the match is played on hard, grass or clay. Finally, K can be any scalar value, indipendently of the number of matches played before the match t |
CI |
optional Confidence intervals for the WElo and Elo rates. Default to FALSE. If 'CI' is set to "TRUE", then the confidence intervals are calculated, according to the procedure explained by \insertCiteangelini2021weighted;textualwelo |
alpha |
optional Significance level of the confidence interval. Default to 0.05 |
B |
optional Number of bootstrap samples used to calculate the confidence intervals. Default to 1000 |
new_data |
optional New data, cleaned through the function |
welofit
returns an list containing the following components:
results: The data.frame including a variety of variables, among which there are the estimated WElo and Elo rates, before and after the match t, for players i and j, the lower and upper confidence intervals (if CI=TRUE) for the WElo and Elo rates, labelled as '_lb' and '_ub', respectively, and the probability of winning the match for player i (labelled as 'WElo_pi_hat' and 'Elo_pi_hat', respectively, for the WElo and Elo models).
matches: The number of matches analyzed.
period: The sample period considered.
loss: The Brier score \insertCitebrier1950welo and log-loss (used by \insertCitekovalchik_2016;textualwelo, among others) averages, calculated considering the distance with respect to the outcome of the match.
highest_welo: The player with the highest WElo rate and the relative date.
highest_elo: The player with the highest Elo rate and the relative date.
dataset: The dataset used for the estimation of the WElo and Elo rates.
1 2 3 4 5 6 7 8 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.