prod book stat sample conditional prob

26
CONDITIONAL PROBABILITY Chapter 6 from INTRODUCTION TO STATISTICS IN A BIOLOGICAL CONTEXT Edith Seier and Karl H. Joplin Preliminary edition January 14, 2010. HHMI gran t 52005962

Upload: terrygoh6972

Post on 14-Apr-2018

232 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Prod Book Stat Sample Conditional Prob

7/27/2019 Prod Book Stat Sample Conditional Prob

http://slidepdf.com/reader/full/prod-book-stat-sample-conditional-prob 1/26

CONDITIONAL PROBABILITYChapter 6 from

INTRODUCTION TO STATISTICS IN A

BIOLOGICAL CONTEXT

Edith Seier and Karl H. Joplin

Preliminary editionJanuary 14, 2010. HHMI grant 52005962

Page 2: Prod Book Stat Sample Conditional Prob

7/27/2019 Prod Book Stat Sample Conditional Prob

http://slidepdf.com/reader/full/prod-book-stat-sample-conditional-prob 2/26

ii

Page 3: Prod Book Stat Sample Conditional Prob

7/27/2019 Prod Book Stat Sample Conditional Prob

http://slidepdf.com/reader/full/prod-book-stat-sample-conditional-prob 3/26

Introduction to statistics in a biological context

Contents

6 Conditional probability 16.1 What is conditional probability? . . . . . . . . . . . . . . . . 1

6.2 Decisions and consequences . . . . . . . . . . . . . . . . . . . 36.3 Conditional probabilities from two-way tables . . . . . . . . . 5

6.3.1 False positives and false negatives . . . . . . . . . . . 66.3.2 Sensitivity and specificity of tests . . . . . . . . . . . 7

6.4 Reverse conditional probabilities . . . . . . . . . . . . . . . . 86.4.1 Probability trees . . . . . . . . . . . . . . . . . . . . . 96.4.2 Preparing a two-way table * . . . . . . . . . . . . . . . 126.4.3 Bayes rule * . . . . . . . . . . . . . . . . . . . . . . . . 16

6.5 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20

Page 4: Prod Book Stat Sample Conditional Prob

7/27/2019 Prod Book Stat Sample Conditional Prob

http://slidepdf.com/reader/full/prod-book-stat-sample-conditional-prob 4/26

iv CONTENTS 

Page 5: Prod Book Stat Sample Conditional Prob

7/27/2019 Prod Book Stat Sample Conditional Prob

http://slidepdf.com/reader/full/prod-book-stat-sample-conditional-prob 5/26

Introduction to statistics in a biological context

Chapter 6

Conditional probability

In this chapter 

Conditional probability of an event is the probability of the event under the 

knowledge or condition that another certain event has occurred. The chap-

ter focuses on the calculation of conditional probabilities in the diagnosis 

context. Probabilities of false positive and false negative test results will 

be calculated, and the concepts of specificity and sensitivity of a test will 

be discussed. Three alternative ways of calculating the reverse conditional 

probabilities produced by the application of the Bayes rule will be presented:

sketching a probability tree, creating a two-way table with hypothetical fre-

quencies or using the original formula. Any one of those three modalities 

can be used because the results are the same. The easiest to apply is the 

probability tree.

6.1 What is conditional probability?

Assume that a nurse working at a health care center knows that approxi-mately 30% of adults have cholesterol level above the recommended thresh-old of 200 mg/dL. An adult man walks in (consider him a randomly selectedman from the entire population), and the nurse immediately thinks ‘theprobability that he has high cholesterol level is 0.3’. The nurse measures the

blood pressure of the patient and finds it elevated. She knows that there issome kind of association between high cholesterol and high blood pressure,thus after having the information that the man has high blood pressure shere-evaluates the situation and wonders if the probability that he has highcholesterol level is not 0.3 but higher. This type of situation happens in

Page 6: Prod Book Stat Sample Conditional Prob

7/27/2019 Prod Book Stat Sample Conditional Prob

http://slidepdf.com/reader/full/prod-book-stat-sample-conditional-prob 6/26

2 CHAPTER 6. CONDITIONAL PROBABILITY 

many fields of application. Under the absence of additional information, the

probability of a certain event A is a given number. However, the occurrenceof another event B , might change the probability. This is what conditionalprobability is about.Idea of 

conditionalprobabilitythroughan example

In Section 4.5 the notion of independence was introduced. Figure 4.4depicts two urns. In one urn color and size of the balls are independent,in the other urn they are not. In the urn in Figure 6.1, color and size areobviously not independent. There are more red balls among the large ballsthan among the small balls. When randomly selecting a ball from that urn,the probability of obtaining a red ball is P (red) = 5/10 = 1/2 because thereare 5 red balls in a total of 10 balls. Now assume that a ball is picked by ablindfolded person. The ball can be felt to be large, but the color is unknown.What is the probability that the ball is red? In this case P (red/large) =3/5 because all the small balls are ruled out and only the large balls areconsidered. There are 5 large balls, 3 of which happen to be red. Thus, theinformation about the size of the ball has changed the probability of the ballbeing red. This is the most simple way of calculating conditionalprobabilities, restricting the universe according to the informationgiven and calculating the probabilities in that restricted universe.

There is also a formal way of expressing these ideas. Conditional probability

