Statistics (110)

The typed arithmetic layer provides scalar/array aggregations: sum, mean, min, max, variance, std. The factory layer adds prod, median, mode, corr, mad, quantileSeq, cumsum.

acf
Autocorrelation up to nlags, biased estimator (÷n, like statsmodels acf); acf[0] = 1
Syntax
acf(x, nlags)
adfuller
Augmented Dickey-Fuller unit-root test (constant-only model): OLS of Δxₜ on [1, xₜ₋₁, Δxₜ₋₁, …]; statistic = t-stat on the lagged level; default maxlag = floor(12(n/100)^0.25), auto-clamped if the design is ill-posed; pValue is an approximate MacKinnon (1994)-style interpolation over a small built-in critical-value table (not the exact response-surface p-value); returns { statistic, pValue, usedLag }
Syntax
adfuller(x[, maxlag])
bootstrapCI
Listed in the export index; see the source for details.
Syntax
bootstrapCI(…)
cohensD
(mean a − mean b) / pooled sd (ddof 1); negative when a is smaller
Syntax
cohensD(a, b)
Typesnumber[]
corr
The typed arithmetic layer provides scalar/array aggregations: sum, mean, min, max, variance, std. The factory layer adds prod, median, mode, corr, mad, quantileSeq, cumsum.
Syntax
corr(…)
corrcoef
Pearson correlation-coefficient matrix (rows = observations, cols = variables; { rowvar: true } takes variables as rows, as np.corrcoef does); diagonal is 1
Syntax
corrcoef(matrix[, { rowvar }])
cov
Sample covariance (scalar for two vectors) or covariance matrix (rows = observations, cols = variables; { rowvar: true } takes variables as rows, the NumPy default layout); ddof defaults to 1; rows of unequal length throw RangeError
Syntax
cov(x, y[, ddof]) cov(matrix[, , ddof][, { rowvar }])
cummax
Cumulative (running) maximum
Syntax
cummax(x)
cummin
Cumulative (running) minimum
Syntax
cummin(x)
cumprod
Cumulative product (running ∏); same length as input
Syntax
cumprod(x)
cumsum
The typed arithmetic layer provides scalar/array aggregations: sum, mean, min, max, variance, std. The factory layer adds prod, median, mode, corr, mad, quantileSeq, cumsum.
Syntax
cumsum(…)
cumtrapz
Cumulative trapezoidal integral; x may be abscissae or scalar dx (default unit spacing), leading 0 (MATLAB convention)
Syntax
cumtrapz(y[, x])
dbscan
Density-based clustering (DBSCAN); brute-force Euclidean ε-neighborhoods; 0-based cluster ids, noise labeled -1
Syntax
dbscan(points, eps, minPts)
describe
Listed in the export index; see the source for details.
Syntax
describe(…)
detrend
Remove trend: 'linear' (default, least-squares line) or 'constant' (mean); matches scipy.signal.detrend
Syntax
detrend(x[, type])
durbinWatson
Durbin-Watson statistic Σ(eₜ−eₜ₋₁)² / Σeₜ²; ~2 = no autocorrelation, <2 positive, >2 negative; matches statsmodels.stats.stattools.durbin_watson
Syntax
durbinWatson(residuals)
ecdf
Empirical CDF: { x, y, evaluate(t) } with the sorted unique values, cumulative proportions and a step-function evaluator
Syntax
ecdf(x)
Typesnumber[]
elasticNet
Combined L1+L2 (elastic net) regression via coordinate descent; l1Ratio mixes the lasso (1) and ridge (0) penalties; returns { coefficients, intercept } (opts.maxIter/opts.tol)
Syntax
elasticNet(X, y, alpha, l1Ratio[, opts])
energyDistance
1-D energy distance between two samples
Syntax
energyDistance(u, v)
Typesnumber[]
etaSquared
One-way η² = SS_between / SS_total
Syntax
etaSquared(groups)
Typesnumber[][]
ewma
Exponentially-weighted moving average, α ∈ (0,1] (pandas ewm(adjust=False)); same length as input
Syntax
ewma(x, alpha)
fitDistribution
Maximum-likelihood fit of 'normal' | 'exponential' | 'lognormal' | 'poisson' | 'gamma' to a sample; returns { params, logLikelihood }. Normal/exponential/poisson are closed-form; lognormal fits a normal to ln(data) (requires all > 0); gamma solves the digamma shape equation ln(k) − ψ(k) = ln(x̄) − mean(ln x) via the secant method (verified vs scipy.stats.gamma.fit)
Syntax
fitDistribution(name, data)
gaussianProcessRegression
Gaussian-process regressor (alias pair). Options: kernel ('rbf' default, 'matern32', 'matern52'), lengthScale (1), signalVariance (1), noise (1e-10). Returns { predict(Xstar) → { mean, variance, std }, logMarginalLikelihood, kernel }
Syntax
gaussianProcessRegression(X, y[, options])
Typesnumber[][], number[]
glassDelta
(mean a − mean b) / sd(b) — standardized by the second (control) group only
Syntax
glassDelta(a, b)
Typesnumber[]
glm
Generalized linear model via IRLS/Fisher scoring; opts.family 'poisson' (log link) or 'gamma' (log or inverse link), opts.intercept default true (matches ols); returns { coefficients, fittedValues, deviance, iterations, predict }; matches statsmodels.GLM.fit
Syntax
glm(X, y, opts)
gmean
Geometric mean exp(mean(ln x)); all entries must be > 0
Syntax
gmean(x)
gpRegression
Gaussian-process regressor (alias pair). Options: kernel ('rbf' default, 'matern32', 'matern52'), lengthScale (1), signalVariance (1), noise (1e-10). Returns { predict(Xstar) → { mean, variance, std }, logMarginalLikelihood, kernel }
Syntax
gpRegression(X, y[, options])
Typesnumber[][], number[]
gstd
Geometric standard deviation exp(std(ln x)), ddof default 1 (scipy)
Syntax
gstd(x[, { ddof }])
Typesnumber[]
gzscore
Geometric z-scores (ln x − mean(ln x)) / std(ln x)
Syntax
gzscore(x[, { ddof }])
Typesnumber[]
hedgesG
cohensD with the small-sample correction 1 − 3/(4(n₁+n₂) − 9)
Syntax
hedgesG(a, b)
Typesnumber[]
histogram
Listed in the export index; see the source for details.
Syntax
histogram(…)
hmean
Harmonic mean n / Σ(1/xᵢ); all entries must be > 0
Syntax
hmean(x)
iqr
Interquartile range Q3 − Q1 (via quantileSeq)
Syntax
iqr(x)
jackknife
Leave-one-out jackknife of stat: { estimate, bias, se }
Syntax
jackknife(x, stat)
Typesnumber[], function
kendalltau
Listed in the export index; see the source for details.
Syntax
kendalltau(…)
kendallTau
Listed in the export index; see the source for details.
Syntax
kendallTau(…)
kmeans
Lloyd's k-means on row-vectors, deterministic maximin seeding; returns { labels, centroids, inertia, iterations, converged } (opts.maxIter default 100)
Syntax
kmeans(data, k[, opts])
knnClassify
k-nearest-neighbour classifier; majority vote of the k closest training points (Euclidean), ties broken by the single nearest point's label
Syntax
knnClassify(train, labels, query, k)
knnRegress
k-nearest-neighbour regressor; mean of the k closest training targets (Euclidean)
Syntax
knnRegress(train, targets, query, k)
kurtosis
Excess kurtosis by default (SciPy fisher=true, subtracts 3). { fisher: false } → Pearson's; { bias: false } applies the sample correction
Syntax
kurtosis(x[, opts])
lasso
L1-penalized (lasso) regression via coordinate descent with soft-thresholding on standardized columns; drives coefficients to exactly 0 for large alpha; returns { coefficients, intercept } (opts.maxIter/opts.tol)
Syntax
lasso(X, y, alpha[, opts])
linearRegression
Simple OLS fit; returns { slope, intercept, rValue, rSquared, pValue, stdErr } (mirrors scipy.stats.linregress; needs ≥ 3 points)
Syntax
linearRegression(x, y)
linregress
Listed in the export index; see the source for details.
Syntax
linregress(…)
ljungBox
Ljung-Box portmanteau test for residual autocorrelation up to lags: Q = n(n+2)Σρ_k²/(n−k), pValue = 1 − chiSquaredCDF(Q, lags); matches statsmodels.stats.diagnostic.acorr_ljungbox; returns { statistic, pValue }
Syntax
ljungBox(x, lags)
logisticRegression
Binary logistic regression (y ∈ {0,1}) fit by IRLS/Newton on the Bernoulli log-likelihood; opts.intercept default true; returns { coefficients, intercept, predict, predictProba } — the library's first classifier/GLM
Syntax
logisticRegression(X, y[, opts])
logsumexp
log(Σ exp(xᵢ)), max-shifted for stability
Syntax
logsumexp(x)
mad
The typed arithmetic layer provides scalar/array aggregations: sum, mean, min, max, variance, std. The factory layer adds prod, median, mode, corr, mad, quantileSeq, cumsum.
Syntax
mad(…)
mahalanobis
Listed in the export index; see the source for details.
Syntax
mahalanobis(…)
max
The typed arithmetic layer provides scalar/array aggregations: sum, mean, min, max, variance, std. The factory layer adds prod, median, mode, corr, mad, quantileSeq, cumsum.
Syntax
max(…)
maxSelect
k largest elements
Syntax
maxSelect(arr, k)
meanCI
Listed in the export index; see the source for details.
Syntax
meanCI(…)
median
The typed arithmetic layer provides scalar/array aggregations: sum, mean, min, max, variance, std. The factory layer adds prod, median, mode, corr, mad, quantileSeq, cumsum.
Syntax
median(…)
medianSelect
Exact median via quickselect
Syntax
medianSelect(arr)
min
The typed arithmetic layer provides scalar/array aggregations: sum, mean, min, max, variance, std. The factory layer adds prod, median, mode, corr, mad, quantileSeq, cumsum.
Syntax
min(…)
minSelect
k smallest elements
Syntax
minSelect(arr, k)
mode
The typed arithmetic layer provides scalar/array aggregations: sum, mean, min, max, variance, std. The factory layer adds prod, median, mode, corr, mad, quantileSeq, cumsum.
Syntax
mode(…)
moment
k-th moment; central (default true) subtracts the mean first, else raw
Syntax
moment(x, k[, central])
movingAverage
Simple moving average over trailing window w; returns length n − w + 1 ("valid")
Syntax
movingAverage(x, w)
mutualInformation
Mutual information in nats between two discrete label sequences
Syntax
mutualInformation(x, y)
Typesnumber[]
mvnPdf
Multivariate-normal density; handles the 1-D scalar case and the general k×k covariance case (thin wrapper over multivariateNormal); matches scipy.stats.multivariate_normal.pdf
Syntax
mvnPdf(x, mean, cov)
mvnSample
Draw n samples from a multivariate normal via Cholesky (x = mean + L·z); opts.seed for reproducible draws; returns an n-length array of length-k row vectors
Syntax
mvnSample(mean, cov, n[, opts])
ols
Multiple linear regression on a design matrix (opts.intercept default true, prepends a column of ones); returns { coefficients, stderr, tValues, pValues, r2, adjR2, fStat, residuals } — the general case linearRegression doesn't cover
Syntax
ols(X, y[, opts])
pacf
Partial autocorrelation up to nlags via the Levinson-Durbin recursion on the biased acf; matches statsmodels.tsa.stattools.pacf(..., method='ldb'); pacf[0] = 1
Syntax
pacf(x, nlags)
parallelStatCorr
Pearson correlation
Syntax
parallelStatCorr(a, b)
Accelparallel†
parallelStatCumsum
Cumulative sum
Syntax
parallelStatCumsum(a)
parallelStatDistance
Euclidean distance
Syntax
parallelStatDistance(a, b)
Accelparallel†
parallelStatHistogram
Histogram bin counts
Syntax
parallelStatHistogram(a, bins)
Accelparallel†
parallelStatMAD
Mean absolute deviation from the mean
Syntax
parallelStatMAD(a)
Accelparallel†
parallelStatMax
Min / max
Syntax
parallelStatMax(a)
Accelparallel†
parallelStatMean
Arithmetic mean
Syntax
parallelStatMean(a)
Accelparallel†
parallelStatMeanAD
Alias of parallelStatMAD (same mean AD, not factory mad)
Syntax
parallelStatMeanAD(a)
Accelparallel†
parallelStatMedian
Median (sort_f64 when n ≥ 1 048 576 after loadWasm())
Syntax
parallelStatMedian(a)
AccelWASM (≥1 M)
parallelStatMin
Min / max
Syntax
parallelStatMin(a)
Accelparallel†
parallelStatMinMax
{ min, max } in one pass
Syntax
parallelStatMinMax(a)
Accelparallel†
parallelStatMode
Mode
Syntax
parallelStatMode(a)
parallelStatNorm
p-norm
Syntax
parallelStatNorm(a[, p])
Accelparallel†
parallelStatPercentile
Listed in the export index; see the source for details.
Syntax
parallelStatPercentile(…)
parallelStatProd
Product
Syntax
parallelStatProd(a)
Accelparallel†
parallelStatQuantile
q-th quantile (0–1); uses sort_f64 like median
Syntax
parallelStatQuantile(a, q)
AccelWASM (≥1 M)
parallelStatStd
Standard deviation
Syntax
parallelStatStd(a[, type])
Accelparallel†
parallelStatSum
Sum of all elements
Syntax
parallelStatSum(a)
Accelparallel†
parallelStatVariance
Variance (unbiased/uncorrected/biased)
Syntax
parallelStatVariance(a[, type])
Accelparallel†
partialCorrelation
Pearson correlation of x and y with z partialled out
Syntax
partialCorrelation(x, y, z)
Typesnumber[]
pearsonr
Listed in the export index; see the source for details.
Syntax
pearsonr(…)
pmean
Power mean (Σxᵖ/n)^(1/p); p = 0 geometric, 1 arithmetic, −1 harmonic; non-integer p needs x > 0, an odd integer p keeps the sign of a negative mean
Syntax
pmean(x, p)
Typesnumber[]
prod
The typed arithmetic layer provides scalar/array aggregations: sum, mean, min, max, variance, std. The factory layer adds prod, median, mode, corr, mad, quantileSeq, cumsum.
Syntax
prod(…)
proportionCI
Listed in the export index; see the source for details.
Syntax
proportionCI(…)
ptp
Listed in the export index; see the source for details.
Syntax
ptp(…)
quantileSeq
Quantile(s) of x; prob is a probability in [0,1], an array of them, or an integer N for N evenly-spaced quantiles. Optional mode string selects the interpolation between order statistics (numpy method=): 'linear' (default), 'lower', 'higher', 'nearest' (ties round-half-to-even), 'midpoint'. Pass sorted=true to skip the internal partition-select on pre-sorted data
Syntax
quantileSeq(x, prob[, sorted][, mode])
quickSelect
kth smallest element (0-indexed)
Syntax
quickSelect(arr, k)
rankBiserial
Rank-biserial correlation 2U_a/(n₁n₂) − 1 (ties count ½); positive when a tends to exceed b
Syntax
rankBiserial(a, b)
Typesnumber[]
rankdata
1-based ranks with average tie handling (SciPy rankdata default 'average')
Syntax
rankdata(x)
ridge
L2-penalized (ridge) regression; closed form β = (XᵀX + αI)⁻¹Xᵀy on centered data; returns { coefficients, intercept }; intercept never penalized
Syntax
ridge(X, y, alpha[, opts])
sem
Standard error of the mean sampleStd / √n (sample std, ddof=1)
Syntax
sem(x)
siegelSlopes
Siegel repeated-medians line { slope, intercept } (intercept median(y − slope·x))
Syntax
siegelSlopes(x, y)
Typesnumber[]
skewness
Third standardized moment; population estimator by default (SciPy bias=true). { bias: false } gives the sample-corrected G₁
Syntax
skewness(x[, opts])
softmax
exp(xᵢ − max) / Σ exp(x − max); returns a probability vector
Syntax
softmax(x)
spearman
Spearman rank correlation ρ (Pearson of the ranks); captures any monotonic relationship — a monotonic non-linear pair gives ρ = 1
Syntax
spearman(x, y)
spearmanr
Listed in the export index; see the source for details.
Syntax
spearmanr(…)
spectralClustering
Normalized-Laplacian spectral clustering of a weighted graph; returns a label per node
Syntax
spectralClustering(adjacency, k[, opts])
theilSen
Theil–Sen line { slope, intercept }: slope is the median of all pairwise slopes, intercept median(y) − slope·median(x) (scipy)
Syntax
theilSen(x, y)
Typesnumber[]
trimmedMean
Listed in the export index; see the source for details.
Syntax
trimmedMean(…)
tTestPower
Power of a two-sample t-test (equal group sizes) via the noncentral-t CDF; opts.solveFor: 'nobs' solves for the per-group sample size needed to reach a target power instead; matches statsmodels.stats.power.tt_ind_solve_power
Syntax
tTestPower(effectSize, nobs, alpha[, opts])
variation
Listed in the export index; see the source for details.
Syntax
variation(…)
wassersteinDistance
1-D Wasserstein-1 (earth mover) distance between empirical distributions, optionally weighted
Syntax
wassersteinDistance(u, v[, { uWeights, vWeights }])
Typesnumber[]
weightedMean
Weighted mean Σwx / Σw
Syntax
weightedMean(x, w)
Typesnumber[], number[]
weightedMedian
Lower weighted median (first sorted x whose cumulative weight reaches Σw/2)
Syntax
weightedMedian(x, w)
Typesnumber[], number[]
weightedQuantile
Lower weighted quantile, same rule at p·Σw; zero-weight points are never returned
Syntax
weightedQuantile(x, w, p)
Typesnumber[], number[]
weightedVariance
ddof: 0 (default) is Σw(x−m)² / Σw; ddof: 1 divides by Σw − Σw²/Σw (reliability weights)
Syntax
weightedVariance(x, w[, { ddof }])
Typesnumber[], number[]
zscore
Per-element (xᵢ − mean) / std using population std (SciPy zscore default, ddof=0)
Syntax
zscore(x)