MCUP will propagate uncertainty of your data points to the parameters of the regression using a Monte Carlo approach.
Project description
MCUP
MCUP (Monte Carlo Uncertainity Propagation) is a Python library that estimates the uncertainty of least squares fit parameters with Monte Carlo.
Status
Scope
The aim of this package is to estimate the error of regression parameters based on error intervals of the input data.
PEE – Parameter Error Estimator, a bootstraping method which, takes input data for lsq (x, y, x_err, y_err), generates datapoints within given errors and calculate mean and std of parameters from lsq fit.
Installing MCUP
PyPI
To install mlxtend, just execute
python3 -m pip install mcup
Dev Version
The MCUP version on PyPI may always be one step behind. You can install the latest development version from the GitHub repository by executing
python3 -m pip install git+https://github.com/detrin/MCUP.git#egg=mcup
Example
import numpy as np
from mcup import Measurement
x_data = np.array([0.0, 1.0, 2.0, 3.0, 4.0, 5.0])
y_data = np.array([0.1, 0.9, 2.2, 2.8, 3.9, 5.1])
y_sigma = np.array([0.0, 0.1, 0.1, 0.1, 0.1, 0.1])
def fun(x, c):
return c[0] * x + c[1]
c_initial_guess = [0.0, 0.0]
measurement = Measurement(x=x_data, y=y_data, y_err=y_sigma)
measurement.set_function(fun, c_initial_guess)
params_mean, params_std = measurement.evaluate_params(iter_num=1000)
print(params_mean)
# [0.9901532 0.02477131]
print(params_std)
# [0.01881003 0.04965347]
params_mean, params_std = measurement.evaluate_params(atol=1e-4, rtol=1e-4)
print(params_mean)
# [0.98854127 0.02771339]
print(params_std)
# [0.0172098 0.04729087]
Contributing
When contributing to this repository, please first discuss the change you wish to make via issue, email, or any other method with the owners of this repository before making a change.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file mcup-0.1.1.tar.gz
.
File metadata
- Download URL: mcup-0.1.1.tar.gz
- Upload date:
- Size: 6.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/1.1.3 pkginfo/1.5.0.1 requests/2.23.0 requests-toolbelt/0.8.0 tqdm/4.23.1 CPython/3.6.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cb9ab1272c3a64d69b2c5da6fcbdcad2b3bf4d932cf08844bef64221d35a8934 |
|
MD5 | b2a70c81a10eb194b9d79979b3d02922 |
|
BLAKE2b-256 | 74ad024cefc37b927168dfabc89bbafbfb1da4d1bc33e4df6e902d552d688cd9 |