Macaw.Data.Operations.Aggregates (macaw_data v0.18.0)
View SourceThe statistics of macaw_data's package (spec/04 §5), each an aggregate
(Macaw.Data.Aggregate) ported from visualize's Visualize.Data:
| Name | Value | Of no readings | Output type | Unit |
|---|---|---|---|---|
count | the number of readings | 0 | :number | dropped |
distinct | the number of distinct readings (===, a category by spelling) | 0 | :number | dropped |
min, max | the least, the greatest reading, numbers or times of any kinds | nil | the input's | kept |
extent | [min, max] | nil | :term | kept |
sum | the sum of numbers | 0 | :number | kept |
mean | the arithmetic mean | nil | :number | kept |
median | the middle reading, or the mean of the two middles | nil | :number | kept |
quantile | linear interpolation at (n − 1) · p | nil | :number | kept |
variance | the sample variance | nil, and of one | :number | dropped |
deviation | its square root | nil, and of one | :number | kept |
slope | the least-squares slope; a number is the point [i, v] | nil, of one, or every x equal | :number | dropped |
delta | the last reading minus the first | nil (0 of one) | :number | kept |
The readings come with every nil dropped. min, max and extent order times of any
kinds together, as instants on one scale (Macaw.Data.Window.compare/2), and answer the
reading itself, of its own kind; of two at one instant, the first (macaw_data#141). A
reading of the wrong kind is refused before
the fold, by what each statistic reads/0 (spec/04 §5): Macaw.Data.Operations.aggregate/4
answers {["values"], {:reads, kind}}, and the step naming it refuses the column the same
way. 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
@spec all() :: [module()]
The modules of the thirteen statistics, in spec/04 §5's order.