# Ratings and Simulations

Welcome to our all new AFL Men’s ratings and tips page! Here you will the latest ratings, tips for the upcoming rounds and any simulations that have been done. I’ll usually aim to update these early in the week to give you time to digest Any questions, let me know on Twitter!

Last updated: 2018-09-27.

## Summary

Below are the updated AFL Men’s ratings and simulations. These are based off our ELO model (insert explainer) and simulations (insert explainer).

First, let’s get our data into a good format.

Now we can pass that table onto formattable and create a slightly nicer table. I’ve also worked out that the framewidget package allows us to generate html widgets (which means interactive tables!)

# Write to formattable with some formatting
dt_elo <- elo_table %>%
formattable(list(
ELO = normalize_bar("#20B2AA80"),
ELO.change = formatter(
"span",
style = ~ style(color = ifelse(ELO.change >= 0, "green", "red"))
),
Top.8 = color_tile("transparent", "lightblue"),
Top.4 = color_tile("transparent", "lightblue"),
Top.1 = color_tile("transparent", "lightblue")
)) %>%
as.datatable(options = list(dom = "t", pageLength = 18))

frameWidget(dt_elo, height = 700, width = "95%")

And below you can see the change in ratings for each team.

# Simulations

In order to get our Top 8, Top 4 and Top 1 probabilities, we simulate the season 50 000 times. This has been optimised considerably this year (code to come) which is nice.

Firstly, we have each team’s chance of making finals displayed across the season.

The following plot shows a ridgegraph of the number of wins of each team in those simulations.

And below we show the probability of each team finishing at each ladder position in a heatmap.