Skip to content

Instantly share code, notes, and snippets.

Created December 23, 2012 18:26
Show Gist options
  • Save anonymous/4365081 to your computer and use it in GitHub Desktop.
Save anonymous/4365081 to your computer and use it in GitHub Desktop.
On Friday, 12/21/2012, The American Statistician published a paper by Stavros Kourouklis in which he proposed a new correction factor for estimating the standard deviation of a distribution based on a finite sample. The article describes the surprisingly simple formula for calculating the correction term and provides a proof that this formula at…
n_sims = 1_000_000
mle_se = zeros(n_sims)
unbiased_se = zeros(n_sims)
yatracos_std_se = zeros(n_sims)
kourouklis_std_se = zeros(n_sims)
for sim in 1:n_sims
n = 10
x = randn(n)
c1 = ((n + 2) * (n - 1)) / (n * (n + 1))
c2 = (n * (n - 1)) / (n * (n - 1) + 2)
mle = ((n - 1) / n) * std(x)
unbiased = std(x)
yatracos_std = c1 * std(x)
kourouklis_std = c2 * std(x)
mle_se[sim] = (mle - 1.0)^2
unbiased_se[sim] = (unbiased - 1.0)^2
yatracos_std_se[sim] = (yatracos_std - 1.0)^2
kourouklis_std_se[sim] = (kourouklis_std - 1.0)^2
end
mean(mle_se)
mean(unbiased_se)
mean(yatracos_std_se)
mean(kourouklis_std_se)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment