Source: https://maths.lancs.ac.uk/~rowlings/Teaching/UseR2012/static/talk2.pdf