Calculate a point estimate and error bar interval.
For more information about the various errorbar choices, see the
errorbar tutorial.
Additional variables:
weight: When passed to a layer that uses this stat, a weighted estimate
will be computed. Note that use of weights currently limits the choice of
function and error bar method to and , respectively.
"mean"
"ci"
Parameters:
func : str or callable
Name of a numpy.ndarray method or a vector -> scalar function.
errorbar : str, (str, float) tuple, or callable
Name of errorbar method (one of “ci”, “pi”, “se” or “sd”), or a tuple
with a method name ane a level parameter, or a function that maps from a
vector to a (min, max) interval.
n_boot : int
Number of bootstrap samples to draw for “ci” errorbars.
seed : int
Seed for the PRNG used to draw bootstrap samples.
Examples
The default behavior is to compute the mean and 95% confidence interval (using bootstrapping):
Other estimators may be selected by name if they are pandas methods:
p.add(so.Range(),so.Est("median"))
There are several options for computing the error bar interval, such as (scaled) standard errors:
p.add(so.Range(),so.Est(errorbar="se"))
The error bars can also represent the spread of the distribution around the estimate using (scaled) standard deviations:
p.add(so.Range(),so.Est(errorbar="sd"))
Because confidence intervals are computed using bootstrapping, there will be small amounts of randomness. Reduce the random variability by increasing the nubmer of bootstrap iterations (although this will be slower), or eliminate it by seeding the random number generator:
p.add(so.Range(),so.Est(seed=0))
To compute a weighted estimate (and confidence interval), assign a
weight variable in the layer where you use the stat: