(Login) Skip Navigation Links
NetworkExpand Network
 
 
View All Networks View Networks
Help Help Help Documentation
 

Meat Test Network Tutorial

This tutorial will introduce you to Bayesian Networks and how they work. The example used here is the called the Meat Test Network (Figure 1).

Figure 1: Meat Test Network


Notice that the Meat Test Network is made up of a number of components, which are common to all Bayesian networks (BNs). These are:
  • Nodes - The factors or variables within a BN are represented by boxes called Nodes. In the Meat Test Network there are two nodes called Meat and Test. Within a BN there are three types of nodes possible. These are Nature nodes, Decision nodes and Utility nodes. The Meat Test Network contains only Nature nodes, which is the standard node type used in BNs. To learn about Decision and Utility nodes, see the Decision Networks tutorials.
  • States - Each node in a BN can contain two or more alternatives called States. In the Meat Test Network, the node Meat has two states, Infected and Clean, while the node Test has two states, Positive and Negative.
  • Links - The nodes in a BN are related via arrows called Links. In the Meat Test Network, there is only one link, from Meat to Test. This link represents the logic that the state of Meat (whether it is Infected or Clean) influences the state of the Test (whether the test result is Positive or Negative).
  • Probabilities - Notice that there is a number beside the state of each node in the Meat Test Network. This number is the percent probability (%) of each state occurring. You will see how these probabilities come about as we look further at the Meat Test Network.

Now look at how the Meat Test Network can be used to answer a problem:

The problem: Meat purchased in a supermarket may be infected with bacteria. On average, infection occurs once in every 600 packages of meat. A test, with a positive or negative result, can be used to test for infection. For clean meat, the test result is negative in 499 out of 500 cases, and for infected meat, the test result is positive in 499 out of 500 cases. What is the probability of a package of meat being infected if a test result comes back positive?

This problem tells us something about the probabilities we need to put into the Meat Test Network in order to find the answer to the problem. First we know that, on average, infection occurs once in every 600 packages of meat. This means that there is a 1 in 600 chance (or 0.0017 probability) of coming across an infected package of meat. It also means that there is a 599 in 600 chance (or 0.9983 probability) of coming across a clean package of meat. These chances or probabilities can be inserted into the Meat node of the Meat Test Network.

Behind each node in a BN, there is a Probability Table. If we open the probability table for the Meat node, it looks like Figure 2. In this table you can see that the probabilities of meat being infected (0.0017) and clean (0.9983) have been inserted.

Figure 2: Probability Table For Meat Node


To open the probability table for the Meat node, select the drop down arrow in the right hand corner of the node then select the Probabilities option.

The problem also tells us that for clean meat, the test result will be negative in 499 out of 500 cases, and for infected meat, the test result will be positive in 499 out of 500 cases. In other words, if the state of Meat is Clean, then there is a 499 out of 500 chance (or 0.998 probability) that the Test result will be Negative; and if the state of Meat is Infected, then there is a 499 out of 500 chance (or 0.998 probability) that the Test result will be Positive. These probabilities can be inserted into the probability table for the Test node (see Figure 3).

Figure 3: Probability Table For Test Node


Note that the probability table for the Test node has a different format from that of the Meat node. This is because the Test node has a variable that influences its outcome. That variable is Meat. In other words, the probability of the Test result being Positive or Negative is conditional upon the state of Meat being Clean or Infected. Also note that the probabilities for each row for both the Meat and Test nodes add to 1 or 100%. So even though the problem does not tell us the probability of the Test result being Negative if the Meat is Infected, we know that it is 1 - 0.998, which is 0.002.

Now that we have completed the probability tables for both nodes in the Meat Test Network, we can use it to answer the question 'What is the probability of a package of meat being infected if a test result comes back positive?'

Answer to the problem: To answer the problem, we need to insert a scenario in the Meat Test Network. This is also called inserting evidence. The evidence we have in the meat test problem is that the test result has come back positive. We can insert this evidence by selecting the positive state for Test and then clicking Update/Refresh Network (see Figure 4). When the evidence is inserted, the probabilities for the states of the Meat node update to given us the answer to the problem: If the test result comes back positive, then there is a 45.9% chance that the meat will be infected.

Figure 4: Meat Test Network With Evidence Inserted


Bayes Theorem: BNs use Bayes Theorem of conditional probability to update the probabilities within a network when evidence is inserted. Lets look at how the Meat Test Network used Bayes Theorem to answer the meat test problem.

Bayes Theorem states the following:

P (B|A) = [P (A|B) × P (B)] / P (A)

which in plain English means that the probability of B occurring when A occurs, P (B|A), is equal to the probability of A occurring when B occurs, P (A|B), multiplied by the probability of B occurring, P (B), and then divided by the probability of A occurring, P (A).

Now in the meat test problem, we want to know the the probability of a package of meat being infected if a test result is positive. In other words we want to know P(Infected Meat|Positive Test). So to solve the meat test problem using Bayes Theorem, we simply need to substitute Infected Meat for B and Positive Test for A:

P (Infected Meat|Positive Test) = [P (Positive Test|Infected Meat) × P (Infected Meat)] / P (Positive Test)

Now we know that for infected meat, the test result will be positive in 499 out of 500 cases. Therefore, 
P (Positive Test|Infected Meat) = 0.998. We also know that infection occurs once in every 600 packages of meat. Therefore, P (Infected Meat) = 0.0017. Putting these probabilities into Bayes Theorem gives:

P (Infected Meat|Positive Test) = [0.998 × 0.0017] / P (Positive Test)

The meat test problem does not tell us the probability of getting a positive test result, P (Positive Test), however it is not too difficult to work this out. The probability of getting a positive test result is simply the probability of getting a positive test result for infected meat, multiplied by the probability of meat being infected; plus the probability of getting a positive test result for clean meat, multiplied by the probability of meat being clean. In other words:

P (Positive Test) = [P(Positive Test|Infected Meat) × P(Infected Meat)] + [P(Positive Test|Clean Meat) × P(Clean Meat)]

We know that P (Positive Test|Infected Meat) = 0.998 and that P (Infected Meat) = 0.0017. We also know that P (Positive Test|Clean Meat) is 0.002. If the probability of meat being infected is 1 in 600, then the probability of meat being clean is 599 in 600, which is 0.9983. Therefore the probability of getting a positive test result is:

P (Positive Test) = [0.998 × 0.0017] + [0.002 × 0.9983] = 0.0037

Now that we know P (Positive Test), we can add this to Bayes Theorem and solve the meat test problem:

P (Infected Meat|Positive Test) = [0.998 × 0.0017] / 0.0037 = 0.458 or 45.8%

Note that the answer we get using Bayes Theorem is almost exactly the same as the answer we get using the Meat Test Network (shown in Figure 4 above).

 
DBL Interactive ® v2.0 Copyright 2007 - 2010: School of Integrative Systems, University of Queensland, St Lucia, Australia.