Calculate Standard Deviation, Normal Distribution?
-
Hello,
I was wondering if anyone has come up with functions to calculate standard deviation, and come up with a normal distribution graph from any given data set. I understand how it would be possible to calculate standard deviation with meta variables, but it seems like a lot of work to do for something that someone may have done in the past.
Thanks!
-
I added such a function to the WEB-INF/scripts/scriptFunction.js file. The code is:
function meanAndStdDev(values) { if (values == null || values.length == 0) return null; var mean = 0; for (var i = 0; i < values.length; i++) mean += values*; mean /= values.length; var dev = 0; var diff; for (var i = 0; i < values.length; i++) { diff = mean - values*; dev += diff * diff; } dev /= values.length; dev = Math.sqrt(dev); return { mean: mean, stdDev: dev }; }
It has been only lightly tested, but it was ported pretty much verbatim from Java so it should be good. You can add this to the file yourself if you need it before the next release.
-
Great, thanks!