DwelltimeBootstrap

lumicks.pylake.population.dwelltime.DwelltimeBootstrap

class DwelltimeBootstrap(model: lumicks.pylake.population.dwelltime.DwelltimeModel, amplitude_distributions: numpy.ndarray, lifetime_distributions: numpy.ndarray)

Bootstrap distributions for a dwelltime model.

This class should be initialized using lk.DwelltimeModel.calculate_bootstrap() and should not be constructed manually.

model

Original model sampled for the bootstrap distribution

Type

DwelltimeModel

amplitude_distributions

Array of sample optimized amplitude parameters; shape is [number of components, number of samples]

Type

np.ndarray

lifetime_distributions

Array of sample optimized lifetime parameters; shape is [number of components, number of samples]

Type

np.ndarray

calculate_stats(key, component, alpha=0.05)

Deprecated since version 0.13.3: This method will be removed in a future release. Use DwelltimeBootstrap.get_interval() to obtain the `1-alpha interval.

extend(iterations)

Extend the distribution by additional sampling iterations.

Parameters

iterations (int) – number of iterations (random samples) to add to the bootstrap distribution

get_interval(key, component, alpha=0.05)

Calculate the 1-alpha interval of the bootstrap distribution for a specified parameter.

NOTE: the 100*(1-alpha) % confidence intervals calculated here correspond to the alpha/2 and 1-(alpha/2) quantiles of the distribution. For distributions which are not well approximated by a normal distribution these values are not reliable confidence intervals.

Parameters
  • key ({'amplitude', 'lifetime'}) – name of the parameter to be analyzed

  • component (int) – index of the component to be analyzed

  • alpha (float) – confidence intervals are calculated as 100*(1-alpha)%

hist(*, n_bins=25, alpha=0.05, hist_kwargs=None, span_kwargs=None, line_kwargs=None)

Plot the bootstrap distributions for the parameters of a model.

Parameters
  • n_bins (int) – number of bins in the histogram

  • alpha (float) – confidence intervals are calculated as 100*(1-alpha)%

  • hist_kwargs (dict) – dictionary of plotting kwargs applied to histogram

  • span_kwargs (dict) – dictionary of plotting kwargs applied to the patch indicating the area spanned by the confidence intervals

  • line_kwargs (dict) – dictionary of plotting kwargs applied to the line indicating the distribution means

plot(alpha=0.05, n_bins=25, hist_kwargs=None, span_kwargs=None, line_kwargs=None)

Deprecated since version 0.13.3: This method has been renamed to more closely match its behavior. Use DwelltimeBootstrap.hist() instead.

property n_components

Number of components in the model.

property n_samples

Number of samples in the bootstrap.