the incredible accuracy of Stirling’s approximation
[This article was first published on R – Xi'an's Og, 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.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
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
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
℘≈exp(-1/8N)/√πN
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.
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.