I have a question from my stats class that I am confused about how to proceed with. I have a general idea of what I am to do but I am not sure how to start.

The question is about a car that is moving on a road. It's beginning position is b, and b is normally distributed ~N(0,6). At b the car drives around, the distance the car drives is d with d~N(0,5). If d is positive, the car went up. Otherwise it moves to the down. Given that b and d are statistically independent and the car's final location is 6 or c = 6 (c being the final placement of the car). Find the most likely location b or where the car first began moving.

From what I understand, c=6 is just an observation and we are to find P(b|d=6) with b ~N(0,6) and d~(0,5), maximizing for the probability that d = 6. But I'm not sure how to proceed from that.



I messed up the notation of the normal distribution. All occurrences of the variance $5^2$ and $6^2$ must be replaced by $5$ and $6$ respectively. This also affects the calculations

I'll try and fix it tomorrow since I don't have access to octave right now.

I'll give it a try, but I am not 100% sure. I think what you are looking for is actually the maximum of $P(B|C=6)$.

You can start by noting that

$P(C|B,D) = \delta(C-(B+D)) $,

which is just a formal expression for "C is the sum of B and D". Also we can state that $P(C)$ is normally distributed like this: (see here):

$P(C) \sim \mathcal{N}(0,5^2+6^2)$

Then by marginalization we also have the conditional probability of C conditioned on B.

$$\begin{eqnarray} P(C|B) &=& \int P(C|B,D)\cdot P(D) = \int \delta(C-(B+D)) P(D) dD \\ &=& \int \delta(D-(B-C))\cdot \frac{1}{\sqrt{2\pi\cdot 5^2}} \exp\left(\frac{-D^2}{(2\cdot 5^2)}\right) dD \\ &=&P(D=C-B)\\ &=&\frac{1}{\sqrt{2\pi\cdot 5^2}} \exp\left(\frac{-(C-B)^2}{(2\cdot 5^2)}\right) \end{eqnarray}$$ which is normally distruted as per problem formulation.

Then using Bayes theorem you obtain $P(B|C)$ from the above:

$P(B|C) = \frac{P(C|B)\cdot P(B)}{P(C)}$

In the problem P(B) is given as a normal distribution $P(B)= \frac{1}{\sqrt{2\pi\cdot 6^2}} \exp\left(\frac{-B^2}{(2\cdot 6^2)}\right)$.

for the case $P(B|C=6)$ the C terms evaluate to a constant, meaning you can just plug in $C=6$. Also $P(C)$ is a constant given by the normal distribution $\mathcal{N}(0,5^2+6^2)$ as mentioned above, but that does not matter since you are only interested in the most likely value of $B$. That leaves you with an expression of $B$. Here you correctly said to evaluate the maximum. So let us have a look.

Leaving out the constants of proportionality we are left with an expression of $B$ like this:

$P(B|C=6) \propto \exp\left(\frac{-(6-B)^2}{(2\cdot 5^2)}\right) \cdot \exp\left(\frac{-B^2}{(2\cdot 6^2)}\right)$

Plotting it out with Matlab / OCTAVE using this code:

B = linspace(-20,20,1024);
Prob = exp( -(6-B).^2 / (2*5^2) ).* exp( -(B).^2 / (2*6^2) );
[maxval, maxPos] = max(Prob);
Bmax = B(maxPos)
xlabel("Value of B");

gives me this graph:

enter image description here

showing a maximum at $B\approx 3.54$.

Again: not sure if everything is 100% correct, but I hope it helps.

| cite | improve this answer | |
  • $\begingroup$ I just want to say thank you for your input and with your help I've realized what the problem was asking. I think what the question is asking is deriving the Maximum a posteriori of the a univariate normal (the summed normal C). I'm not 100% sure either on my answer. Thank you for your help and taking the extra step with the code. $\endgroup$ – James S. Nov 5 '18 at 5:17
  • $\begingroup$ @JamesS. Maybe yes. But the way the question is phrased it asks for the most likely starting position given the end position. This is what I tried to calculate from the $P(B|C)$ $\endgroup$ – geo Nov 5 '18 at 6:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.