jStat is a comprehensive JavaScript library providing native implementations of statistical functions, suitable for both browser and Node.js environments. It stands out for offering a wide array of functions for various probability distributions, including Weibull, Cauchy, Poisson, Hypergeometric, and Beta, which are often not found in other similar libraries. For most distributions, jStat includes functions for PDF, CDF, inverse CDF, mean, mode, variance, and sampling. The current stable version is 1.9.6, last published four years ago, indicating a slower release cadence and suggesting potential abandonment. A key point of confusion is its module export structure, exposing `jStat` and `j$` properties within an object rather than as direct exports, which requires specific handling for module loaders like CommonJS and for ESM interoperability. The library also emphasizes browser usage, making the `jStat` object globally available.
npm install jstatVerified import paths — ran on the pinned version, not inferred.
Demonstrates importing jStat, calculating basic statistics (mean, standard deviation) from a dataset, using a normal distribution's CDF, and generating a random sample.
Always use `npm install jstat` (lowercase) for installation.
Access the `jStat` (or `j$`) property from the imported module object, e.g., `const { jStat } = require('jstat');` for CommonJS or `import * as jStatModule from 'jstat'; const jStat = jStatModule.jStat;` for ESM.Evaluate alternatives if active maintenance, modern features, or ongoing support are critical for your project. Be prepared to fork or maintain it yourself if necessary.
Consider using a module bundler (like Webpack or Rollup) to encapsulate the library, or rename the global variable immediately after loading if conflicts are expected.
The `jstat` module exports an object. You need to access its `jStat` property: `const { jStat } = require('jstat');`Ensure `jStat` is correctly destructured from the module import: `const { jStat } = require('jstat');` for CJS, or `import * as jStatModule from 'jstat'; const jStat = jStatModule.jStat;` for ESM.Install using the correct, all-lowercase package name: `npm install jstat`.
No dependency data recorded yet.