Figure 6.1: Urn with 5 large (3 red and 2 yellow) balls and 5 small balls (2red and 3 yellow)

is formally defined asDefinition of conditionalprobability

P (B/A) =P (A ∩ B)

P (A)(6.1)

Consider the urn for which P (red/large) was calculated intuitively. Now itcan be calculated using the expression (6.1)

P (red/large) = P (red∩large)P (large) = 3/10

1/2 = 35

Page 7: Prod Book Stat Sample Conditional Prob

7/27/2019 Prod Book Stat Sample Conditional Prob

http://slidepdf.com/reader/full/prod-book-stat-sample-conditional-prob 7/26

6.2. DECISIONS AND CONSEQUENCES  3

P (red ∩ large) = 3/10 because in the urn there are 3 balls that are red

AND large.P (large) = 1/2 because in the urn there are 5 large balls out of 10 balls.

In the urn example, the probability of red  changed when it was knownthat the ball was large, P (red/large) = P (red). This is an indication thatcolor and size are NOT independent. If P (A∩B) = P (A)×P (B), the events Independent eventsA and B are said to be independent. In general, P (A∩B) = P (A)×P (B|A)meaning that the probability that two events A and B occur is equal to theprobability that one of them occurs multiplied by the probability that thesecond occurs, given that the other already has occurred. For example, theprobability of being exposed to pollen and getting an allergic reaction to itcould be understood as the probability of being exposed to pollen times theprobability of getting an allergic reaction given that there has been exposureto pollen.

6.2 Decisions and consequences

The following is an example of how conditional probabilities are not onlyeasy to calculate but quite useful for evaluating decision or diagnosis rules.In Section 2.8, Figure 2.22, the level of expression of one particular genefrom the Khan data set (Desper, Khan & Schaffer, 2004) in four varietiesor sub-types of a tumor was presented. The Khan data set contains theintensity of 2308 genes for 83 patients with one of four varieties of small,

round blue cell tumors. From Figure 2.22 it is clear that the gene tendsto be expressed with more intensity in tumors of varieties 1,3, and 4 thanin tumors of variety 2 (Burkitt’s lymphomas or BL). In the dotplots inFigure 6.2, types 1,3 and 4 have been grouped together. Assume that thepurpose is to identify whether the tumor is a Burkitt’s lymphoma or not,based on the intensity of this sole gene. Diagnoses based on microarraysare generally made based on the intensities of several genes. The one geneexample here is a simplified example prepared to understand some conceptsand introduce some terminology. To set the threshold at intensity = −1seems a sensible rule. When a new patient comes with a small, round bluecell tumor, a microarray is prepared with the patient’s tissue. If the intensity

of that particular gene is below −1 the tumor will be identified as a Burkitt’slymphoma. If the intensity of this particular gene is above −1, it will bethought that the tumor is not of a BL but of one of the other sub-types (1,3,or 4).

Page 8: Prod Book Stat Sample Conditional Prob

7/27/2019 Prod Book Stat Sample Conditional Prob

http://slidepdf.com/reader/full/prod-book-stat-sample-conditional-prob 8/26

4 CHAPTER 6. CONDITIONAL PROBABILITY 

−3 −2 −1 0 1 2

a. Type 2

intensity

FALSE NEGATIVESCorrectly identified as type 2

−3 −2 −1 0 1 2

b. Type 1,3, or 4

intensity

Correctly identified as otherFALSE POSITIVES

Figure 6.2: Diagnosis based on the expression level of one gene

It is common practice to define decision rules and diagnosis methodswith one data set (‘training data set’) and evaluate them with another dataset (‘test data set). However, this is just a first screening of the decisionrule with the purpose of observing the consequences for the 83 patients of 

setting the threshold at −1. In the first dotplot there are 11 patients withtype 2 and for 3 of them the intensity of the gene is above the value −1.Thus applying the decision rule with the threshold at −1, they would beclassified as not having Burkitt’s lymphoma, when actually they do. Those3 cases will be called ‘false negatives’. If one of the 83 patients was selectedThe way a

decision ruleis definedhas an impacton the probabilityof each typeof error

at random, the probability of a ’false negative’ will be the conditional prob-abilityP(diagnosed as ‘other’/the tumor is BL)=3/11.Notice also that 8 of the 11 patients with type 2 tumor are correctly classi-fied as type 2. In the second dotplot, there is a total of 72 patients and allof them are correctly classified as ‘other’, there are no ‘false positives’.

If the arrow is moved to the right of  −1 in Figure 6.2a, the number of false negatives will diminish. However, the arrow would need to be movedto the right also in Figure 6.2b, and some false positives will appear. Whenthe probability of one type of error decreases, the probability of the other

Page 9: Prod Book Stat Sample Conditional Prob

7/27/2019 Prod Book Stat Sample Conditional Prob

http://slidepdf.com/reader/full/prod-book-stat-sample-conditional-prob 9/26

6.3. CONDITIONAL PROBABILITIES FROM TWO-WAY TABLES  5

type of error increases.

6.3 Conditional probabilities from two-way tables

Table 6.1 displays information for 4304 individuals, 18 years or older, in-terviewed during an illegal drug use, tobacco, and alcohol survey that tookplace in Nebraska in 1997. The respondents have been classified accordingto their answer to the following questions:

