by EGreg · 1y ago · 0 comments
And I remember noting that the standard deviation in regular statistics was that “quadratic variation” was slightly different than how variance is calculated. Off by one or squared or whatever. I made a note to eventually investigate why. Probably due to some stochastic volatility.
sum i=1..N (x_i - mu)^2 / N
while, given a sample of n iid [1] samples from a distribution, the best [2] estimate of the distribution variance is sum i=1..n (x_i - a )^2 / (n-1)
Note that we replaced the mean mu by the sample average a, [3] and divided by (n-1) instead of N.[0] with the mean mu := sum x_i / N being the actual mean of the population
[1] independent and identically distributed
[2] best in the sense of being unbiased. It's a tedious, but not very difficult calculation to confirm that the expectation of that second expression (with n-1) is the population variance.
[3] with the sample average a := sum x_i / n being an estimate of the population mean
To me there are two ways to approach the problem I think you are thinking of (sample variance I think).
(1) The sample variance depends on the sample mean which is sum(x_i) / n. Given the first n-1 of n samples, you would then know the final value (x_n = n * sample_mean - sum(x_i)_(n-1)) so at the very least n-1 could be understood as a "degrees of freedom". There are only n-1 degrees of freedom. Other higher sample moments can be roughly understood with the same degrees of freedom argument. This could be wrong though, it was just something I remember from somewhere.
(2) The more mathematically inclined way is that biased_sample_variance = sum((x_i - sum(x_i) / n)^2) / n. The mean of the biased_sample_variance (across many iterations of a set of samples N), is not the population variance, but (n - 1) / n * population_variance (i.e. it is biased). So you multiply the biased_sample_variance by (n / (n - 1)) which gives the unbiased sample_variance equation: sum((x_i - sum(x_i) / n)^2) / (n - 1). The math is rather fun in my opinion, once you get into the swing of things.
I sure do hope I understood your question correctly.