# How to define reasonable observed data

**URL:** <https://discourse.pymc.io/t/how-to-define-reasonable-observed-data/585>\
**Category:** Questions\
**Created:** [November 20, 2017, 2:50am UTC](https://discourse.pymc.io/t/how-to-define-reasonable-observed-data/585 "2017-11-20T02:50:09Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![dreamqin68](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/dreamqin68/32/290_2.png) [@dreamqin68](https://discourse.pymc.io/u/dreamqin68)\
**Post date:** [November 20, 2017, 2:50am UTC](https://discourse.pymc.io/t/how-to-define-reasonable-observed-data/585/1 "2017-11-20T02:50:09Z")

</div>

I want to test a math function ,like y=x1+x2 , but no observed data.

x1=pm.Normal(‘x1’,mu=0.5,sd=0.5)

x2=pm.Normal(‘x1’,mu=0.5,sd=0.5)

y=x1+x2

Y=pm.Normal(‘Y’,mu = y,sd=1,observed =obs)

so how to define reasonable observed data? and why ?

---

<div class="post-metadata">

**Author:** ![junpenglao](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/junpenglao/32/8_2.png) [@junpenglao](https://discourse.pymc.io/u/junpenglao)\
**Post date:** [November 20, 2017, 9:14am UTC](https://discourse.pymc.io/t/how-to-define-reasonable-observed-data/585/2 "2017-11-20T09:14:49Z")

</div>

Not sure I understand your question, but if the function is not directly observed, and you want to do inference on this latent variable, the code you wrote above is correct.

---

<div class="post-metadata">

**Author:** ![sammosummo](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/sammosummo/32/96_2.png) [@sammosummo](https://discourse.pymc.io/u/sammosummo)\
**Post date:** [November 20, 2017, 3:42pm UTC](https://discourse.pymc.io/t/how-to-define-reasonable-observed-data/585/3 "2017-11-20T15:42:11Z")

</div>

I don’t understand this question either.

---

<div class="post-metadata">

**Author:** ![dreamqin68](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/dreamqin68/32/290_2.png) [@dreamqin68](https://discourse.pymc.io/u/dreamqin68)\
**Post date:** [November 21, 2017, 5:27am UTC](https://discourse.pymc.io/t/how-to-define-reasonable-observed-data/585/4 "2017-11-21T05:27:43Z")

</div>

I mean there is no observed data. so may I run it with no observed data. if not, how to define the observed data?

x1=pm.Normal(‘x1’,mu=0.5,sd=0.5)

x2=pm.Normal(‘x2’,mu=0.5,sd=0.5)

y=x1+x2

Y=pm.Normal(‘Y’,mu = y,sd=1)

---

<div class="post-metadata">

**Author:** ![sammosummo](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/sammosummo/32/96_2.png) [@sammosummo](https://discourse.pymc.io/u/sammosummo)\
**Post date:** [November 28, 2017, 4:16pm UTC](https://discourse.pymc.io/t/how-to-define-reasonable-observed-data/585/5 "2017-11-28T16:16:01Z")

</div>

I still don’t understand what you are asking. If you run the model you defined in your last post, it will sample from the priors on `x1`, `x2`, and `Y`. There is no connection and no observations defined, so your traces of the three parameters should be independent. The model will also sample `y` from its implicit prior.

---

<div class="post-metadata">

**Author:** ![bwengals](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/bwengals/32/1237_2.png) [@bwengals](https://discourse.pymc.io/u/bwengals)\
**Post date:** [November 29, 2017, 9:53pm UTC](https://discourse.pymc.io/t/how-to-define-reasonable-observed-data/585/6 "2017-11-29T21:53:38Z")

</div>

Do you mean sampling from the prior predictive? If so, you can do:

```
with pm.Model() as model:
    x1 = pm.Normal('x1', mu=0.5, sd=0.5)
    x2 = pm.Normal('x2', mu=0.5, sd=0.5)
    y = pm.Deterministic('y', x1 + x2)

with model:
    trace = pm.sample(1000)

```

and then look at the trace of `y`.

---

<div class="post-metadata">

**Author:** ![sammosummo](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/sammosummo/32/96_2.png) [@sammosummo](https://discourse.pymc.io/u/sammosummo)\
**Post date:** [November 30, 2017, 2:59pm UTC](https://discourse.pymc.io/t/how-to-define-reasonable-observed-data/585/7 "2017-11-30T14:59:23Z")

</div>

Isn’t that the prior? I don’t understand the difference.

---

<div class="post-metadata">

**Author:** ![dreamqin68](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/dreamqin68/32/290_2.png) [@dreamqin68](https://discourse.pymc.io/u/dreamqin68)\
**Post date:** [December 14, 2017, 7:21am UTC](https://discourse.pymc.io/t/how-to-define-reasonable-observed-data/585/8 "2017-12-14T07:21:42Z")

</div>

oh, thanks very much. I maybe wrong that I think It’s necessary to define oberserved data.