• Have you smoked more than 100 cigarettes in your life? If the answer is‘YES’ the individual is classified as an ‘Ever smoker’ (could be formeror current smoker), if the answer is ‘NO’ the individual is classified as

‘Never an smoker’.• Have you used marijuana at least once in your life?

Table 6.1: Cigarette smoking and marijuanaHas ever used marijuana?

Has ever been an smoker YES NO Total

YES 722 1207 1929NO 397 1978 2375

Total 1119 3185 4304

Joint

frequencydistribution

Table 6.1 describes the joint frequency distribution of cigarette smokingand using marijuana. Assume that one individual is randomly selected fromthe 4304 individuals in the table. What is the probability that this person isor has been an smoker AND has used marijuana at least once in his/her life.There are 722 individuals who satisfy both conditions, out of a total of 4304,thus P(smoker AND marijuana)=722/4304) (or P (S ∩ M ) = 722/4304). Marginal frequenc

distributionsLook at the marginal frequency distributions in that table, i.e. thedistribution of only one of the variables ignoring the other variable. Thoseprobabilities are calculated based on the ‘total’ column and the ‘total’ row.For example, what is the probability that if one of 4304 individuals is ran-domly selected this person has used marijuana at least once in their life?

This question is answered looking only at the variable marijuana and thetotals of each column. There are 1119 individuals out of the 4304 who haveused marijuana at least once, thus P(marijuana)=1119/4304=0.2599907 Conditional

probabilitiesConditional probabilities can also be calculated from that two way table.For example: What is the probability that a person has used marijuana given

Page 10: Prod Book Stat Sample Conditional Prob

7/27/2019 Prod Book Stat Sample Conditional Prob

http://slidepdf.com/reader/full/prod-book-stat-sample-conditional-prob 10/26

6 CHAPTER 6. CONDITIONAL PROBABILITY 

that the person is or has been a smoker? Focus on focus the first row of the

