Bootstrap bands of one dimensional interpolators and smoothers: the fit refitted on bootstrap samples of the data
pairs (drawn by fastmath.stats.bootstrap/bootstrap); the band at a point - a bootstrap confidence interval
(fastmath.stats.bootstrap ci-*) of the refitted values there.
Bootstrap bands of one dimensional interpolators and smoothers: the fit refitted on bootstrap samples of the data pairs (drawn by [[fastmath.stats.bootstrap/bootstrap]]); the band at a point - a bootstrap confidence interval ([[fastmath.stats.bootstrap]] `ci-*`) of the refitted values there.
(bootstrap fit-fn xs ys)(bootstrap fit-fn xs ys {:keys [samples rng ci estimation]})Bootstrap band of the fit fit-fn - (fn [xs ys] f) returning a function of x - of the data xs, ys.
The data (and every bootstrap sample) is sorted by x, with the mean y of repeated x values, so methods needing
strictly increasing nodes can be used. The :samples samples of the (x, y) pairs (with replacement) are drawn by
fastmath.stats.bootstrap/bootstrap; a sample whose fit throws (for example too few distinct points for the
method) is skipped and counted.
Parameters:
fit-fn (function): (fn [xs ys] f), f a function of one numberxs, ys (sequences of numbers): the data, of equal lengthopts (map, optional):
:samples (positive integer, default: 200): number of bootstrap samples:rng (random number generator, default: a new unseeded generator, see fastmath.random/ensure-rng): seed it to reproduce the band:ci (keyword, default: :percentile): the confidence interval of a band point, one of intervals (:percentile, :basic, :normal, :bc):estimation (keyword, default: :legacy): quantile estimation strategy of the interval (see fastmath.stats/quantiles; not used by :normal)Returns a Bootstrap record, a function: (f x) - the fit of the (prepared) data at x; (f x level) -
[lo hi], the :ci interval at confidence level in (0, 1) of the refitted values at x around the fit;
[fit fit] when no sample could be refitted. Fields: :fit, :fits (the refitted functions), :failed
(skipped samples). The fits are computed once; a band point costs O(samples).
Throws ex-info (:type :invalid-input, :method :bootstrap) for different lengths of xs and ys
(:length-mismatch), a :samples that isn't a positive integer (:samples), an unknown :ci (:ci), a fit of
the data that isn't a function (:fit-fn) or a level outside (0, 1) (:level); errors of the fit of the data
itself propagate.
Bootstrap band of the fit `fit-fn` - `(fn [xs ys] f)` returning a function of x - of the data `xs`, `ys`.
The data (and every bootstrap sample) is sorted by x, with the mean y of repeated x values, so methods needing
strictly increasing nodes can be used. The `:samples` samples of the `(x, y)` pairs (with replacement) are drawn by
[[fastmath.stats.bootstrap/bootstrap]]; a sample whose fit throws (for example too few distinct points for the
method) is skipped and counted.
Parameters:
- `fit-fn` (function): `(fn [xs ys] f)`, `f` a function of one number
- `xs`, `ys` (sequences of numbers): the data, of equal length
- `opts` (map, optional):
- `:samples` (positive integer, default: `200`): number of bootstrap samples
- `:rng` (random number generator, default: a new unseeded generator, see [[fastmath.random/ensure-rng]]): seed it to reproduce the band
- `:ci` (keyword, default: `:percentile`): the confidence interval of a band point, one of [[intervals]] (`:percentile`, `:basic`, `:normal`, `:bc`)
- `:estimation` (keyword, default: `:legacy`): quantile estimation strategy of the interval (see [[fastmath.stats/quantiles]]; not used by `:normal`)
Returns a `Bootstrap` record, a function: `(f x)` - the fit of the (prepared) data at `x`; `(f x level)` -
`[lo hi]`, the `:ci` interval at confidence `level` in (0, 1) of the refitted values at `x` around the fit;
`[fit fit]` when no sample could be refitted. Fields: `:fit`, `:fits` (the refitted functions), `:failed`
(skipped samples). The fits are computed once; a band point costs `O(samples)`.
Throws `ex-info` (`:type :invalid-input`, `:method :bootstrap`) for different lengths of `xs` and `ys`
(`:length-mismatch`), a `:samples` that isn't a positive integer (`:samples`), an unknown `:ci` (`:ci`), a fit of
the data that isn't a function (`:fit-fn`) or a `level` outside (0, 1) (`:level`); errors of the fit of the data
itself propagate.Bootstrap confidence intervals of a band point: :ci keyword -> (fn [boot-data alpha estimation] [lo hi t0])
over the fit at the point (:t0) and the refitted values (:ts), see fastmath.stats.bootstrap. Intervals
needing more than these (ci-bca, ci-studentized, ci-t) don't apply.
Bootstrap confidence intervals of a band point: `:ci` keyword -> `(fn [boot-data alpha estimation] [lo hi t0])` over the fit at the point (`:t0`) and the refitted values (`:ts`), see [[fastmath.stats.bootstrap]]. Intervals needing more than these (`ci-bca`, `ci-studentized`, `ci-t`) don't apply.
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 |