Skip to content

Weighted Statistics

Weighted statistical functions for ABC particle analysis.

Resampling

resample

Resample particles according to weights.

approxbayescomp.weighted.resample(rng, weights, repeats=10)

resample_and_kde

Resample particles and apply kernel density estimation.

approxbayescomp.weighted.resample_and_kde(data, weights, cut=3, clip=(-np.inf, np.inf), seed=1, repeats=10)

Summary Statistics

weighted_quantile

Compute weighted quantiles from particle samples.

approxbayescomp.weighted.quantile(data, weights, quantile)

Weighted quantile of an array with respect to the last axis.

Parameters:

Name Type Description Default
data ndarray

Input array.

required
weights ndarray

Array with the weights. It must have the same size of the last axis of data.

required
quantile float

Quantile to compute. It must have a value between 0 and 1.

required

Returns:

Name Type Description
quantile float

The output value.

weighted_median

Compute weighted median from particle samples.

approxbayescomp.weighted.median(data, weights)

Weighted median of an array with respect to the last axis.

Alias for quantile(data, weights, 0.5).