Before you take the square root, just multiply variance by n/(n-1). See wikipedia page on standard deviation for the maths. Keep in mind that while the sample variance is unbiased, if you don't know the distribution in question, sample standard deviation is always slightly biased after you take the square root.
How to get SAMPLE standard deviation with boost library?
-
24-03-2022 - |
Question
Here is what I did :
accumulator_set<double, stats<tag::variance> > accumulator;
accumulator = for_each(x.begin(), x.end(), accumulator);
double sDeviation = sqrt(variance(accumulator));
But the standard deviation returned is the population standard deviation. I need the sample standard deviation (divived by n-1).
Can Boost do that?
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow