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

statcore

v0.1.0

Published

Changepoint detection, FDR control, always-valid sequential tests, conformal prediction, causal inference, survival analysis, extreme value theory, empirical Bayes and capture-recapture. TypeScript, no dependencies, runs in the browser.

Readme

statcore

The statistical engine behind proj-mvp.vercel.app. Eleven methods, twenty modules, zero dependencies, runs in the browser. Every number on those sixty product pages is computed by this code at build time.

20 modules · 11 methods · 0 dependencies · 90 tests · MIT

Why you can trust the numbers

The changepoint core (cusum, bocd, bh) is a port of a tested Python implementation, and it is pinned to that implementation at 1e-6 by 25 parity tests running against fixtures generated from the original. If the port drifts, the suite goes red.

The eleven methods with no reference implementation to diff against are tested a different way — against properties the mathematics guarantees rather than against an oracle:

  • conformal coverage holds at every alpha, on a deliberately skewed error distribution
  • James–Stein shrinkage beats raw means on total squared error, on all 50 seeds
  • the always-valid interval contains the truth along the whole monitoring path, not just at the end
  • the GPD fit recovers a known shape parameter from exactly-sampled Pareto tails
  • capture–recapture lands within 15% of a hidden population size

That distinction matters: a test that only checks the code agrees with itself proves nothing. These check it agrees with the theorem.

Install

npm install statcore

What is in it

| Module | Question it answers | Entry points | |---|---|---| | cusum, bocd, detect | Did this series change, and when? | cusum, bocd, runDetection | | bh | You tested a thousand things. Which findings survive? | applyBHCorrection, bhAdjust | | naive | What the threshold rule you use today would have said | naiveAlerts, compareToNaive | | power, bootstrap | Could you even have seen the effect? | requiredSampleSize, minimumDetectableEffect, pairedBootstrap | | sequential, ratesprt | Is it safe to look at this every morning? | mSPRT, rateSPRT | | conformal | How sure are you, with a guarantee? | fitConformalRegressor, calibrateAbstention | | causal | Did you cause it? | differenceInDifferences, syntheticControl | | survival | When did it happen, not how many | kaplanMeier, logRank, hazardByPeriod | | extremes | How bad can it get? | tailRisk | | hierarchical | Is that rank real? | shrinkRates, differsFromPopulation | | benford, capture | What is hidden, what did you miss? | benfordTest, captureRecapture | | judge | What did the LLM judge get wrong? | correctJudgedRate, compareJudged | | seasonal, stats | Weekly structure; the numeric utilities under everything | seededRandom, normPpf, quantile |

Three rules the code follows

  1. CUSUM runs on day-over-day percentage changes, not levels. A growing series must not alert on its own growth.
  2. Multiplicity is corrected across everything tested in a run. runDetection returns the suppressed findings as well as the survivors; the suppressed list is a feature.
  3. Anything that peeks is always-valid. mSPRT and rateSPRT keep their error rate under continuous monitoring, and their intervals agree with their tests by construction.

Example

import { runDetection, mSPRT, calibrateAbstention } from 'statcore'

// Which of these series changed, after correcting for testing all of them?
const run = runDetection(series, { fdr: 0.05, minConfidence: 0.9 })
run.findings    // survived Benjamini-Hochberg
run.suppressed  // would have alerted without it

// Watch a canary after every batch without inflating the false-halt rate.
const seq = mSPRT(control, treatment, { alpha: 0.05, tau: 0.03, step: 250 })
seq.stoppedAt   // first n at which the always-valid test crossed, or null

// Turn any confidence score into a threshold with a guaranteed error rate.
const policy = calibrateAbstention(scores, correct, 0.02)
policy.threshold

Build

npm install
npm test     # 90 tests, including the 25 parity tests
npm run build

MIT.