Skip to main content

Python package to calculate the weighted average with Bayesian methods

Project description

Calculation of robust weigted average from a set of data points and their uncertainties based on Bayesian statistical methods. The proposed weighted average is particularly adapted to inconsistent data and for the presence of outliers, which can both false the results of standard methods.

This robust weighted average is based on Bayesian statistics assuming a normal disrtribution for each data point and considering the associated uncertainty $x_i$ values as just a lower bound of the real possibly larger uncertainty $sigma’$. It is obtained by the marginalization on $sigma’$, this result in a modified probability distribution for each $x_i$ that still depens on $sigma_i$. Two different priors are proposed for $sigma’$: the non informative Jeffreys’ prior $p(sigma’) propto 1/ sigma’$ (more precisely its limit, see Ref.[1] in README file), and a modified version of it $p(sigma’) propto 1/ (sigma’)^2$ proposed in Ref.[2] (in README file).

For both priors, the weighted average and its associated uncertainty are obtained numerically using basinhopping minimisation algorithm.

In addition, the standard (inverse-variance) weighted average is also available for possible comparisons.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bayesian_average-0.1.4.tar.gz (5.1 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page