This site is version 0.0.1. Most of the code on this site is drafted by an agent and needs review. I apologize for the AI-speak, we are working on rewriting it!
viv-lang.org

Notebooks · lib/stats/describe

Descriptive statistics with stable sums

  • mean_var(x, ddof): the mean and the variance by the corrected two-pass algorithm (Chan, Golub and LeVeque 1983): d = x - mean, then (sum d^2 - (sum d)^2 / n) / (n - ddof), every sum in NumPy's pairwise order. The correction term removes the error of the first pass's mean.
  • welford(x, ddof): the same two numbers in one pass by Welford's update (Knuth, TAOCP vol. 2, 4.2.2), for data seen once.
  • moments(x): mean, variance (ddof 0), skewness g1 and excess kurtosis g2, the biased estimators SciPy's skew and kurtosis return by default.
  • quantile(x, p, type): Hyndman and Fan's nine sample quantiles (Amer. Statist. 50 (1996) 361-365), as R's quantile(x, p, type = type) computes them, fuzz included: type 7 by its own index rule (1 + (n - 1) p), types 1-3 and 4-9 by R's general rule.

Used with from stats.describe import ....

Look inside this program

  • Atlas

    The program’s map: every function and which calls which.

  • There’s no recorded run of this program yet.

Shift+Enter in a cell runs it and moves to the next. Running a cell runs every cell above it too, as one program.

[1]lines 21–155