Statistical tests

Correlation, regression, crosstabs, t-tests and ANOVA — DreamSheets writes the Python, scipy and statsmodels do the arithmetic, and the script stays on your canvas as an editable record of the analysis.

Tools → Statistics… runs a statistical procedure over one of your tables. Pick the procedure and its variables, and DreamSheets writes a Python script onto the canvas and runs it. The results arrive as ordinary table and tile cards.

The important part is what DreamSheets doesn't do: it implements no statistics of its own. Every number comes from scipy and statsmodels, the same libraries the research world already relies on. The panel only writes the first draft of the script — and that script is yours, on the canvas, to read and edit.

That buys three things a point-and-click stats package can't:

  • Nothing is a black box. The exact code that produced your numbers is sitting next to them.
  • You are never stuck. If you need a procedure we didn't build, edit the one we did. Run executes the file, not the panel.
  • The script is your methods section. It says precisely what was done, in a form someone else can re-run.
This page is about the Statistics panel. For AVERAGE, STDEV, CORREL and the other spreadsheet functions you write inside a cell, see the function reference.

Requirements

The panel needs Python with scipy and statsmodels, on top of the pandas and duckdb that all scripts require:

pip install scipy statsmodels

Nothing is bundled — DreamSheets uses your own interpreter. Without Python at all, the menu entry stays hidden. With Python but without those two packages, the panel opens and tells you exactly what to install rather than generating a script that dies on an import error. DreamSheets checks once at startup, so restart it after installing.

The procedures

ProcedureAnswersReports
Correlation matrixWhich of these measurements move together?Pearson or Spearman coefficients, 95% confidence intervals, n per pair
Linear regressionWhat predicts this, and by how much?Coefficients with standard errors, t, p and intervals; R²; optional VIF and standardized betas
Crosstab + chi-squareAre these two categories related?Counts, row percentages, chi-square, Cramér's V, expected counts
Independent-samples t-testDo these two groups differ?t, df, p, mean difference, Cohen's d — Welch's correction optional
One-way ANOVADo these three-or-more groups differ?F, df, p, eta-squared, and optional Tukey HSD comparisons

Every procedure also emits an Assumption Checks table: the tests behind the result (Shapiro-Wilk, Levene, Breusch-Pagan, expected cell counts) with a plain-English reading of each, including what to do when one fails. Those readings are a fixed lookup, not generated prose — the same result always produces the same words.

Measurement levels

Some columns hold measurements (price, age, score) and some hold categories (region, treatment group). Both can be numbers — a group coded 1, 2, 3 is a category, not a quantity — and averaging the second kind is meaningless.

DreamSheets guesses which is which from your data, and each procedure only offers the columns that suit it. When a guess is wrong, click Set Measurement Levels… in the panel and correct it: one dropdown per column, with Auto as the default so a column keeps following the data unless you say otherwise.

The setting lives only here. It never appears in the grid, changes nothing about how your data is stored, sorted or exported, and doesn't exist for anyone who doesn't run a statistical test.

Value labels

If your data uses codes (1 = Control, 2 = Treatment), build a Codebook table — a plain table with Variable, Value and Label columns — and results will read Control rather than 1. The panel's Create Codebook Table button seeds one from your data; you then edit the labels in the grid like any other table.

Regression in more depth

Categorical predictors. A category can predict something even though "West" can't be multiplied by a coefficient: it expands into one 0/1 term per level after the first. That first level is the reference, reported in a Reference Levels table, and every other level's coefficient reads as the difference from it.

Blocks. Tick Enter predictors in blocks to add predictors in groups and see what each group buys you. The Model Comparison table reports the change in R² per block and whether that change is significant — the honest way to answer "does this second set of variables add anything once the obvious ones are accounted for."

There is deliberately no automatic model selection (stepwise). It reliably finds patterns that don't survive new data, which is why the field has largely turned against it. Blocks are the theory-driven alternative.

VIF flags predictors that overlap so heavily their individual coefficients stop meaning much. It isn't reported for the 0/1 terms of a category, whose overlap is a mathematical certainty rather than a warning sign.

Prediction formulas

Regression can create a custom function you use anywhere in the document:

=PredictPrice(@SqFt, @Region)

Tick Create prediction formula, name it, and build whatever scenario table you like — type sizes and regions into a table, add a calc column, and read the predictions off.

The function doesn't copy the coefficients; it looks them up in the emitted model table. So when your data changes, re-run the regression and every prediction in the document updates with it. The model and its predictions can never quietly disagree.

Two consequences worth knowing: the function reads #N/A until the script has been run once, and renaming the model table or a predictor breaks it. Both fail visibly, which a silently stale number would not.

Working with the results

Results are ordinary canvas objects, so everything else already works on them: lineage arrows back to the source table, undo, save, cloud versioning and merge. Edit the source data and the script card marks itself stale; Refresh re-runs it and updates the results in place.

Limits

  • Five procedures, not hundreds. For anything else, edit the generated script — that's what it's there for.
  • No mixed models, factor analysis, survey weights, or Fisher's exact test.
  • The reference level for a category is the first one alphabetically; you can't pick a different one from the panel.
  • No interaction terms in the regression form.
  • The generated script and the prediction formula are two separate actions, so undo takes two steps.