The test is negative 90 of the time when tested on a healthy patient high

The test is negative 90 of the time when tested on a

This preview shows page 1 out of 1 page.

The test is negative 90% of the time when tested on a healthy patient (high specificity): P (disease) = 0.02 The disease is prevalent in about 2% of the community: P (disease) = 0.02 Using Bayes’ theorem, calculate the probability that you have the disease if the test is positive. P (disease| test + ) = P (test + | disease) × P (disease) P (test+ ) = P (test+ |disease) P (disease) P (test+ |disease) P (disease) + P (test+ |healthy) P (healthy) ] = 0.85×0.02 0.85×0.02+0.1×0.98 = 0.1478261 The following 4 questions (Q2-Q5) all relate to implementing this calculation using R. We have a hypothetical population of 1 million individuals with the following conditional probabilities as described below: The test is positive 85% of the time when tested on a patient with the disease (high sensitivity): P (test + | disease) = 0.85 The test is negative 90% of the time when tested on a healthy patient (high specificity): P (test − | heathy) = 0.90 The disease is prevalent in about 2% of the community: Here is some sample code to get you started: P (disease) = 0.02 set.seed( 1 ) disease <- sample(c( 0 , 1 ), size= 1e6 , replace= TRUE , prob=c( 0.98 , 0.02 )) test <- rep( NA , 1e6 ) test[disease== 0 ] <- sample(c( 0 , 1 ), size=sum(disease== 0 ), replace= TRUE , prob=c( 0.90 , 0.10 )) test[disease== 1 ] <- sample(c( 0 , 1 ), size=sum(disease== 1 ), replace= TRUE , prob=c( 0.15 , 0.85 )) Question 2 What is the probability that a test is positive? mean(test) ## [1] 0.114509 Question 3
Image of page 1

You've reached the end of your free preview.

Want to read the whole page?

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

Stuck? We have tutors online 24/7 who can help you get unstuck.
A+ icon
Ask Expert Tutors You can ask You can ask You can ask (will expire )
Answers in as fast as 15 minutes