# Bayesian inference: Prediction?

**URL:** <https://uqworld.org/t/bayesian-inference-prediction/1831>\
**Category:** Community Q&A and How To\
**Tags:** inversion\
**Created:** [March 19, 2023, 2:28pm UTC](https://uqworld.org/t/bayesian-inference-prediction/1831 "2023-03-19T14:28:33Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mr121Tony](https://uqworld.org/user_avatar/uqworld.org/mr121tony/32/1070_2.png) [@Mr121Tony](https://uqworld.org/u/Mr121Tony)\
**Post date:** [March 19, 2023, 2:28pm UTC](https://uqworld.org/t/bayesian-inference-prediction/1831/1 "2023-03-19T14:28:33Z")

</div>

Dear Professors,  
In addition to parameter calibration, can the Bayesian inference module in UQLab be used to make predictions?  
best wishes  
Student

---

<div class="post-metadata">

**Author:** ![styfen.schaer](https://uqworld.org/user_avatar/uqworld.org/styfen.schaer/32/849_2.png) [@styfen.schaer](https://uqworld.org/u/styfen.schaer)\
**Post date:** [March 24, 2023, 9:02am UTC](https://uqworld.org/t/bayesian-inference-prediction/1831/2 "2023-03-24T09:02:07Z")

</div>

Dear @Mr121Tony

It is not exactly clear to me what you mean by “making prediction”. Are you interested in the predictive distribution? If yes, I suggest you to first have a look at the manual:

> **[UQLab - Bayesian inversion user manual](https://www.uqlab.com/inversion-user-manual)**
>
> User manual for the Bayesian inference for model calibration and inverse problems (Inversion) module of UQLab.

Let us know if this is not what you’re interested in or if you are stuck with the implementation.

Best regards  
Styfen

---

<div class="post-metadata">

**Author:** ![Mr121Tony](https://uqworld.org/user_avatar/uqworld.org/mr121tony/32/1070_2.png) [@Mr121Tony](https://uqworld.org/u/Mr121Tony)\
**Post date:** [March 27, 2023, 12:26pm UTC](https://uqworld.org/t/bayesian-inference-prediction/1831/3 "2023-03-27T12:26:56Z")

</div>

In UQLab - Bayesian inversion user manual, there are model predictions as shown in the picture. How can I use it to make predictions in a real case?

 ![1](https://uqworld.org/uploads/default/original/2X/6/6170034a39aacb40b102cdf2a958324a8ee526c0.png)

---

<div class="post-metadata">

**Author:** ![olaf.klein](https://uqworld.org/user_avatar/uqworld.org/olaf.klein/32/468_2.png) [@olaf.klein](https://uqworld.org/u/olaf.klein)\
**Post date:** [April 12, 2023, 3:01pm UTC](https://uqworld.org/t/bayesian-inference-prediction/1831/4 "2023-04-12T15:01:50Z")

</div>

Dear @Mr121Tony ,

if you are interested in making predictions in a “real case”, you have to generate a `BayesOpts` object as described in Section 3.1 of the manual describing the “real case” and use this as input for `uq_createAnalysis`. Using the `.Results.PostProc.PostSample`-component of the struct resulting from this this function call one can compute predictions, which I prefer to denote as performing forward UQ.

Following the suggestion by Paul-Remo in [https://uqworld.org/t/looking-for-documentation-example-of-using-uqlab-results-of-bayesian-inference-for-forward-uq-or-further-bayesian-inference/690/2?u=olaf.klein](https://uqworld.org/t/looking-for-documentation-example-of-using-uqlab-results-of-bayesian-inference-for-forward-uq-or-further-bayesian-inference/690/2) I extract 2D-arrays containing sample-vectors of  
the values of the different parameters combined with a value for the computed discrepancy. Afterwards I use these sample-vectors to perform Forward UQ  
similar to the method the posterior predictive samples are computed in UQLab:  
for each sample-vector I computed the value for my model for the given set of  
parameter values and afterwards noise was added by computing a noise sample  
for a normal distributed error according to the corresponding discrepancy value to  
get a sample for the posterior predictive density.

Greetings  
Olaf

---

<div class="post-metadata">

**Author:** ![Mr121Tony](https://uqworld.org/user_avatar/uqworld.org/mr121tony/32/1070_2.png) [@Mr121Tony](https://uqworld.org/u/Mr121Tony)\
**Post date:** [April 13, 2023, 1:32am UTC](https://uqworld.org/t/bayesian-inference-prediction/1831/5 "2023-04-13T01:32:33Z")

</div>

@olaf.klein, Thank you. I will try to solve this problem.