table (where the smokers are located, while ignoring those who have neverbeen smokers, not paying attention to the never smokers as in Figure 6.3.There are only 1929 ‘ever smokers’; among them 722 have used marijuana.Thus, the answer is P(marijuana/ever smoker)=722/1929 =0.3742872.

Figure 6.3: Looking just at the ‘ever smokers’ in Table 6.1

The conditional probabilities in the other direction can also be calcu-lated. For example: P(ever smoker/ marijuana)= 722/1119=0.645219because there are only 1119 individuals who have used marijuana and 722of them are or have been smokers. A two-way table describes how two cat-egorical variables vary jointly (or the ‘joint distribution’ of the variables).From that table marginal frequencies, marginal probabilities AND condi-tional probabilities in either direction can be calculated.

6.3.1 False positives and false negativesHIV and theELISA testexample

HIV is the virus that causes AIDS, and ELISA (Enzyme Linked Immuno-Sorbent Assay) is a test for HIV. A table for hypothetical one million indi-viduals for the ELISA test was constructed by Rossman and Short (1995).

Table 6.2: HIV and the ELISA testTest Positive Test Negative Row total

Carry HIV 4885 115 5000

No HIV 73630 921370 995000Column Total 78515 921485 1000000

Conditional probabilities can be calculated based on the informationcontained in Table 6.2:

Page 11: Prod Book Stat Sample Conditional Prob

7/27/2019 Prod Book Stat Sample Conditional Prob

http://slidepdf.com/reader/full/prod-book-stat-sample-conditional-prob 11/26

6.3. CONDITIONAL PROBABILITIES FROM TWO-WAY TABLES  7

1. There are 5000 individuals who carry HIV, 115 of them test negativefor HIV. Thus P(false negative)=P(test -/carry HIV)=115/5000=0.023.

False Negative

False Positive2. There are 999500 individuals who do not carry HIV, however 73630of them test positive. Thus P(false positive)= P(test +/ No HIV)=73630/999500=0.07366683

3. There are 4885+73630=78515 individuals who tested positive but only4885 of them have HIV, thus P(HIV/test+)=4885/78515= 0.06221741.This might sound surprising but we should remember that only a smallportion of the population carries the HIV.

4. There are 921485 individuals who tested negative but 115 of themcarry HIV, thus P(HIV/test - )=115/921485=0.0001247986

5. What is the probability of testing positive if one carries HIV? 4885/5000 =0.977

6. What is the probability of testing negative if one does not carry HIV?921921370/995000 = 0.926

6.3.2 Sensitivity and specificity of testsSensitivity

of a test=1-P(false negative)

Recall question 5 at the end of the previous section: What is the prob-ability of testing positive if one carries HIV? . There are 5000 individu-als who carry HIV and 4885 of them tested positive, thus P(test +/carryHIV)=4885/5000=0.977. The conditional probability P(test+/has thevirus) reflects how good the test is in detecting the virus whenthe virus is present; in the medical world this conditional proba-bility is called sensitivity of a test. The probability of a false negativeis 115/5000, notice that the sensitivity of the test and the probability of afalse negative add up to 1. Indeed, sensitivity=1-P(false negative).

Consider question 6 of the previous section : What is the probability of 

testing negative if one does not carry HIV? . There were 995000 individuals Specificity

of a test=1-P(false positive)

who do not carry HIV and 921370 of them tested negative, thus P(negativetest/does not carry HIV)=921370/995000=0.926. The conditional proba-bility P(test-/one does not carry the virus) reflects how good the test is indistinguishing those who do not have the virus and is called the specificityof the test. Notice that among the 995000 individuals who do not carry

Page 12: Prod Book Stat Sample Conditional Prob

7/27/2019 Prod Book Stat Sample Conditional Prob

http://slidepdf.com/reader/full/prod-book-stat-sample-conditional-prob 12/26

8 CHAPTER 6. CONDITIONAL PROBABILITY 

HIV, 921485 tested negative and 78515 tested positive, 921485/995000 is the

specificity of the test and P(test + /does not carry HIV)=78515/99500 is theprobability of a false positive. Obviously 78515/995000 and 921485/995000add up to 1; indeed specificity=1-P(false positive).

Down syndrome and nasal bone exampleTrisomy 21example Down syndrome is associated with an error in meiosis that results in 3 copies

of chromosome 21(Trisomy 21). There is a definite test for Trisomy 21 in thefetus but it is an invasive procedure called amniocentesis but some parentsprefer less invasive screenings such as the triple marker blood test and anultrasound exam to study the nasal bone. Based on the information providedby Fan and Levine (2007), Table 6.3 was prepared for 160,000 hypothetical

fetuses for mothers who are already in a high risk group due to their ageand the results from the triple marker blood test.

Table 6.3: Down syndrome and nasal bone in ultrasoundNormal marker Abnormal marker Row total

Down syndrome 1000 1000 2000No Down syndrome 158000 0 158000

Column Total 159000 1000 160000

Consider the ultrasound exam as a test for Down syndrome in the fetus

and the abnormal marker as a + in that test. What is the probability of a false positive? What is the probability of a false negative? What is thesensitivity of that test? What is the specificity of that test?P(false +)=P(abnormal marker/No Down syndrome)=0P(false -)=P(normal marker/Down syndrome)=1000/2000=0.5, the ultra-sound exam only detects 50% of the Down syndrome cases.Sensitivity of the test= P(test +/Down syndrome)= P(abnormal marker/Downsyndrome)=1000/2000=0.5.Specificity of the test=P(test -/No Down syndrome)=P(normal marker/NoDown syndrome)=158000/158000=1

6.4 Reverse conditional probabilities

When two-way tables such as Tables 6.1,6.2 and 6.3 are available, there is noproblem calculating conditional probabilities in one direction or the other.

Page 13: Prod Book Stat Sample Conditional Prob

7/27/2019 Prod Book Stat Sample Conditional Prob

http://slidepdf.com/reader/full/prod-book-stat-sample-conditional-prob 13/26

6.4. REVERSE CONDITIONAL PROBABILITIES  9

However, not always the information comes in the form of a two-way table.

Sometimes, P (A/B) is known and the question is to find P (B/A). Thereare three equivalent ways of solving the problem, it is enough to use onesince all produce the same results:

• Prepare a probability tree

• Prepare a two-way table

• Use the Bayes rule formula

6.4.1 Probability trees

Probability trees are useful to organize the information of processes that in-

volve two or more random experiments or random phenomena. In particular,they offer an easy way of organizing the calculation of (reverse) conditionalprobabilities. In the examples to follow, notice that the first node of thetree refers to the possible status of the patient and the probabilities are as-signed depending on the prevalence rate of the disease or condition in thepopulation. The second node corresponds to the result of the test. The HIV example

Usually, the sensitivity of a test P (test + /HIV ) is known, but whatindividuals who test positive really want to know is P (HIV/test+). Table6.2 was constructed by Rossman & Short (1995) based on information aboutthe ELISA test (Gastwirth, 1986). Assume that Table 6.2 had not beenprepared, and the only available information was the following:

1. About 0.5% of the American population carries HIV

2. For those who carry HIV, the test results are positive (+) in 97.7% of the cases.

3. For those who do not carry HIV, the test results are negative(-) in92.6% of the cases.

The information in 1) is about the ‘prevalence rate’ of the virus, i.e. howfrequent is the HIV in the American population. The information in 2) and3) are the sensitivity and specificity of the test respectively. The proba-bility tree in Figure 6.4 was prepared based on the prevalence rate in the

population, the sensitivity and the specificity.Given that the ELISA test is positive, the probability of having the

virus is surprisingly low, P(HIV/test +)= 0.06221741. Why? because theprevalence rate in the general population is low (P(HIV)=0.005). If theindividual belongs to a high risk group (for example if the individual is a

Page 14: Prod Book Stat Sample Conditional Prob

7/27/2019 Prod Book Stat Sample Conditional Prob

http://slidepdf.com/reader/full/prod-book-stat-sample-conditional-prob 14/26

10 CHAPTER 6. CONDITIONAL PROBABILITY 

Figure 6.4: Probability tree for the HIV case

drug user) the probabilities for YES or NO HIV in the first node of the treewould be different and the final result would be different.The Down

syndromeexample

Down syndrome is associated to Trisomy 21(a triplicate at chromosome21), a result of an error in cell division. People with Trisomy 21 have 47chromosome instead of 46. For the general population the prevalence inthe USA is 9.2 per 10,000 live births. However, the risk of having a childwith Down syndrome increases with age. There is a definite test for DownSyndrome in the fetus called amniocentesis, but it is a very invasive exam

