Low-level numeric primitives shared across datajure namespaces.
Leaf namespace — depends only on tech.v3.datatype, so expr/core/stat/util can all use it without a require cycle (expr already requires stat, which rules out homing these in expr).
Quantiles use R's default type-7 estimator everywhere in datajure, chosen
to match R's quantile(..., type = 7) / median exactly (the reference
implementation for the finance workloads datajure is built against). This
differs from tech.ml.dataset's dfn/percentiles / dfn/median (Apache Commons
Math, a different estimation type) at the tails AND, for some n, the median.
Low-level numeric primitives shared across datajure namespaces. Leaf namespace — depends only on tech.v3.datatype, so expr/core/stat/util can all use it without a require cycle (expr already requires stat, which rules out homing these in expr). Quantiles use R's default **type-7** estimator everywhere in datajure, chosen to match R's `quantile(..., type = 7)` / `median` exactly (the reference implementation for the finance workloads datajure is built against). This differs from tech.ml.dataset's `dfn/percentiles` / `dfn/median` (Apache Commons Math, a different estimation type) at the tails AND, for some n, the median.
(quantile-type7 coll p)(quantile-type7 coll p min-n)R type-7 quantile of the finite values in coll at probability p (a
fraction in [0,1]).
Drops nil and non-finite (NaN/±Inf) values, sorts ascending, and linearly
interpolates at h = (n-1)p (0-indexed): for sorted x, lo = floor(h),
result = x[lo] + (h-lo)·(x[lo+1] - x[lo]). Matches quantile(x, p, type = 7, na.rm = TRUE) in R.
Returns nil when no finite values remain, or — when min-n is supplied — when
fewer than min-n finite values remain (R's if (length(x) < k) NA). min-n
is floor-free by default; pass it only for rules like the peer-bands n>=11.
R type-7 quantile of the finite values in `coll` at probability `p` (a fraction in [0,1]). Drops nil and non-finite (NaN/±Inf) values, sorts ascending, and linearly interpolates at h = (n-1)p (0-indexed): for sorted x, lo = floor(h), result = x[lo] + (h-lo)·(x[lo+1] - x[lo]). Matches `quantile(x, p, type = 7, na.rm = TRUE)` in R. Returns nil when no finite values remain, or — when `min-n` is supplied — when fewer than `min-n` finite values remain (R's `if (length(x) < k) NA`). `min-n` is floor-free by default; pass it only for rules like the peer-bands n>=11.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |