# How do I predict on new, unseen real data using pm.sample\_posterior\_predictive?

**URL:** <https://discourse.pymc.io/t/how-do-i-predict-on-new-unseen-real-data-using-pm-sample-posterior-predictive/6467>\
**Category:** Questions\
**Created:** [December 22, 2020, 9:59pm UTC](https://discourse.pymc.io/t/how-do-i-predict-on-new-unseen-real-data-using-pm-sample-posterior-predictive/6467 "2020-12-22T21:59:39Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![cluhmann](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/cluhmann/32/3083_2.png) [@cluhmann](https://discourse.pymc.io/u/cluhmann)\
**Post date:** [December 23, 2020, 3:43pm UTC](https://discourse.pymc.io/t/how-do-i-predict-on-new-unseen-real-data-using-pm-sample-posterior-predictive/6467/2 "2020-12-23T15:43:18Z")

</div>

You can use [`set_data()`](https://docs.pymc.io/en/latest/api/generated/pymc.set_data.html#pymc.set_data) to swap out the data you used for inference for something new (e.g., out-of-sample test data) before running `sample_posterior_predictive`. That will allow you to use your estimated model parameters to generate predictions about your outcome (i.e., `Y` in your case) in a new scenario (i.e., for new values of `dX1`, `dX2`, etc.).

[This notebook](https://www.pymc.io/projects/docs/en/stable/learn/core_notebooks/posterior_predictive.html) may be of additional use to you.

[Edit: documentation links updated]

---

_[View the full topic](https://discourse.pymc.io/t/how-do-i-predict-on-new-unseen-real-data-using-pm-sample-posterior-predictive/6467)._