that can produce infections and miscarriages. Thus, patients usually preferto have other tests or screenings before deciding to have an amniocentesis.There is a relatively simple blood test, ‘the triple marker test’, which is rou-tinely done to pregnant women. This test has a high rate of false positives.Women of a certain age with a positive result in the triple marker test areconsidered women at high risk and their probability that the fetus has Downsyndrome is 1/80 ( Fan & Levine, 2007). There is also a non-invasive exambased on ultrasound that focuses on the presence or absence of nasal bone.This ultrasound exam has two possible results:

Abnormal marker or AM, i.e. absence of nasal bone

Normal marker or NM, i.e. presence of nasal bone

There is historical data of all the fetuses in which the ultrasound test wasapplied and, after birth verification of Down syndrome was recorded. Half of the fetuses with Down syndrome show absence of the nasal bone (abnormal

Page 15: Prod Book Stat Sample Conditional Prob

7/27/2019 Prod Book Stat Sample Conditional Prob

http://slidepdf.com/reader/full/prod-book-stat-sample-conditional-prob 15/26

6.4. REVERSE CONDITIONAL PROBABILITIES  11

marker) in the ultrasound. All babies without Down syndrome get NM

(normal marker) in the ultrasound test. The question of interest is:For a woman at high risk, what is the probability that the fetushas Down syndrome, given that the ultrasound gave a normalmarker? This is what could be called a reverse probability case. Theprobability of getting a normal marker in the ultrasound given that the babyhas Down syndrome is known, but what is the probability that the baby hasDown syndrome given that the ultrasound indicated normal marker. Inother words, P(NM/DS)=0.5 is known, but what is P(DS/NM)?

The information from the study (Fan & Levine,2007) can be summarizedas follows:

1. Among the high risk pregnancies (due to the age of the mother and

the results from a blood test) the probability of the fetus having Downsyndrome is 1/80, thus the probability of NOT having Down syndromeis 79/80

2. For fetuses with Down syndrome, half show a ‘normal marker’ in theultrasound and half show the ‘abnormal marker’

3. All fetuses without Down syndrome show the ‘normal marker’ in theultrasound and none shows the ‘abnormal marker’

With that information the probability tree in Figure 6.5 was constructed.

Figure 6.5: Probability tree in the context of reverse conditional probability

In the tree in Figure 6.5, the first node considers that a fetus can haveor no Down syndrome with probabilities 1/80 and 79/80 respectively . In

Page 16: Prod Book Stat Sample Conditional Prob

7/27/2019 Prod Book Stat Sample Conditional Prob

http://slidepdf.com/reader/full/prod-book-stat-sample-conditional-prob 16/26

12 CHAPTER 6. CONDITIONAL PROBABILITY 

each one of the branches (Down and No Down) consider consider the op-

tions with respect to the nasal bone, i.e. the fetus can have either a nor-mal or an abnormal marker. In those new branches, write the conditionalprobabilities, for example P(normal marker/Down)=0.5. Then multiply theprobabilities along each branch. The values at the end of each branch areprobabilities of two events happening, for example P(Down AND normalmarker)= 1

80 ×12 = 1

160 . Those probabilities are the joint probabilities. Inorder to get the reverse probabilities such as P(Down/Normal marker), con-sider only the branches that have ‘normal marker’ in them. There are twosuch branches, the probabilities of these two branches are : 1/160 and 79/80.Now the universe is reduced to these two branches and the total probabil-ity is 1

160 + 7980 . To calculate the probability P(Down/Normal marker) the

branch in which the fetus HAS Down syndrome is considered. Dividing theprobability of that branch by the sum of the probabilities of all the branchesthat have ‘normal marker’ in them, 1/160

1/160+79/80 = 1/159.Considering the age of the mother and the results of the triple marker bloodtest, the probability of the fetus having Down syndrome was 1/80. How-ever, after receiving the results of the ultrasound, that probability has beenreduced to 1/159.

6.4.2 Preparing a two-way table *

An alternative to the probability trees is the preparation of a two-way tablelike the ones in Table 6.2 and 6.3. The information used to prepare TableThe HIV example

6.2 is found in Gastwirth (1986):

1. About 0.5% of the American population carries HIV

2. For those who carry HIV, the test results are positive (+) in 97.7% of the cases.

3. For those who do not carry HIV, the test results are negative(-) in92.6% of the cases.

The total of the rows for AIDS and NO AIDS have to reflect that pro-portion 0.05 to 99.5. If the table is built for an hypothetical one million

individuals, the obvious choices for the row totals are 5000 and 995000.Once the row totals have been established, the cells of the table can befilled. Using the information in 2), if there are 5000 individuals in the rowwho have HIV and 97.7 of them should test positive, 0 .977 × 5000 = 4885should go in the cell that is in the first row under ‘test positive’ and the

Page 17: Prod Book Stat Sample Conditional Prob

7/27/2019 Prod Book Stat Sample Conditional Prob

http://slidepdf.com/reader/full/prod-book-stat-sample-conditional-prob 17/26

6.4. REVERSE CONDITIONAL PROBABILITIES  13

remaining will go in the other cell. In a similar way the frequencies in the

cells of the second row are created.Table 6.3 was prepared based on the information given by Fan and Levine

(2007): The Down syndrome example

1. Among the high risk pregnancies (due to the age of the mother andthe results from a blood test) the probability of the fetus having Downsyndrome is 1/80, thus the probability of NOT having Down syndromeis 79/80

