AFL results since 1998 from http://probabilistic-footy.monash.edu/

Load all results.

res <- read.delim('results.tsv')
#colnames(res)
# Add a score margin relative to home team
res <- res %>% mutate(margin=h_total-a_total)

Mean and std.dev of margin for home-team by year

res %>% group_by(year) %>% summarise(mean=mean(margin), std.dev=sd(margin)) %>% arrange(desc(year))

Check number of games by year

res %>% group_by(year) %>% summarise(n=n()) %>%  arrange(desc(year))

Check home-team margin per year

res %>% ggplot(aes(factor(year),margin)) + geom_boxplot() + ggtitle("Margin by year")

Margins as a density for last 5 years

res %>% filter(year>2011) %>% ggplot(aes(color=factor(year),margin)) + geom_density() + ggtitle("Margin by year")

Check for normality of margins.

shapiro.test(res$margin)

    Shapiro-Wilk normality test

data:  res$margin
W = 0.99951, p-value = 0.509

qq-plot to visualise normality

qqnorm(res$margin)
qqline(res$margin, col=2)

LS0tCnRpdGxlOiAiUiBOb3RlYm9vayIKb3V0cHV0OiBodG1sX25vdGVib29rCi0tLQoKQUZMIHJlc3VsdHMgc2luY2UgMTk5OCBmcm9tIFtodHRwOi8vcHJvYmFiaWxpc3RpYy1mb290eS5tb25hc2guZWR1L10oaHR0cDovL3Byb2JhYmlsaXN0aWMtZm9vdHkubW9uYXNoLmVkdS8pCgoKYGBge3IgaW5pdCxlY2hvPUZBTFNFLHJlc3VsdHM9J2hpZGUnLG1lc3NhZ2U9RkFMU0V9CmxpYnJhcnkoZHBseXIpCmxpYnJhcnkodGlkeXIpCmxpYnJhcnkoZ2dwbG90MikKYGBgCkxvYWQgYWxsIHJlc3VsdHMuCmBgYHtyfQpyZXMgPC0gcmVhZC5kZWxpbSgncmVzdWx0cy50c3YnKQojY29sbmFtZXMocmVzKQojIEFkZCBhIHNjb3JlIG1hcmdpbiByZWxhdGl2ZSB0byBob21lIHRlYW0KcmVzIDwtIHJlcyAlPiUgbXV0YXRlKG1hcmdpbj1oX3RvdGFsLWFfdG90YWwpCmBgYAoKIyMgTWVhbiBhbmQgc3RkLmRldiBvZiBtYXJnaW4gZm9yIGhv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