# Bayes theorem with errors

#### billket

##### New Member
I have a situation in which I want to calculate, for a given $y$ (which I measure experimentally), the probability distribution of $x$ i.e. $p(x|y)$ (actually what I need is the value of x for which this is maximized). Using Bayes theorem I have $p(x|y) = \frac{p(y|x)p(x)}{p(y)}$. I know both $p(x)$ and $p(y|x)$ which are both Gaussians. I don't know $p(y)$, but given that $y$ is constant for a given measurement, and all that I need is the maximum value over x, that shouldn't matter. However, in practice, I have an error associated to $y$, call it $dy$ ($y$ is Gaussian distributed). How can I account for this uncertainty on $y$ when trying to find the best $x$ (and the uncertainty on $x$)? Thank you!

#### katxt

##### Well-Known Member
Perhaps Deming Regression is what you are looking for.

#### Dason

##### Ambassador to the humans
I'm not really entirely clear on what is going on. But you said y is constant but x has some error associated with it. Is there a particularly reason you aren't regressing x on y instead of y on x? Seems like you're trying to best fit x from y so... why not just build the model in that direction in the first place?

#### hlsmith

##### Less is more. Stay pure. Stay poor.
Also, can you fix your LAtEx, please. My dumbass can't fully appreciate the question in its current state.

#### Dason

##### Ambassador to the humans
Just ignore the dollar signs. It's pretty much readable without them and they wouldn't actually modify how anything really looks except for the one case where they use frac but that should be pretty understandable too.

#### hlsmith

##### Less is more. Stay pure. Stay poor.
I have a situation in which I want to calculate, for a given y (which I measure experimentally), the probability distribution of x i.e. p(x|y) (actually what I need is the value of x for which this is maximized). Using Bayes theorem I have p(x|y) = {p(y|x)p(x)} /{p(y)}. I know both p(x) and p(y|x) which are both Gaussians. I don't know p(y), but given that y is constant for a given measurement, and all that I need is the maximum value over x, that shouldn't matter. However, in practice, I have an error associated to y, call it dy (y is Gaussian distributed). How can I account for this uncertainty on y when trying to find the best x (and the uncertainty on x)? Thank you!

#### katxt

##### Well-Known Member
Seems like you're trying to best fit x from y so... why not just build the model in that direction in the first place?
Is this a calibration problem where you measure y from known x's, then use the equation in reverse to predict x from measured y's.