package
Statistical moments of ndarrays
npm install ndarray-momentsGitHub-flavored package documentation.
Across all versions, last 30 days.
3,952 in 30 days
Runtime metadata.
Tagged topics.
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 = ndarray(new Float64Array([1, 2, 5, -10]))
//Compute moments
var moments = require("ndarray-moments")(2, x)
//Print out statistics
console.log("Mean:", moments[0])
console.log("Variance:", moments[1] - moments[0]*moments[0])npm install ndarray-momentsrequire("ndarray-moments")(n, array)Calcuates the first n moments of array
n is the number of momentsarray is the array we are iterating overReturns An array of moments of the array.
(c) 2013 Mikola Lysenko. MIT License
jaspervdg
th.v.d.gronde@hccnet.nl
Estimated unpacked size across 22 packages.
2.5 MB
Includes dependencies.