JSPM

ndarray-moments

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 310
  • Score
    100M100P100Q95580F
  • License MIT

Statistical moments of ndarrays

Package Exports

  • ndarray-moments

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (ndarray-moments) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

ndarray-moments

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).

Example

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])

Install

npm install ndarray-moments

require("ndarray-moments")(n, array)

Calcuates the first n moments of array

  • n is the number of moments
  • array is the array we are iterating over

Returns An array of moments of the array.

Credits

(c) 2013 Mikola Lysenko. MIT License