2. For fetuses with Down syndrome, half show a ‘normal marker’ in theultrasound and half show the ‘abnormal marker’

3. All fetuses without Down syndrome show the ‘normal marker’ in theultrasound and none shows the ‘abnormal marker’

The details for the preparation of the table in the Down syndrome exampleare described next.

How many hypothetical women need to be considered? Since the probabili- Preparing atable for theDown syndromeexample

ties of Down and No Down are 1/80 and 79/80, a multiple of 80 is suggested.(It could be 160 or 160,000 as in Table 6.3.) Based on the information giventhe totals of the rows are:

Normal marker Abnormal marker Row total

Down syndrome 2No Down syndrome 158

Column Total 160

Now consider the information given in 2), the total of the first row (2) issplit into equal parts, i.e. 1 and 1 because, for fetuses with Down syndrome,half of them show the normal marker and half of them show the abnormalmarker.

Normal marker Abnormal marker Row total

Down syndrome 1 1 2No Down syndrome 158

Column Total 160

All fetuses without Down syndrome show normal marker in the ultra-sound, thus there is no case in the cell ‘No Down AND abnormal marker

Page 18: Prod Book Stat Sample Conditional Prob

7/27/2019 Prod Book Stat Sample Conditional Prob

http://slidepdf.com/reader/full/prod-book-stat-sample-conditional-prob 18/26

Page 19: Prod Book Stat Sample Conditional Prob

7/27/2019 Prod Book Stat Sample Conditional Prob

http://slidepdf.com/reader/full/prod-book-stat-sample-conditional-prob 19/26

6.4. REVERSE CONDITIONAL PROBABILITIES  15

2. We percent of the population in each class is known, or, equiva-

lently, the probabilities of each class are known. In the exampleP(Down)=1/80 and P(No Down)=79/80.

3. There is another event B, in the example the ultrasound exam couldresult in ‘normal marker’ that will be considered the event B, or ab-normal marker. The probabilities P (B/Ai) for each one of the classesis known.

4. The question is, knowing that B (normal marker in the example) oc-curred, what is P (A1/B) (i.e. P(Down/Normal marker))?

Figures 6.6 and 6.7 explain step by step the process of building the twoway table in general.

B No B Total

Total

A1

A2

A3

PREPARE A TABLE WITH THE CLASSES OR GROUPS

IN THE ROWS AND THE EVENTS B AND NO B IN THECOLUMSDECIDE A NUMBER OF INDIVIDUALS N SUCH THAT ALLTHE COUNTS WILL BE INTEGERS

N

B No B Total

Total

A1

A2

A3

N

N1.

N2.

N3.

FILL THE CELLS OF THE ROW TOTALSACCORDING TO HOW FREQUENT THE CLASSESOR CATEGORIES ARE IN THE POPULATION.

N1. = N P(A1)N2. = N P(A2)etc.

Figure 6.6: Steps 1 and 2

Page 20: Prod Book Stat Sample Conditional Prob

7/27/2019 Prod Book Stat Sample Conditional Prob

http://slidepdf.com/reader/full/prod-book-stat-sample-conditional-prob 20/26

16 CHAPTER 6. CONDITIONAL PROBABILITY 

B No B Total

Total

A1

A2

A3

N

N1.

N2.

N3.

FILL THE CELLS OF EACH ROW BASED ON THEKNOWN PROBABILITIES P(B/A1)FOR EXAMPLE :N1b = N1 P(B/A1)THE CELLS IN THE COLUMN No B ARE FILLED JUSTBY CALCULATING THE DIFFERENCES.

N1b

N2b

N3b

B No B Total

Total

A1

A2

A3

N

N1.

N2.

N3.

N1b

N2b

N3b

Nb

CALCULATE THE TOTAL OF THE COLUMN FORTHE EVENT B (we are calling it Nb)

READ THE COLUMN FOR B IN ORDER TO CALCULATETHE DESIRED CONDITIONAL PROBABILITY,FOR EXAMPLEP(A1/B)= N1b/Nb

Figure 6.7: Steps 3 and 4

6.4.3 Bayes rule *

The Bayes rule is used to calculate reverse conditional probabilities in termsof marginal probabilities and conditional probabilities. Actually the ratio-nale of Bayes rule was used in the two previous sections: if the marginalprobabilities and the conditional probabilities in one direction are known,the conditional probabilities in the other direction can be calculated by us-ing the joint distribution. The example given in Fan & Levine (2007) willbe used to show the application of the Bayes rule formula.Consider two events : DS (Down Syndrome) and No DS (No Down Syn-

drome). For women in the high risk group P(DS) = 1/80 and P(no DS)=79/80.The universe of pregnant women at high risk in two sets DS and no DS asshown in Figure 6.8. Half of the fetuses with Down syndrome show absenceof the nasal bone in the ultrasound, thus: P(abnormal marker/Down syn-drome)=0.5 and P(normal marker/Down syndrome)=0.5.

Page 21: Prod Book Stat Sample Conditional Prob

7/27/2019 Prod Book Stat Sample Conditional Prob

http://slidepdf.com/reader/full/prod-book-stat-sample-conditional-prob 21/26

6.4. REVERSE CONDITIONAL PROBABILITIES  17

