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 details)

Uploaded Source

File details

Details for the file bayesian_average-0.1.4.tar.gz.

File metadata

  • Download URL: bayesian_average-0.1.4.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.8

File hashes

Hashes for bayesian_average-0.1.4.tar.gz
Algorithm Hash digest
SHA256 b633c62ba6963e1b0ca3b9d80cb8450b3490457b46809ebbb82f8695440a7367
MD5 e71dc3bb732b884a998f525533882b97
BLAKE2b-256 bfcb03e03a4aa6d5963a6b17906af6cfd08917ac3df1c3b42541a3c614e0cba9

See more details on using hashes here.

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