Example: Noisy measurement

How to use

In this example we investigate a noisy measurement experiment. Initially we have two independent RVs: $\Theta$ and $N$. $\Theta$ will the variable we want to measure, thus its the object of the measurement. For this example, we consider that we don't have any a-priory knowledge of its value but its range ($-2\pi$ to $-2\pi$). Hence, its going to be considered uniform on that range. $N$ will represent the noise in the measurement and will be normally distributed with zero mean and variance $\sigma^2$. The measurement will be represented by $R = \Theta + N$. The goal is to find $f_{\Theta|R}(\theta, r)$. In another words, we are interested in know what is the probability (or density) we have for the real value $\Theta$ when we perform a measurement $R$.

To compute that conditional density, we need to go through some intermediate densities (marginals, joints and conditionals). The given densities are the ones for $\Theta$ and $N$. They are given by

$f_{\Theta}(\theta) = \begin{cases} \frac{1}{4\pi} & |\theta| < 2\pi \\ 0 & \text{otherwise} \end{cases} $
$f_{N}(n) = \frac{1}{\sqrt{2\pi}\sigma} e^{-\frac{n^2}{2\sigma^2}} $

From those, we can also quickly get the joint density for $\Theta$ and $N$ because, since they are independent, it is just the product of the respective marginals.

$f_{\Theta N}(\theta, n) = \begin{cases} \frac{1}{4\pi}\,\frac{1}{\sqrt{2\pi}\sigma} e^{-\frac{n^2}{2\sigma^2}} & |\theta| < 2\pi \\ 0 & \text{otherwise} \end{cases}$

You can use the applet bellow to explore those densities. Use the sliders to change the value of $\theta$ and/or $n$ to see the behavior of the conditionals. Since $\Theta$ and $n$ are independent, you can see that no matter how you change them, the densities conditionals remains the same. Hence, we have that $f_{\Theta|N}(\theta|n) = f_{\Theta}(\theta)$ and $f_{N|\Theta}(n|\theta) = f_{N}(n)$
$f_{\Theta N}(\theta,n)$
$\theta$
$n$
$f_{\Theta|N}(\theta|n)$
$f_{N|\Theta}(n|\theta)$

Now that we have $f_{\Theta N}(\theta,n)$ we need to compute $f_{\Theta R}(\theta,r)$ so that, we can compute the conditionals on $\Theta$ and $R$. In order to do that, we need to use functions of RVs to obtain a relationship between ($\Theta$, $n$) and ($\Theta$, $R$). Let use the following relationships

$ \begin{array}{l} A = g(\Theta,N) = \Theta\\ R = h(\Theta,N) = \Theta + N \end{array} $

With $g(.,.)$ and $h(.,.)$ we can compute $f_{A R}(\alpha,r)$ as

$f_{A R}(\alpha,r) = \frac{1}{|J|_{\theta_1,n_1}}f_{\Theta N}(\theta_1, n_1)$

where $\theta_1 = \alpha$ and $n_1 = r - \alpha$ are solutions for $\alpha = g(\theta,n)$ and $r = h(\theta,n)$ respectively and $|J|$ is the determinant of the Jacobian of the transformation $g$ and $h$. Since we have a simple additive relationship, the derivatives with respect to $\Theta$ and $n$ will be 1, 0 for $g$ and 1, 1 for $h$, leading the determinant to be simple 1.

Now we can write the joint distribution as (substituting back $A$ by $\Theta$)

$f_{\Theta R}(\theta, r) = \begin{cases} \frac{1}{4\pi}\,\frac{1}{\sqrt{2\pi}\sigma} e^{-\frac{(r-\theta)^2}{2\sigma^2}} & |\theta| < 2\pi \\ 0 & \text{otherwise} \end{cases}$

Now we have enough information to compute the conditionals on $\Theta$ and $R$ as

$f_{R|\Theta}(r|\theta) = \frac{ f_{\Theta R}(\theta, r) } { f_{\Theta}(\theta) } = \frac{1}{\sqrt{2\pi}\sigma} e^{-\frac{(r-\theta)^2}{2\sigma^2}}$
$f_{\Theta|R}(\theta|r) = \frac{ f_{\Theta R}(\theta, r) } { f_{R}(r) } = \frac{ f_{\Theta R}(\theta, r) } { \int_{-2\pi}^{2\pi}f_{R|\Theta}(r|\theta)\,f_{\Theta}(\theta) \text{d}\theta } = \begin{cases} \frac{ e^{-\frac{(r-\theta)^2}{2\sigma^2}} } { \int_{-2\pi}^{2\pi} e^{-\frac{(r-\theta)^2}{2\sigma^2}} \text{d}\theta } & |\theta| < 2\pi \\ 0 & \text{otherwise} \end{cases} $

The following applet illustrates the joint and conditional distributions for this new situation. Now when you move the sliders to change the a-piori values for $\Theta$ and\or $R$, you can see the conditionals changing accordingly. Notice that the conditional $f_{R|\Theta}(r|\theta)$ is just a Gaussian with variable mean. That simplicity reflects the fact that if we know the real value of $\Theta$, the density for the measurement is just a Gaussian around it due to the noise. However, the density $f_{\Theta|R}(\theta,r)$ is far more interesting. It reflects the probability of having a true value of $\Theta$ after measuring $R$. This is a highly practical situation. One measures some variable that is corrupted by noise and is really interested in knowing what the true value is. If you measure something around zero (move the horizontal slider to the middle point). You see that the density for $\Theta$ is practically a Gaussian, since the noise is within the range of possible values for $\Theta$. However, if you move the slider further and further from $-2\pi$ or $2\pi$ we see the density for $\Theta$ becomes narrower and narrower in the respective extreme, indicating that, since we cant have values outside the range, but we measured some out of it, there is a high chance that the actual value is an extreme.

$f_{\Theta R}(\theta,r)$
$\theta$
$r$
$f_{\Theta|R}(\theta|r)$
$f_{R|\Theta}(r|\theta)$