npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@dominicdayta/nodestat

v1.1.0

Published

A lightweight library for data wrangling and analysis

Readme

Nodestat

A Node JS package for data wrangling and analysis

GitHub license GitHub issues

Project Goals

Both Javascript and Node already have a variety of packages that deal with dataframes and statistical computation. The goal with Nodestat is to demonstrate a unified grammar of data analysis that can transform Javascript into a fully capable language for data analysis. Specific design goals are as follows:

  • An Intuitive Grammar. Even without a third party package, Javascript already contains some functionality for handling data using Javascript Objects and JSON. In fact, many of the base functions that Nodestat implements through its Dataframe module are hardly novel and can be written by any experienced Javascript developer. With Nodestat, however, the aim is to create a grammar for data analysis that is intuitive and efficient, allowing the same split-apply-combine strategy for data wrangling that the plyr/dplyr package provides for the R language, and that pandas provides for the Python language.

  • Close Integration with Statistical Packages. The Dataframe module isn't just another package for handling data in Javascript. It's designed to play well with packages for data analysis and statistical computation. The Stats module demonstrates this capability. In the future, hopefully additional modules and independent packages will be developed following the Dataframe grammar for more advanced data analysis and machine learning.

If you are interested in contributing to this project, please see our contribution guidelines for more information.

Usage

Install

Install using NPM as

$ npm install @dominicdayta/nodestat

API Documentation

The package currently contains three primary modules:

stat: Contains basic statistical formulas, tests, datasets, and linear models (stat.lm / nstat.lm).

df: Contains useful functions for creating and managing dataframes.

random: Seedable random number generation and object-oriented probability distributions.

const nstat = require('@dominicdayta/nodestat');

let stats = nstat.stat; // for shorthand

// initiate the titanic dataset
let titanic = stats.dataset("Titanic");

// get the subset containing only survivors
let titanicSurvivors = titanic.subset(col = "Survived", 
    function(x){
        return(x == "Yes")
    }
);
console.log(titanicSurvivors.data);

// aggregate the total number of survivors by sex and class
let freqSurvivedBySexClass = titanic
    .select(["Class","Sex","Freq"])
    .aggregate(by = ["Class","Sex"], stats.sum);
console.log(freqSurvivedBySexClass.data);

// aggregate the total number of non-survivors by sex and age
let freqDiedSexAge = titanic
    .subset(col = "Survived", function(x){return(x == "No")})
    .select(["Sex","Age","Freq"])
    .aggregate(by = ["Sex","Age"], stats.sum)
    .data;
console.log(freqDiedSexAge);

// sort using helper syntax (similar to dplyr::arrange)
let sorted = titanic.order(["Class", nstat.desc("Freq")]);
console.log(sorted.head(5).data);

Random module

Nodestat provides a seedable random API with distribution objects similar to NumPy and PyTorch. Create a distribution, then call pdf, cdf, and sample:

const nstat = require('@dominicdayta/nodestat');

// reproducible sampling
nstat.random.set_global_seed(2026);

const normal = nstat.random.normal(0, 1);
console.log(normal.pdf(0));
console.log(normal.cdf(1.96));
console.log(normal.sample(5));

const pois = nstat.random.poisson(3);
console.log(pois.pmf(2));
console.log(pois.sample());

Supported distributions include normal, exponential, gamma, geometric, uniform, poisson, binomial, chi-square, Student's t, and hypergeometric. See random module docs for the full reference.

Statistical tests

Nodestat includes R-style hypothesis testing under stat.tests:

const nstat = require('@dominicdayta/nodestat');
const sleep = nstat.stat.dataset('sleep');

// one-way ANOVA
const model = nstat.stat.tests.aov('extra ~ group', sleep);
console.log(model.statistic, model.p_value);

// Tukey HSD pairwise comparisons
console.log(nstat.stat.tests.tukeyHSD(model).comparisons);

// multiple-comparison p-value adjustment
console.log(nstat.stat.tests.p_adjust([0.01, 0.04, 0.03], 'holm'));

Supported procedures include one- and two-sample t-tests, Wilcoxon tests, ANOVA with Tukey HSD, and Bonferroni/Holm/Hochberg/BY p-value adjustment. See statistical tests docs.

Linear models

Fit object-oriented linear models with formula syntax similar to R's lm():

const nstat = require('@dominicdayta/nodestat');
const women = nstat.stat.dataset('women');

const model = nstat.lm('weight ~ height', women);
console.log(model.coef());
console.log(model.summary());
console.log(model.coeftable().print());

Formulas support interactions (x * group), transforms (log(y) ~ sqrt(x)), and as-is terms (I(x^2)). Categorical predictors are automatically dummy-coded. See linear models docs.

You can look into sample runnable use cases in the ./examples directory (legacy examples are in ./demo). For full documentation on how to use the API, please look into the ./docs directory.

License

This package is licensed under the MIT License.