All right, now we're ready to see a real life example.

We've called is a thief an alarm.

Imagine that you buy an alarm to a house to prevent thief from going into it.

Either the thief goes into a house,

and the alarm will go off and they will get,

for example, SMS notification.

However, the alarm may give a false alarm in case of an earthquake.

Also, if there is a strong earthquake,

the radio will report about it and so you get another source of them notification.

Here's a graphical model for it.

What is the general probability of the four and the variables, thief, alarm,

earthquake, and the radio is given by the following formula.

To fully define our model,

we need to define these four probabilities.

Let's start with thief and earthquake.

What is the probability that there is a thief in our house?

Let's define it us to 10 to the power of minus three,

that is, one in a thousand houses has been robbed.

What is the probability of an earthquake?

Well, Iet's say it is 10 to the power of mines two.

The earthquakes happened about once in 100 days.

Now, we've defined the probability of alarm,

given the thief as an earthquake so those will be four numbers.

If there is a thief in our house,

the alarm will go for sure.

This is indicated by the ones in the lower row.

If there is no thief and there is no earthquake,

then the alarm has no reason to send us signals.

However, if there is no thief,

but there is an earthquake,

the alarm will notify us for abuse at one time.

Finally, we need to define the probability of the radio report during an earthquake.

If there is no earthquake,

the radio reports it has nothing to tell us about,

and so it will not report about it.

However, if there is an earthquake,

the radio will reports that were permuted one half that is,

it does not report about some small earthquakes.

Here's our model again.

I change an additional bit,

so it would be a bit shorter.

For example, instead of writing T=1,

I would draw it simply T,

and if I want to write down the event that didn't happen for example T=0,

then there is no thief in our house,

I would simply write a bar over the letter.

All right. Imagine that you went somewhere out of your house, for example,

for a work, and you got a notification from an alarm system.

You want to estimate the probability that there is a thief in our house,

given that there is an alarm,

given that we've gotten notification from an alarm.

This would be, the probability of a thief during the alarm.

Let's use base formula to compute this probability.

This would be the gen probability.

Probability that there is a thief and alarm over the probability of the alarm.

Now, let's use the sum rule.

I will add another variable the earthquake.

This would be a thing like this.

This would be the probability of thief, alarm,

earthquake plus the probability of thief,

alarm and not earthquake.

Then, you do the same trick for the numerator.

This wouldn't be the probability of thief, alarm,

earthquake, plus probability of thief, alarm,

and not earthquake, plus another two terms,

with no thief in our house.

So, alarm, earthquake, and finally,

probability there was no thief,

alarm notification and no earthquake.

Let's compute these terms.

Let's start with the first one.

What is the general probability of these three events.

We can write them down using the model.

The gen probability actually goes from this model,

to probability of alarm given thief and an earthquake.

That was a probability of thief,

and probability of an earthquake.

All right, where do we get these numbers?

So the probability of the thief is here,

it is this number,

the probability of an earthquake is this number, and finally,

the probability of alarm given that there is a thief and an earthquake,

we can get it from here so it would be this.

Finally, we get 10 to the power of minus three,

times 10 to the power of minus two, times one.

This would be equal to 10 to the power of minus five.

Let's compute

some other probabilities.

For example, let's compute this probability.

What is the probability that there is no thief,

there is no earthquake and there an alarm?

Again, we can write it in a similar way.

It will be a probability of alarm, given no thief,

no earthquake, as a probability of no thief,

and probability of no earthquake.

What is the value of the first term?

This is the probability of alarm,

given that there is no thief and no earthquake so it is 0.

Finally, this probability would be 0.

We can cross it out.

We can compute all of those terms in a similar way.

If we do the math right,

we'll get the value of around 50%.

This would be somewhere around 50%.

So the probability that there is a thief in our house,

we would get alarm notification is around 50%.

Would you trust all your belongings if you're going?

Well, certainly not.

You get into a car,

and head to your house.

On the way home,

you get another notification,

from the radio report.

If you heard a radio report that there was an earthquake in that area near your house.

Now, you want to estimate another probability.

The probability that there is a thief in your house,

given that you heard an alarm and also radio report.

We can do this in a similar way.

This would be the ratio between the joint probability.

So this is thief, alarm, and the radio report,

over the probability of alarm and the radio reports.

Let's add the missing variable to the numerator.

This is an earthquake,

and missing variables to the denominator,

those are the thief, and an earthquake.

You have again, something like this.

Probability of thief, alarm, radio report,

and an earthquake, plus the probability of thief,

alarm, radio reports, and no earthquake.

This is some rule again.

The same thing will be in the denominator so probability of alarm,

radio report, thief and earthquake,

plus probability of alarm, radio report, thief,

not earthquake, and finally,

not finally but, we need more turns.

So alarm, radio report,

not a thief and alarm,

and now finally, the probability of alarm,

radio reports, and no thief and no earthquake.

All right.

Let's compute this in a simple way.

So this term, from our model,

we calls it falling form.

This is probability of an alarm given,

thief and an earthquake,

times probability of the radio report of the earthquake,

times and probability of the thief and probability of an earthquake.

You can find this value interesting.

Also, let's compute, for example,

the probability that there was no earthquake,

there was a thief in our house, and there was a radio report.

In this case, the one of the turns that

the probability of the radio report given that there is no earthquake is 0,

so this term would be 0.

And also this term goes to 0 so, finally,

we get the very overall 1%.

You come home and you get to the probability of 1%.

You think that is a fairly small probability and so you come back to work.

But in the evening, when you come back home you see that your house was

robbed and you ask yourself why this happened.

It seems like you computed the probabilities correctly.

However, it turns out that we define our model

in the wrong way so it is actually there are more thieves when there are earthquakes.

Our model should look like this.