Node.js examples for Algorithm:Statistics
Get Array Standard Deviation
Array.prototype.stddev = function( percent ){ var len = this.length, avg = this.mean(), tot = 0, i = 0; for ( ; i < len; i++ ) tot += Math.pow( this[i] - avg, 2 ); if ( percent ) return Math.round( ( ( Math.sqrt( tot / len ) ) / avg ) * 100 ); return Math.round( Math.sqrt( tot / len ) ); };