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

stb_stats.c

v1.24.2

Published

Single header file with a bunch of useful statistical functions such as ANOVA, Kruskal-Wallis, T-test, etc; Gerben Voshol (2018).

Readme

Statistics-Tool-Box

This is a single header file inspired by stb.h by Sean Barrett with a bunch of useful statistical functions. It is developed by Gerben Voshol.

Functions included are:

  • stb_moderated_ttest, stb_cosine_similarity, RSE Normalization (stb_calc_geometric_scaling_factors and stb_meanvar_counts_to_common_scale)
  • stb_shannon (Shannon's diversity index, Pilou evenness, stb_simpson (Simpson's Diversity Index), stb_jaccard (Jaccard similarity index), stb_bray_curtis (Bray–Curtis dissimilarity) and stb_create_htable a simple basic hash table
  • stb_pdf_hypgeo hypergeometric distribution probability density function, speedup stb_log_factorial using lookup table
  • stb_fisher2x2 simple fisher exact test for 2x2 contigency tables
  • stb_pdf_binom and stb_pdf_pois, the binomial and poison probability density functions
  • stb_polygamma, stb_trigamma_inverse gamme functions and stb_fit_f_dist for moment estimation of the scaled F-distribution
  • stb_qnorm and stb_qnorm_with_reference (also matrix variants) quantile normalization between columns with and without a reference
  • stb_neugas Neural gas clustering algorithm
  • stb_pca Principal Component Analysis
  • stb_csm (confident sequence method) for monte-carlo simulations
  • stb_kmeans k-means++ classical data clustering
  • stb_qsort (Quicksort), could be used to replace current sorting method
  • stb_cdf_gumbel, stb_pdf_gumbel, stb_icdf_gumbel and stb_est_gumbel, the (inverse) cumulative/probability density functions for the gumbel distribution and the ML estimator of the gumbel parameters
  • stb_kendall (Kendall's Rank correlation)
  • stb_jenks Initial port of O(k×n×log(n)) Jenks-Fisher algorithm originally created by Maarten Hilferink
  • stb_logistic_regression_L2 simple L2-regularized logistic regression
  • stb_spearman (Spearman's Rank correlation)
  • stb_invert_matrix, stb_transpose_matrix, stb_matrix_multiply, ..., stb_multi_linear_regression and stb_multi_logistic_regression
  • stb_ksample_anderson_darling, stb_2sample_anderson_darling, (one sample) stb_anderson_darling
  • stb_expfit (Exponential fitting), stb_polyfit (Polynomial fitting), stb_powfit (Power curve fitting), stb_linfit (Liniear fitting)
  • stb_trap, stb_trapezoidal (returns the integral (area under the cruve) of a given function and interval)
  • stb_lagrange (polynomial interpolation), stb_sum (Neumaier summation algorithm)
  • stb_mann_whitney, stb_kruskal_wallis (Unfinished, needs a better way to handle Dunn's post-hoc test)
  • stb_combinations
  • stb_allocmat (simple allocation of 2d array, but might not work on all systems?!)
  • stb_fgetln, stb_fgetlns
  • stb_pcg32 (PCG-XSH-RR) and stb_xoshiro512 (xoshiro512**) Pseudo Random Number Generators
  • stb_anova (One-Way Anova with Tukey HSD test and Scheffe T-statistics method (post-hoc) (Unfinished))
  • stb_quartiles
  • stb_histogram (very simple histogram), stb_print_histogram, ...
  • stb_factorial
  • stb_meanvar
  • stb_ttest, stb_uttest
  • stb_ftest,
  • stb_benjamini_hochberg
  • stb_chisqr, stb_chisqr_matrix, stb_gtest, stb_gtest_matrix,

Installation

Run:

$ npm i stb_stats.c

And then include stb_stats.h as follows:

// main.c
#define STB_STATS_IMPLEMENTATION
#include "node_modules/stb_stats.c/stb_stats.h"

int main() { /* ... */ }

And then compile with clang or gcc as usual.

$ clang main.c  # or, use gcc
$ gcc   main.c

You may also use a simpler approach:

// main.c
#define STB_STATS_IMPLEMENTATION
#include <stb_stats.h>

int main() { /* ... */ }

If you add the path node_modules/stb_stats.c to your compiler's include paths.

$ clang -I./node_modules/stb_stats.c main.c  # or, use gcc
$ gcc   -I./node_modules/stb_stats.c main.c

Citation

If you use this Tool-Box in a publication, please reference:

Voshol, G.P. (2022). STB: A simple Statistics Tool Box (Version 1.23) [Software]. Available from https://github.com/gerbenvoshol/Statistics-Tool-Box

SRC ORG