**A Distant ObserveR**, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)

Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

I’ve been away for some time without closely following the media, and without significant internet access. When such a period is over it takes some time to regain momentum. Thus my short exit poll series will be continued in 2013. For now I’m still sorting out what I missed over the last weeks. Today’s short post is part of this process.

There has been some discussion while I was away about how probable the UEFA Champions League draw really was. The Daily Mail quoted “leading football statisticians” that came up with 2160900:1, and bookies that would have offered 5000:1.

R-bloggers have contributed several articles, and the consensus arrived at was that the chances were 1:5463, or 0.0001830496. I’ll take this for granted.

### The odds are much better

0.0001830496 still doesn’t seem like a hell of a chance. But this number doesn’t reflect the probability of seeing what happened in Nyon. Here’s why:

The UEFA made several dry runs, not just the one that has been discussed. According to the German magazine SPIEGEL ONLINE a UEFA speaker confirmed that they’re carrying out “numerous tests”.

Just one of the “numerous” dry runs turned out to be the same as the final draw. I don’t know how many draws have been made for testing purposes. But let’s assume they’re routinely doing ten dry runs before the final draw.

Let’s assume further that there are 5463 different results that are all equally probable. Then, mathematically, the chances of what has been discussed widely are about 1:546.3, or 0.001830496.

### From Nyon to Monte Carlo…

Let’s do some simulation now. I created the function sim.nyon as a quick and dirty way to do the whole job:

sim.nyon <- function(poss, testruns, n.sims) {

# parameters:

# poss: number of possible results to draw from

# testruns: number of dry runs before the final draw

# n.sims: number of simulations to be run

runs <- testruns + 1 # dry runs plus final draw

y <- sample(poss, (n.sims*runs), replace = TRUE)

y <- matrix(y, nrow = n.sims)

y <- y – y[,runs]

y <- y[, -runs]

is.like.nyon <- apply(y, 1, function(x) {any(x==0)})

return(table(is.like.nyon))

}

In the UEFA case we want to run 10,000 simulations with 5463 possibilities and assume 10 dry runs:

possibilities <- 5463

testruns <- 10

sims <- 10^4

sim.nyon(possibilities, testruns, sims)

# is.like.nyon

# FALSE TRUE

# 9981 19

After all the UEFA thingy doesn’t seem to be *that* improbable after all.

**leave a comment**for the author, please follow the link and comment on their blog:

**A Distant ObserveR**.

R-bloggers.com offers

**daily e-mail updates**about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.

Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.