0

Using the following PDF with values of:
enter image description here

The following graph can be formed:
PDF on a histogram graph

The minimum and maximum values are:
minimum = $243.483K$ maximum = $308.05K$

How can I calculate the probability of the temperature lying in-between the values $281K$ and $291K$?

balddraz
  • 7,558
  • What did you try? Hint: Probabilities for continuous PDFs are calculated with integrals. – Matti P. Jul 25 '19 at 10:17
  • I am not exactly sure how to tackle this problem. I was considering trying P(281 ≤ X ≤ 291), which I believe would be P(X ≤ 291) - P(X ≤ 281). I am not very familiar with continuous distributions. – Libor Zachoval Jul 25 '19 at 10:21
  • Yes you are correct. So $$ P(243.483 <X < 308.05) = \int_{243.483}^{308.05} P_X(x) , dx $$ Additionally, $P_X(x)$ is a sum of two terms like you have written: $P_x(x) = f_1(x) + f_2(x)$. Now $$ \int_{243.483}^{308.05} P_X(x) , dx = \int_{243.483}^{308.05}(f_1(x) + f_2(x)) , dx = \int_{243.483}^{308.05}f_1(x) , dx + \int_{243.483}^{308.05}f_2(x) , dx $$ This is the first thing to understand in the calculation. Have you studied normal distributions and normal variables? – Matti P. Jul 25 '19 at 10:41
  • In this case, f1(x) and f2(x) are 243.484 and 308.05? so I also calculate this probability and then subtract P(281 ≤ X ≤ 291) from it? – Libor Zachoval Jul 25 '19 at 10:53
  • Yes, I have. I plotted the above graph using a normal distribution approximation using the formula above. – Libor Zachoval Jul 25 '19 at 10:55
  • So do you know how to integrate the normal distributions? You're familiar with the cumulative density function for the normal distribution ($\Phi$)? – Matti P. Jul 25 '19 at 10:56
  • Yes, I also have some working examples of these. The only thing I am unsure of is the steps to calculate the probability between two values inside of a PDF. Whether I need to subtract the area in which I am interested from the minimum and maximum values or whether I can just calculate the probability for the 2 values alone. – Libor Zachoval Jul 25 '19 at 11:01
  • If I sub the values for the normal distribution, for 281 I get = 0.02732773910050905, and for 291 = 0.033589329316005195. Adding them yields = 0.060917068416514245. if I do it for 243.483 = 1.1290583428247036e-07, and for 308.05 = 0.0014306870380681434. Adding them yields = 0.0014307999439024258 – Libor Zachoval Jul 25 '19 at 11:08

1 Answers1

1

The given PDF is a composition of two normal distribution functions (Gaussians). For any continuous PDF $f_X(x)$, it is true that the probability that $X\leq x$ is $$ P(X \leq x) = \int_{-\infty}^x f_X(t)\, dt $$ or the CDF. In particular, a normal distribution has the form $$ f_{X|\mu, \sigma}(x) = \frac{1}{\sqrt{2\pi \sigma^2}} e^{-\frac{(x-\mu)^2}{2\sigma^2}} $$ with parameters $\mu$ and $\sigma^2$. In this case, it can be shown that the CDF of this type of function is $$ \tag{1} \int_{-\infty}^x \frac{1}{\sqrt{2\pi \sigma^2}} e^{-\frac{(t-\mu)^2}{2\sigma^2}} \, dt = \Phi \left(\frac{x-\mu}{\sigma} \right) $$ where $\Phi$ is the CFD of the standard normal. $\Phi$ is a special function that can be accessed with a math library or a graphing calculator.

Now we can focus on the problem at hand. We are given a PDF that is the sum of two Gaussians like so $$ P_X(x) = \frac{1}{2} f_{X|\mu_1, \sigma_1}(x) + \frac{1}{2} f_{X|\mu_2, \sigma_2}(x) $$ and we want to calculate the probability that $X$ is between $x_{\text{min}}$ and $x_{\text{max}}$. Clearly, this is equal to $$ \begin{split} P(x_{\text{min}} \leq X \leq x_{\text{max}}) &= \int_{x_{\text{min}}}^{x_{\text{max}}} \left(\frac{1}{2} f_{X|\mu_1, \sigma_1}(x) + \frac{1}{2} f_{X|\mu_2, \sigma_2}(x) \right)\, dx\\ &= \frac{1}{2}\int_{x_{\text{min}}}^{x_{\text{max}}} f_{X|\mu_1, \sigma_1}(x) \, dx + \frac{1}{2}\int_{x_{\text{min}}}^{x_{\text{max}}} f_{X|\mu_2, \sigma_2}(x) \, dx \end{split} \\ = \frac{1}{2} \left[\int_{-\infty}^{x_{\text{max}}} f_{X|\mu_1, \sigma_1}(x) \, dx - \int_{-\infty}^{x_{\text{min}}} f_{X|\mu_1, \sigma_1}(x) \, dx \right] \\ + \frac{1}{2} \left[\int_{-\infty}^{x_{\text{max}}} f_{X|\mu_2, \sigma_2}(x) \, dx - \int_{-\infty}^{x_{\text{min}}} f_{X|\mu_2, \sigma_2}(x) \, dx \right] $$ Now you need only to substitute the result in Equation (1) to this and calculate the values with the $\Phi$-function: $$ P(x_{\text{min}} \leq X \leq x_{\text{max}}) =\\ \frac{1}{2}\left[ \Phi\left( \frac{x_{\max} - \mu_1}{\sigma_1}\right) - \Phi\left( \frac{x_{\min} - \mu_1}{\sigma_1}\right) \right] \\ + \frac{1}{2}\left[ \Phi\left( \frac{x_{\max} - \mu_2}{\sigma_2}\right) - \Phi\left( \frac{x_{\min} - \mu_2}{\sigma_2}\right) \right] $$

Matti P.
  • 6,012
  • I just want to clarify, xmin = 243.483 or 281 the value of interest, then xmax = 308.05 or 291 the value of interest? – Libor Zachoval Jul 25 '19 at 11:22
  • You wanted to calculate the probability that $281 < X < 291$ so those are the min and max values. Is it clear now? (I realised that my comment earlier had the wrong limits) – Matti P. Jul 25 '19 at 11:31
  • yes, thank you, it is much more clear now. I am just wondering Equation(1) is the PDF, but I do not really understand where does the result go in the CDF equation? – Libor Zachoval Jul 25 '19 at 12:07
  • Huh? Equation (1) defines the CDF. What CDF equation do you mean? – Matti P. Jul 25 '19 at 12:10
  • I got it. Thank you very much. The answer was 0.2785306219161424 – Libor Zachoval Jul 25 '19 at 12:14
  • I did this to derive it: ((norm.cdf((291 - mu1) / std1)* 0.5) - (norm.cdf((281 - mu1) / std1)* 0.5)) + ((norm.cdf((291 - mu2) / std2)* 0.5) - (norm.cdf((281 - mu2) / std2)* 0.5)) – Libor Zachoval Jul 25 '19 at 12:14