I will give a basic demonstration of some of the simpler statistical methods.
min and max
min(x: Array ): number
(max is written in the same way, just swap min with max)
min and max return the smallest/largest number in an array. The only parameter is that you input an array of numbers.
sum(x:Array ): number
sum returns the sum of all the numbers in an array. Again, the only parameter is that you input an array of numbers.
mean(x: Array ): number
Mean returns the average of all the numbers in an array. The only parameter is that you input an array of numbers.
variance(x: Array ): number
Variance returns the sum of squared deviations from all the numbers in an array. The only parameter is that you input an array of numbers.
zScore(x: number, mean: number, standardDeviation: number): number
zScore measures the score above or below the mean. For this, you need only provide the x (observed value), the mean (mu), and the standard deviation (sigma).
npm install --save simple-statistics
Again, here is the link to the documentation if you need it:
In researching for this blog, I also found another library, jstat. This blog is already long enough, so I will not be delving into it, but here’s the documentation for that library if you need it:
This has been Warren Ball, data science intern at iSmile Technologies. Thanks for reading, I hope this helps.