Macaw.Data.Operations.Aggregates (macaw_data v0.5.3)

Copy Markdown View Source

The statistics of macaw_data's package (spec/04 §5), each an aggregate (Macaw.Data.Aggregate) ported from visualize's Visualize.Data:

NameValueOf no readingsOutput typeUnit
countthe number of readings0:numberdropped
distinctthe number of distinct readings (===, a category by spelling)0:numberdropped
min, maxthe least, the greatest reading, numbers or timesnilthe input'skept
extent[min, max]nil:termkept
sumthe sum of numbers0:numberkept
meanthe arithmetic meannil:numberkept
medianthe middle reading, or the mean of the two middlesnil:numberkept
quantilelinear interpolation at (n − 1) · pnil:numberkept
variancethe sample variancenil, and of one:numberdropped
deviationits square rootnil, and of one:numberkept
slopethe least-squares slope; a number is the point [i, v]nil, of one, or every x equal:numberdropped
deltathe last reading minus the firstnil (0 of one):numberkept

The readings come with every nil dropped. A reading of the wrong kind raises ArgumentError naming the aggregate and the reading. Every statistic but median and quantile has the streaming form, and its reduce/2 is that form folded over the readings, so the two are equal by construction: the mean is a running sum over a count, the variance and the slope Welford's one-pass updates, which agree with visualize's two-pass values to within floating-point rounding.

Summary

Functions

The modules of the thirteen statistics, in spec/04 §5's order.

Functions

all()

@spec all() :: [module()]

The modules of the thirteen statistics, in spec/04 §5's order.