Penalty Kick!

and the Law of Large Numbers

Wanshun Wong

Penalty Kick

In soccer, a penalty kick is a type of free kick taken from 11 meters (approximately 12 yards) out from the goal, where the kicker is one on one with the opposing team's goalkeeper. Therefore penalty kicks represent an easy opportunity to score.

http://i.dailymail.co.uk/i/pix/2013/11/22/article-2511941-1995BCC300000578-782_964x642.jpg

Penalty Kick! (Shiny App)

This app simulates a simplified version of penalty kicks in a soccer match. The kicker can only choose to shoot the ball towards the Left, Center, or Right side of the goal. A random number is then drawn from a uniform distribution to decide where the goalkeeper dives towards. We assume the shot will definitely be saved if the goalkeeper dives towards the ball. We also assume the ball will definitely enter the goal if the goalkeeper dives away from the ball.

Law of Large Numbers

The purpose of this app is to demonstrate the Law of Large Numbers. If you play this app only a few times your success rate can be quite unpredictable. But if you play this app more and more, your success rate will get very close to 66.67%. This is illustrated by the following code and the assoicated graph on the next slide.

library(ggplot2)
set.seed(17)
x <- 1:500
result <- cumsum(rbinom(500, size=1, prob=2/3))/x
qplot(x=x, y=result, geom="line", xlab="Number of Penalty Kicks Taken",
      ylab="Success Rate") + geom_hline(y=2/3, color="Red")

Law of Large Numbers

plot of chunk unnamed-chunk-2