# Calibration with noisy data

**URL:** <https://openturns.discourse.group/t/calibration-with-noisy-data/195>\
**Category:** Python usage\
**Tags:** calibration\
**Created:** [March 25, 2022, 12:16pm UTC](https://openturns.discourse.group/t/calibration-with-noisy-data/195 "2022-03-25T12:16:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sanaaZ](https://yyz2.discourse-cdn.com/free1/user_avatar/openturns.discourse.group/sanaaz/32/241_2.png) [@sanaaZ](https://openturns.discourse.group/u/sanaaZ)\
**Post date:** [March 25, 2022, 12:16pm UTC](https://openturns.discourse.group/t/calibration-with-noisy-data/195/1 "2022-03-25T12:16:39Z")

</div>

Hello,  
could anyone enlighten me as to what `setObservationsError` method in the calibration context does ? i would like to calibrate a model whose observations are tainted with measurement error, and i do have a way for estimating such a noise. i don’t understand why a method for setting the error on the observations should be made available in the `CalibrationResult` class, instead of the `CalibrationAlgorithm` class ?

thanks!

Sanaa

---

<div class="post-metadata">

**Author:** ![josephmure](https://yyz2.discourse-cdn.com/free1/user_avatar/openturns.discourse.group/josephmure/32/114_2.png) [@josephmure](https://openturns.discourse.group/u/josephmure)\
**Post date:** [March 25, 2022, 10:15pm UTC](https://openturns.discourse.group/t/calibration-with-noisy-data/195/2 "2022-03-25T22:15:30Z")

</div>

Hello Sanaa,

All Result objects are constructed by the `run()` method of the corresponding Algorithm class (here XxxCalibration). To set the attributes of the Result object, the Algorithm class may use the accessors provided by the Result class (although the values of the attributes are usually passed as arguments to the constructor of the Result).

When you call the `run()` method of the Algorithm, you get a fully computed Result and have no reason to modify its attributes. If you do, it will no longer be the result of the algorithm, but what you decide instead.

However, if you want to code your own `SanaaCalibration` class, you will have the responsibility to build the `CalibrationResult` and `CalibrationResult::setObservationError` may then be useful to you.

Now, here is how the calibration classes handle observation errors:

- `LinearLeastSquaresCalibration` and `NonLinearLeastSquaresCalibration` assume the measurement errors of the observations are a Gaussian vector with null mean. They estimate its covariance matrix.
- `GaussianLinearCalibration` and `GaussianNonLinearCalibration` assume the measurement errors of the observations are a Gaussian vector with null mean and known covariance matrix. The covariance matrix is passed by the user to the constructor as the **errorCovariance** parameter. In your case, I gather that the measurement errors are independent and their standard deviation is known to you, so you could pass a diagonal `CovarianceMatrix`.

In any case, the (multivariate normal) distribution of this random vector is given by the `CalibrationResult::getObservationsError` method.

---

<div class="post-metadata">

**Author:** ![sanaaZ](https://yyz2.discourse-cdn.com/free1/user_avatar/openturns.discourse.group/sanaaz/32/241_2.png) [@sanaaZ](https://openturns.discourse.group/u/sanaaZ)\
**Post date:** [March 28, 2022, 9:26am UTC](https://openturns.discourse.group/t/calibration-with-noisy-data/195/3 "2022-03-28T09:26:31Z")

</div>

thanks a lot joseph, i am going to look into it, i’ve had completely overlooked the **errorCovariance** méthod you are mentionning and thought that i had to use MCMC methods in order to factor in measurement errors

it seems to be exactly what i am looking for, especially since i have correlated errors

thanks  
sanaa
