# Sampling Standard Deviation

Here I found a formula for the sample standard deviation:

http://mathworld.wolfram.com/StandardDeviationDistribution.html

Here is my simulation: P[n_, σ_, s_] :=
(2 (n/(2 σ^2))^((n - 1)/2))/Gamma[(n - 1)/2] Exp[-n s^2/(2 σ^2)] s^(n - 2)

μ = 45;
σ = 12;
n = 15;
list = {};
Do[
data = RandomVariate[NormalDistribution[μ, σ], n];
list = Append[list, Sqrt[Variance[data]]], 50000]

Show[Histogram[list, 100, "PDF"], Plot[P[n, σ, s], {s, 0, 35}]]


Can anybody explain the shift between the histogram and the P-curve?

• Your P is not defined. Please make your code self-contained. As a first guess I would say that your P is not defined correctly, hence the deviation from the empirical distribution of standard deviations. – Roman May 27 at 12:47
• I added P from the cited site. – azzteke May 27 at 12:57

Your P is the distribution of the population standard deviation, whereas your random standard deviations are sample standard deviations. They differ by a factor of $$\sqrt{\frac{N-1}{N}}$$. Correct for this by multiplying the sample standard deviations by this factor, and it's a match:
list = Table[Sqrt[(n-1)/n]*StandardDeviation[RandomVariate[NormalDistribution[μ, σ], n]], {50000}]; 