Statistical moments of ndarrays
Calculate unnormalized moments of an ndarray. Another name for these things is that they are the expected value of polynomials. The first unnormalized moment is just the mean, the second is the expected value of x^2, the 3rd is E[x^3], etc. Using this data, you can compute any polynomial statistic like variance, kurtosis, or skewness using the method of moments (aka linearity of expectation).
var ndarray = require"ndarray"var x = ndarray1 2 5 -10//Compute momentsvar moments = require"ndarray-moments"2 x//Print out statisticsconsole.log"Mean:" moments0console.log"Variance:" moments1 - moments0*moments0
npm install ndarray-moments
Calcuates the first n moments of
nis the number of moments
arrayis the array we are iterating over
Returns An array of moments of the array.
(c) 2013 Mikola Lysenko. MIT License