Forum Discussion
Pivot Table StDev calculates different value then the STDEV formula
I'm assuming the same thing, I've checked many settings and didn't found anything that could affect the StDev calculated by the pivot table. In the attached excel file i also set up the experiment so that i have the same amount of samples (30 samples) for each "TestCodeDescription". I though that maybe this is the cause, but it's not
- PeterBartholomew1Oct 22, 2019Silver Contributor
The magnitude of the errors is roughly what I would expect, bearing in mind the subtraction that will lose you 1 decimal place and the summation over 30 values that will go a long way to losing a second. I tried two variations of the formula for a sample standard deviation from first principles and got results that varied slightly
= SQRT( SUM( (x - x̅)^2 ) / (n-1) ) = 0.2555612135223550
= SQRT( ( SUM(x^2) - n * x̅^2 ) / (n-1) ) = 0.2555612135223660
Form my sample of 1 test case, the first formula matches Excel and the second matches PQ, where x was defined to be $B$662:$B$691 and x̅
= SUM(x) / n
- zsoltturkosiOct 24, 2019Copper Contributor
Hi, thanks for these tips. I double checked your calculation and I've got the same values for range $B$662:$B$691. However when i try this formula for another set of 30 values from range $B$182:$B$211 i get the following:
SQRT( SUM( (x - x̅)^2 ) / (n-1) ) = 0.2375459475749410
SQRT( ( SUM(x^2) - n * x̅^2 ) / (n-1) ) = 0.2375459475749460
The pivot table calculates 0.2375459475749490 for $B$182:$B$211 so we have no match here with either of the formulas. Interesting...
Edit: i think this calculation issue is related to https://docs.microsoft.com/en-us/office/troubleshoot/excel/floating-point-arithmetic-inaccurate-result. Section "Precision" explains that excel has a max precision of 15 digits. Probably something else is still going on because of the of the pivot table's framework which further modifies the decimals, but i think that the issue is certainly related to the limitation explained in the article.
- fkuesterApr 06, 2020Copper Contributor
This answer is a bit late - but may be interesting to other readers.
Please don't put any value in those very last digits of the standard deviation. Unless you have hundreds of single measurements from the same parent population, you never know the standard deviation much better than to an error of a couple of %, mostly rather 10-25%. You'll never get into a situation where 4th digit after the decimal point is significant, let alone the 12th or 15th...