the incredible accuracy of Stirling’s approximation

December 6, 2016

(This article was first published on R – Xi'an's Og, and kindly contributed to R-bloggers)

The last riddle from the Riddler [last before The Election] summed up to find the probability of a Binomial B(2N,½) draw ending up at the very middle, N. Which is

\wp={2N \choose N}2^{-2N}

If one uses the standard Stirling approximation to the factorial function,

log(N!)?Nlog(N) – N + ½log(2?N)

the approximation to ? is 1/??N, which is not perfect for the small values of N. Introducing the second order Stirling approximation,

log(N!)?Nlog(N) – N + ½log(2?N) + 1/12N

the approximation become


which fits almost exactly from the start. This accuracy was already pointed out by William Feller, Section II.9.

Filed under: Kids, R, Statistics Tagged: American elections 2016, Stirling approximation, The Riddler

To leave a comment for the author, please follow the link and comment on their blog: R – Xi'an's Og. offers daily e-mail updates about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...

If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.

Search R-bloggers


Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)