DwelltimeBootstrap

lumicks.pylake.population.dwelltime.DwelltimeBootstrap

class DwelltimeBootstrap(_samples: numpy.ndarray = <factory>)

Bootstrap distributions for a dwelltime model.

This class is stored in the DwelltimeModel.bootstrap attribute and should not be constructed manually.

_samples

array of optimized model parameters for each bootstrap sample pull; shape is [number of parameters, number of samples]

Type

np.ndarray

calculate_stats(key, component, alpha=0.05)

Calculate the mean and confidence intervals of the bootstrap distribution for a parameter.

NOTE: the 100*(1-alpha) % confidence intervals calculated here correspond to the 100*(alpha/2) and 100*(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)%

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

Plot the bootstrap distributions for the parameters of a model.

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

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

  • 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

property amplitude_distributions

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

property lifetime_distributions

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

property n_components

Number of components in the model.

property n_samples

Number of samples in the bootstrap.