stats

The stats collection provides common statistical operations — descriptive statistics, hypothesis tests and regression models — over tabular data. It is written in R, which has first-class, well-tested implementations of these methods in its base stats package, so the blocks are thin, dependency-light wrappers around functions statisticians already trust (summary, cor, t.test, aov, chisq.test, table, lm, glm).

The descriptive and test blocks share one shape: a single data input (type: file, format: CSV) and a single result output (type: json). They compose behind any source that produces a CSV — including data.read, fiadb.fullreport, or upstream sae/base blocks — and feed any downstream consumer that accepts JSON. All other configuration (column names, methods, test options) is passed as scalar args, never wired inputs.

Descriptive statistics:

Hypothesis tests:

Models:

  • stats.lm — linear regression by least squares.
  • stats.glm — generalised linear models: gaussian, binomial, poisson, Gamma.

The model blocks follow the model-fitting contract shared with the sae, ml and models collections. They read Parquet or CSV, and name the model either with an R formula or with a target and a features column selector (names, globs and exclusions such as B*,MB*,-B0), plus id_columns, weights, categorical and na_action. A missing or misspelled column fails with near-match suggestions and the list of columns that exist. Each writes a fitted model (a SpadeModel file), a coefficient table and fit statistics, with optional cross-validation by rows or by groups (cv_group). The model feeds models.predict, which scores it without R, and models.linear / models.glm fit the same models on tables too large for memory.

All blocks in this collection declare network: false — they operate purely on data already produced elsewhere in the pipeline.

Blocks🔗

BlockKindDescription
stats.summarystandardPer-column descriptive statistics (n, mean, sd, min, quartiles, max, missing)
stats.frequencystandardOne-way frequency table, or a contingency table when by is set
stats.correlationstandardCorrelation matrix over numeric columns (pearson/spearman/kendall)
stats.t_teststandardOne-sample (vs mu) or two-sample/paired Student's t-test
stats.chisq_teststandardPearson's chi-squared test of independence between two categorical columns
stats.anovastandardOne-way analysis of variance of a numeric response across a grouping column
stats.lmstandardLinear regression (least squares); writes a SpadeModel, coefficients and fit statistics
stats.glmstandardGeneralised linear model (gaussian, binomial, poisson, Gamma); writes a SpadeModel

Installation🔗

spade install file:///path/to/blocks/stats