Bayes’ rule revisited

bayes-theorembayesianconditional probabilityprobabilityprobability theory

I am currently attending a machine learning course and we are reviewing some probability theory which is of course fundamental for machine learning.

Suppose you are working at a library. Some students have stolen books from the library $\mathbf{P}(E=thief)= 1/3$ therefore we have also $\mathbf{P}(\overline{E}= no \ thief) = 2/3$

To detect those stealing students you are using a lie detector. The probability that a student passes the test if he is guilty is 1/6.

The student passes the detector also if he isn't guilty with 5/6

Now I want to use Bayes rule to determine the probability that a student is guilty given that he fails the detector.

All the probabilities we have

$\mathbf{P}(E=thief)= 1/3$
$\mathbf{P}(\overline{E}= no \ thief) = 2/3$

$\mathbf{P}(+|E) = 1/6 $ $\mathbf{P}(-|E) = 5/6$

$\mathbf{P}(+|\overline{E}) = 5/6$
$\mathbf{P}(-|\overline{E}) = 1/6$

where + means passing the test and – failing the test.

The prob. which want to know is

$$\mathbf{P}(E|-)=\frac{\mathbf{P}(-|E)\mathbf{P}(E)}{\mathbf{P}(-|E)\mathbf{P}(E)+\mathbf{P}(-|\overline{E})\mathbf{P}(\overline{E})}$$

plugging in the values gives us

$$\mathbf{P}(E|-)=\frac{\frac{5}{6}\cdot \frac{1}{3}}{\frac{5}{6} \cdot \frac{1}{3}+\frac{1}{6} \cdot \frac{1}{6}}=0.714$$

Did I follow Bayes' rule correctly because I am not sure if the statement "The probability that a student passes the test if he is guilty is 1/6." has to be $\mathbf{P}(+ \cap E)= \frac{1}{6}$ or $\mathbf{P}(+|E)= \frac{1}{6}$

Best Answer

Your calculation and your result is correct. Usually I use a table to maintain an overview.

$$\begin{array}{c|c|c|c} & E&\overline E \\ \hline - & \frac{5}{18} &\frac{2}{18} &\frac{7}{18}\\ \hline +&\frac{1}{18} &\frac{10}{18} & \frac{11}{18}\\ \hline &\frac{6}{18} &\frac{12 }{18}&1 \\ \end{array}$$

The required probability can be read off the table:

$$P(E|-)=\large{\frac{\frac{5}{18}}{\frac{7}{18}}}\normalsize =\frac57\approx 0.714$$


$\mathbf{P}(+|E)= \frac{1}{6}$ is the right one.

I´ve noticed that you have a typo (red marked): $$\frac{\frac{5}{6}\cdot \frac{1}{3}}{\frac{5}{6} \cdot \frac{1}{3}+\frac{1}{6} \cdot \color{red}{\frac{2}{3}}}$$

Related Question