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

@tangent.to/proba

v0.1.2

Published

Probability distributions for JavaScript (ESM): logpdf with analytic gradients, pdf/cdf/quantile, seedable sampling. scipy.stats-validated.

Readme

tangent/proba

Probability distributions for JavaScript (ESM). Browser-first, zero dependencies, runs in Node.js and Deno. The probability foundation of the tangent suite — consumed by tangent/ds and tangent/mc, MIT-licensed so anyone else can build on it too.

13 distributions — normal, uniform, exponential, lognormal, halfnormal, gamma, beta, Student t, χ², F, Bernoulli, binomial, Poisson — each with:

  • logpdf (the source of truth) and analytic gradients (dlogpdf with respect to the value and every parameter) — what HMC/NUTS samplers need, no autodiff framework required
  • pdf, cdf, quantile built on a validated special-function core (log-gamma, digamma, regularized incomplete gamma/beta and inverses, erf/erfc, inverse normal CDF)
  • seedable sampling (createRng, xoshiro128**), moments, support, validate

Install

npm install @tangent.to/proba     # npm
deno add jsr:@tangent/proba       # Deno / JSR

Usage

import { createRng, gamma, normal } from '@tangent.to/proba';

normal.logpdf(1.3, { mu: 0, sigma: 1 });      // -1.7639385332046727
normal.dlogpdf(1.3, { mu: 0, sigma: 1 });     // { dx: -1.3, dmu: 1.3, dsigma: 0.69 }
gamma.quantile(0.95, { alpha: 2, beta: 0.5 }); // rate parameterization

const rng = createRng(42);                    // seeded, reproducible
gamma.sampleN({ alpha: 2, beta: 0.5 }, rng, 1000);

Distributions use the Bayesian-textbook parameterizations (PyMC/Stan style): gamma {alpha, beta} is shape/rate, exponential {lambda} is rate, lognormal {mu, sigma} are log-scale parameters. See CONTRACT.md for the full contract every distribution satisfies, including edge-case behavior.

Validation against scipy

tests_compare-to-scipy/ checks every distribution against scipy.stats on grids spanning both tails, two parameter sets each: logpdf/logpmf and cdf agree to ~1e-13 or better, quantiles to 1e-10 (discrete quantiles match exactly), moments to machine precision. Analytic gradients are verified against finite differences in the unit suite. Requires uv and Node:

npm run test:scipy

Scope

Distribution mathematics only: densities, gradients, cdf/quantile, sampling, moments. No model objects, no fitting, no inference — those live in the packages that consume proba (ds for frequentist statistics, mc for Bayesian inference). New distributions are welcome when a consumer needs them; speculative additions are not.

License

MIT.