Monte Carlo (random-based) method to estimate the interval of confidence in a function's result, when that function operates on samples from a complex or unknown distribution.
More...
template<class SampleT, sdt Dim = 1, class Real__ = Real>
class honey::Bootstrap< SampleT, Dim, Real__ >
Monte Carlo (random-based) method to estimate the interval of confidence in a function's result, when that function operates on samples from a complex or unknown distribution.
If a function operates on sample data from a distribution, it will produce confident answers with little variation if it has enough samples to work with. For example, a function to find the mean of the number of heads per 10 coin tosses would operate on a large set coin toss samples, and the more samples, the more the mean approaches a stable value – 5 (the mean of a binomial distribution with N=10, p=0.5) But what if the coin is rigged? The distribution becomes unknown, thus the approaching mean is unknown.
The bootstrap method uses the empirical data available (the toss samples) to estimate the stability of the function result (the mean). This stability is expressed as a 95% confidence interval, which says that the mean of any set of toss samples will lie within the interval 95% of the time. It's important to note that the confidence interval is an estimation – the more samples provided, the more accurate and tighter the interval.
- Template Parameters
-
SampleT | Bootstrap sample data type. |
Dim | Dimension of the functor result. |
- See also
- Bootstrap()
Algorithm from "Better Bootstrap Confidence Intervals", Efron, 1987.
template<class SampleT , sdt Dim = 1, class Real__ = Real>
Constructor, set up constants for all calculation calls.
The functor operates on a selection of the original samples, and returns a vector of dimension Dim. For example, a coin toss mean functor would count the number of heads per 10 bool samples, and return the average count (a Real) in the form of a 1D vector.
- Parameters
-
func | Functor to process samples |
gen | Random generator |
samples | Sample data to bootstrap. |
alpha | The non-confidence of the interval, usually 5%, which gives a 95% confidence interval. |
bootSampleCount | The number of function samples to take for estimating the interval. The higher the better, but above 100 is excessive. The total functor call count is: bootSampleCount + samples.size() |