The Machines · Runtime stack

seedstats

A reckoner seed: stats's descriptive layer — machines/seeds/seedstats.shoddy

the seedstats machine's icon

Summary

seedstats bridges the eleven statistics words a data session actually reaches for: MEAN MEDIAN STDDEV STDDEVP VAR SUM QUANTILE CORREL NORMCDF NORMINV TCDF. stats carries a much larger surface — skewness, the t/F/chi-squared tests, ANOVA, confidence intervals. Those are deliberately left for a future seed rather than bridged wholesale here. The promise is that a domain arrives with zero engine changes whenever it is wanted. That does not mean every word in a machine arrives on day one.

Why It's Useful

Guarded where stats.shoddy isn't. Mean, Median, StdDev, Var and Quantile all divide, index or Error somewhere inside on an empty or too-short list. Every guard here runs before the call that would otherwise abort. CORREL refuses two lists of different lengths. It also refuses a list that does not vary — one whose standard deviation, the spread measure, is zero — before Correl's own division sees either.

User's Guide

Let st0 = RckSeedStats(RckNew())
RckEval(st0, "{ 12500 13100 11900 } MEAN")     ' x: 12500
RckEval(st0, "{ 12500 13100 11900 } STDDEV")    ' x: 606.9...
RckEval(st0, "{ 1 2 3 4 5 } 0.5 QUANTILE")     ' x: 3

Every list-taking word pops exactly one cell — the list as a single value, never one value per element. That is cuttle's single-cell contract. So a data column loaded from a file goes straight in.

Word Reference

WordDescription
MEAN ( xs -- m )The arithmetic mean of a list of numbers; refuses an empty list.
MEDIAN ( xs -- m )The middle value of a list of numbers; refuses an empty list.
STDDEV ( xs -- s )Sample standard deviation (divides by n-1); refuses fewer than two values.
STDDEVP ( xs -- s )Population standard deviation (divides by n); refuses an empty list.
VAR ( xs -- v )Sample variance (divides by n-1); refuses fewer than two values.
SUM ( xs -- s )The total of a list of numbers; 0 for an empty list.
QUANTILE ( xs p -- q )The value at fraction p (0 to 1) into the sorted list; refuses an empty list or p outside 0..1.
CORREL ( xs ys -- r )Pearson correlation between two lists of numbers of the same length; refuses mismatched lengths, fewer than two values, or a list that does not vary.
NORMCDF ( z -- p )The standard normal cumulative distribution at z.
NORMINV ( p -- z )The standard normal quantile for probability p; refuses p outside the open interval 0..1.
TCDF ( t df -- p )The Student's t cumulative distribution at t with df degrees of freedom; refuses a non-positive df.

Who Uses It

UserHow
halifaxA list to a statistic in one line — { 12500 13100 11900 } MEAN is the mill's headline example, and MEDIAN, STDDEV, QUANTILE and CORREL come with it.
sparkySparky folds it too, so a model calling eval reaches the same words halifax puts at a prompt.

A mill — a complete Shoddy program — claims this seed by folding RckSeedStats over its reckoner state. That is all halifax does.

The Machines It Uses

MachineWhy
cuttleThe Cell type a LIST argument is read out of.
reckonerRckReg, RckSeeding and the argument readers every registered word is built from.
seqList plumbing under the LIST-of-NUMBER reader every word here shares.
statsThe domain this seed bridges: Mean, StdDev, Quantile, Correl and the normal/t distributions.