Figure 6.8: Bayes rule for Down syndrome example

All babies without Down syndrome get NM (normal marker) in the ultra-sound test, thus: P(NM/no DS)=1 and P(AM/ no DS)=0.

Now assume that the ultrasound is conducted for a woman in the highrisk group and the test shows presence of nasal bone (normal marker).

What is the probability that the fetus has Down Syndrome? P(Normalmarker/Down Syndrome) is known, but the question is P(Down Syndrome/Normalmarker) or P(DS/NM). In order to calculate P(DS/NM) will be expressedin terms of known quantities:P(DS)=1/80, P(DS)=79/80 ,P(AM/DS)=0.5 , P(NM/DS)=0.5, P(NM/noDS)=1 and P(AM/ no DS)=0.Expression (6.1) for conditional probability will be used. Remember P (B/A) =P (A∩B)P (A) , thus

P (DS/NM )=P (DS ∩NM )P (NM )) .

However, the values of  P (DS ∩ N M ) or P (N M ) are not known again the

expression of conditional probability can be used:P (NM/DS ) =P (DS ∩NM )

P (DS 

Thus P (DS ∩ N M ) = P (NM/DS )P (DS )=12 ×

180 = 1

160

The numerical value of the numerator has been found, now the denom-

Page 22: Prod Book Stat Sample Conditional Prob

7/27/2019 Prod Book Stat Sample Conditional Prob

http://slidepdf.com/reader/full/prod-book-stat-sample-conditional-prob 22/26

18 CHAPTER 6. CONDITIONAL PROBABILITY 

inator needs to be calculated. The event ‘normal marker’ as composed by

two mutually exclusive events (see Figure 6.9), ‘Normal marker and Downsyndrome’ and ‘Normal marker and no Down syndrome’, each probabilitycan be calculated separately:

P (N ormal marker) = P (N M ∩ DS ) + P (N M ∩ noDS )

Also:

P (N M ∩ DS )=P (DS ∩ N M ) = P (NM/DS )P (DS )=12 ×

180 = 1

160

In a similar way,P (N M ∩ noDS )=P (N M ∩ noDS ) =P (NM/noDS )P (noDS )=1× 79

80= 79

80

Thus,P (DS/NM ) = P (NM/DS )P (DS )

P (NM/DS )P (DS )+P (NM/NoDS )P (noDS )

P (DS/NM ) =(1/2)×(1/80)

(1/2)×(1/80)+1×(79/80) =1/160159/160 = 1/159

For a woman belonging to the high risk group, the probability that thefetus has Down syndrome before the ultrasound is 1/80 ,and it goes downto 1/159 after the ultrasound outcome is known to be normal marker. Thisis the same result obtained with the probability trees and the two-way tablein the previous sub sections.

There is a formula that describes these calculations and it is known as theBayes rule, named after Rev. Thomas Bayes (c.1702 − 1761) who solvedthe problem of the ‘reverse’ probability. His method was published after hisdeath. In general, Bayes rule is applicable to the following situation:

1. There is a partition of the universe with respect to one criteria, so thatwe have the subsets A1, A2...Ak

(in the example is Down Syndrome Yes/No but in other cases we canhave more categories) and P (A1),P (A2)...P (Ak) are known.

2. There is another criterion (in the example it is the ultrasound test)that defines the event B (normal marker).

3. We know the probabilities P (B/A1),P (B/A2)...P (B/Ak)

4. We want to calculate the probability P (Ai/B) for some value of  i =1,...,k

Page 23: Prod Book Stat Sample Conditional Prob

7/27/2019 Prod Book Stat Sample Conditional Prob

http://slidepdf.com/reader/full/prod-book-stat-sample-conditional-prob 23/26

6.4. REVERSE CONDITIONAL PROBABILITIES  19

Figure 6.9: Bayes rule in general

The Bayes rule to calculate P (Ai/B) is:

P (Ai/B) =P (B/Ai) × P (Ai)

Σk1P (B/Ai) × P (Ai)

(6.2)

In the case of the HIV example, the percent of the population that hasHIV is known, and P(Test +/AIDS) is known, the reverse probability of interest is: Given that a person tests positive in the ELISA test, what is theprobability that he/she really has HIV?

In this case:

P (Ai/B) = P (B/Ai)×P (Ai)

Σk

1P (B/Ai)×P (Ai)

becomes

P (AIDS/Test+) =P (Test+/HIV )×P (AIDS )

P (Test+/HIV )×P (HIV )+P (Test+/noHIV )×P (noHIV )

P (HIV/Test+) =

4885

5000×

5000

1000000

4885

5000×

5000

1000000+ 73630

995000×

995000

1000000 =4885

4885+73630 =488578515

the same answer obtained from the two way table and the probabilitytree.Bayes’ name is also attached to a whole approach to statistical inference

Page 24: Prod Book Stat Sample Conditional Prob

7/27/2019 Prod Book Stat Sample Conditional Prob

http://slidepdf.com/reader/full/prod-book-stat-sample-conditional-prob 24/26

20 CHAPTER 6. CONDITIONAL PROBABILITY 

called Bayesian in which the idea the scientist has about the possible values

for the parameter is represented by a ‘prior’distribution. Based on thatprior distribution and the data, a ‘posterior’ distribution for the parameteris calculated and used to make inference about it. The Bayesian approachto statistical inference is beyond the scope of this book.

6.5 Exercises

1. In Egwaga et al.(2007)the following information is reported: A test forHIV based on sputum was developed and compared with the assumedconclusive results of the blood serum test. The sputum test is cheaperand easier to apply and thus can be of practical use in developing

countries where people are also tested for tuberculosis. The authorsreport that the sensitivity of the sputum HIV test (if applied on thesame day of sputum collection) was 94.7% and the specificity was92.9%. Write the information given (sensitivity and specificity) in theform of conditional probabilities in the context of the problem (fill theblanks in the expressions below.P( / )=0.947P( / )=0.929What is the probability of a false positive? What is the probability of a false negative?

2. In Ongut et al.(2006) the following information is found about a studydone in Turkey to evaluate the ICT (immunochromatographic) test todetect tuberculosis. From 72 patients with active pulmonary tubercu-losis 53 tested positive and 19 tested negative; the 54 controls testednegative. Construct a two way table to display the information. Calcu-late the sensitivity, specificity, P(false negative), and P(false positive)of the test.

3. Traditionally the Papanicolau smears test is used for the detectionof cervical cancer in women. Also a test for Human Papilloma virus(HPV), the main cause for cervical cancer could be used. In NatureReviews Cancer 7, 893 (December 2007) the following information is

found ‘The sensitivity of HPV testing was 94.6%, whereas that of Paptesting was 55.4%. The specificity was 94.1% for HPV testing and96.8% for Pap smears. What is the probability of a false positive in aPap smear test? What is the probability of a false negative in a DNAtest for HPV? What is the probability of a false negative in a Pap

Page 25: Prod Book Stat Sample Conditional Prob

7/27/2019 Prod Book Stat Sample Conditional Prob

http://slidepdf.com/reader/full/prod-book-stat-sample-conditional-prob 25/26

6.5. EXERCISES  21

smear test? What is the probability of a false negative in the DNA

test for HPV?

4. Only 1 in 1000 adults is afflicted with a rare disease for which a di-agnostic test has been developed. The test is such that when an indi-vidual actually has the disease, a positive result will occur 99% of thetime, whereas an individual without the disease will show a positiveresult (false positive) only 2% of the time. Build a two way table forhypothetical 100,000 individuals. If a randomly selected individual istested and the result is positive, what is the probability that the in-dividual has the disease? Also solve the problem using a probabilitytree.

5. Consider a small variation to the previous problem: the disease isnot so rare and 5% of the population is affected by it. What is theprobability that a person has the disease given that he/she has testedpositive?

6. In medicine, the probability that a patient has the disease given apositive test result is called the positive predictive value or PPV. Theprobability that a patient does not have the disease given a negativetest result is called the negative predictive value or NPV. Calculatethe PPV and NPV of the ultrasound test for pregnancies at high riskof Down syndrome (i.e. P(Down syndrome)=1/80). Remember that

for the Down syndrome example, positive test result means abnormalmarker and negative test result is normal marker.

7. Consider a variation to the previous question. Calculate PPV andNPV for the general population for which P(Down syndrome)=92/100000.

8. In Soon et al. (2003) it is reported that the sensitivity of a digital der-moscopic test for melanoma is 93% and specificity is 92.75%.Considera low risk population (because of age, skin color, etcetera) for whomthe pre-test probability of having melanoma is only 0.01. Calculateprobability of false negative, probability of false positive, positive pre-dictive value (PPV=P(disease/test+) ) and negative predictive value

(NPV=P(no disease/test -)).

9. Repeat the previous question now for a high risk group (because of age and skin color) for whom the pre-test probability of melanoma is0.25.

Page 26: Prod Book Stat Sample Conditional Prob

7/27/2019 Prod Book Stat Sample Conditional Prob

http://slidepdf.com/reader/full/prod-book-stat-sample-conditional-prob 26/26

22 CHAPTER 6. CONDITIONAL PROBABILITY 

References

Desper, Khan & Schaffer (2004) Tumor classification using phylogeneticmethods on expression dataJournal of Theoretical Biology  Vol. 28(4)pp 477-96.

Egwaga et. al (2007) Low specificity of HIV-testing on sputum specimens 

kept at ambient temperatures for 4 to 7 days: a blinded comparison 

BMC Clinical Pathology 

Fan J.J. & Levine, R.A. (2007) To Amnio or Not to Amnio: That is decisionfor Bayes Chance  Vol. 20(3).

Gastwirth, J.L (1987) The Statistical Precision of Medical Screening Pro-

cedures: Application to Polygraph and AIDS Antibodies Test Data,Statistical Science  Vol. 2, (3) pp. 213-222

Rossman,A,J. and Short, T. H. (1995) Conditional Probability and Educa-tion Reform: Are They Compatible. Journal of Statistics Education 

Vol. 3 (2)

Ongut,G, Ongunc,D,Gunsere,F,Ogus,C,Donmez,L.,Colak,D. and Gultekin,M.(2006).Evaluation of the ICT Tuberculosis test for the routine diagno-sis of tuberculosis. BMC Infectious Diseases  Vol 6(77)

Soon,S.,McCall,C. and Chen,S. (2003) Computerized Digital Dermoscopy:

Sensitivity And Specificity Aren’t Enough, Journal of Investigative Dermatology Vol 121, pp 214215