Question 1

(Bayesian). A new test for multinucleoside-resistant (MNR) human immunodeficiency virus type 1 (HIV-1) variants was recently developed. The test maintains 96% sensitivity, meaning that, for those with the disease, it will correctly report “positive” for 96% of them. The test is also 98% specific, meaning that, for those without the disease, 98% will be correctly reported as “negative.” MNR HIV-1 is considered to be rare (albeit emerging), with about a .1% or .001 prevalence rate. Given the prevalence rate, sensitivity, and specificity estimates, what is the probability that an individual who is reported as positive by the new test actually has the disease? If the median cost (consider this the best point estimate) is about 100,000 per positive case total and the test itself costs 1000 per administration, what is the total first-year cost for treating 100,000 individuals?

#probability person reported as positive actually has the disease
p_positive_hiv <- (0.96 * 0.001/(0.96 * 0.001 + 0.02 * 0.999))

The probability a person reported as positive by the new test actually has the disease is 4.58%.

n <- 100000
prevalence_rate <- 0.001
true_positive <- (n*prevalence_rate)*0.96

With 100,000 individuals and a 0.1% prevalence rate, 100 individuals will have a positive results (100,000*0.1), and with it “correctly” reporting positive for 96% of cases, 96 will be true, 4 will be false positives.

#reduce the 100 reported as positive from the 100,000
negative <- n-100
true_negative <- negative*0.98
false_negative <- negative-true_negative #positives from the negatives

#positive population
positive_population<-false_negative+true_positive

The true negatives will equate to 100,000-100 positive cases, multiplied by 98% = 97,902. The true positive population is then 2,094 (previous 96+false negatives 1,998).

#costs
cost_per_test <- 1000
cost_per_positive <- 100000
#a test was given to 100000 patients, therefore a cost per administration for each, plus the cost of 100000 per positive
total_cost <- cost_per_test*n + cost_per_positive*positive_population

The total cost for the first year is $309,400,000

Question 2

(Binomial). The probability of your organization receiving a Joint Commission inspection in any given month is .05. What is the probability that, after 24 months, you received exactly 2 inspections? What is the probability that, after 24 months, you received 2 or more inspections? What is the probability that your received fewer than 2 inspections? What is the expected number of inspections you should have received? What is the standard deviation?

months <- 24
p2 <- 0.05
inspections <- 2

p_two_inspections <- dbinom(inspections, months, p2)

Probability of exactly 2 inspections after 24 months = 22.32%

p_two_or_more <- 1-pbinom(1,months,p2)

Probability of 2 or more inspections after 24 months = 33.92%

p_less_than_two <- pbinom(1,months,p2)

Probability of less than 2 inspections after 24 months = 66.08%

expected <- p2*months
std_dev <- sqrt(p2 * months * (1 - p2))

Expected inspections is 1.2, with a standard deviation of 1.068

Question 3

(Poisson). You are modeling the family practice clinic and notice that patients arrive at a rate of 10 per hour. What is the probability that exactly 3 arrive in one hour? What is the probability that more than 10 arrive in one hour? How many would you expect to arrive in 8 hours? What is the standard deviation of the appropriate probability distribution? If there are three family practice providers that can see 24 templated patients each day, what is the percent utilization and what are your recommendations?

#probability exactly 3 arrive in an hour
arr_rate <- 10
dpois(3,arr_rate)
## [1] 0.007566655

Probability exactly 3 arrive in an hour = 0.76%

#What is the probability that more than 10 arrive in one hour?
1-ppois(10,arr_rate)
## [1] 0.4169602

Probability that more than 10 arrive in one hour = 41.7%

#How many would you expect to arrive in 8 hours?
8*arr_rate
## [1] 80

Expect 80 to arrive in 8 hours

#What is the standard deviation of the appropriate probability distribution?
sqrt(arr_rate)
## [1] 3.162278

Square root of expected value = standard dev = 3.16

#If there are three family practice providers that can see 24 templated patients each day, what is the percent utilization and what are your recommendations?
#24*3=72 patients with an expected arrival of 80
8*arr_rate/72
## [1] 1.111111

The utilization is 111%. I’d recommend hiring another provide which will bring utilization below 100% to 83% (80/96)

Question 4

Your subordinate with 30 supervisors was recently accused of favoring nurses. 15 of the subordinate’s workers are nurses and 15 are other than nurses. As evidence of malfeasance, the accuser stated that there were 6 company-paid trips to Disney World for which everyone was eligible. The supervisor sent 5 nurses and 1 non-nurse. If your subordinate acted innocently, what was the probability he/she would have selected five nurses for the trips? How many nurses would we have expected your subordinate to send? How many non-nurses would we have expected your subordinate to send?

#what was the probability he/she would have selected five nurses for the trips?
nurses <- 15
non_nurses <- 15
trips <- 6 
dhyper(5,nurses,non_nurses,trips)
## [1] 0.07586207

The probability they would have selected five nurses for the tips is 7.6%

#How many nurses would we have expected your subordinate to send?
nurses*trips/(nurses+non_nurses)
## [1] 3

Would have expected them to send 3 nurses

#How many non-nurses would we have expected your subordinate to send?

Same as above, as the amount of nurses and non-nurses are equal.

Question 5

The probability of being seriously injured in a car crash in an unspecified location is about .1% per hour. A driver is required to traverse this area for 1200 hours in the course of a year. What is the probability that the driver will be seriously injured during the course of the year? In the course of 15 months? What is the expected number of hours that a driver will drive before being seriously injured? Given that a driver has driven 1200 hours, what is the probability that he or she will be injured in the next 100 hours?

#What is the probability that the driver will be seriously injured during the course of the year?
p_injury <- 0.001
hours_driven_year <-1200
pgeom(hours_driven_year,p_injury)
## [1] 0.6992876

Probability of injury in course of year = 70%

#In the course of 15 months?
#drives 100 hours per month (1200/12)
pgeom((hours_driven_year+300),p_injury)
## [1] 0.7772602

Probability of injury in course of 15 months = 78%

#What is the expected number of hours that a driver will drive before being seriously injured?
1/p_injury
## [1] 1000

Expected # of hours a driver will drive before being seriously injured = 1000 hours

#Given that a driver has driven 1200 hours, what is the probability that he or she will be injured in the next 100 hours?
pgeom(100,p_injury)
## [1] 0.09611265

Probability that he or she will be injured in the next 100 hours = 9.6%

Question 6

You are working in a hospital that is running off of a primary generator which fails about once in 1000 hours. What is the probability that the generator will fail more than twice in 1000 hours? What is the expected value?

#What is the probability that the generator will fail more than twice in 1000 hours?
1-ppois(2,1)
## [1] 0.0803014

Probability of failing more than twice in 1000 hours is 8%.

The expected value is 1 failure per 1000 hours.

Question 7

A surgical patient arrives for surgery precisely at a given time. Based on previous analysis (or a lack of knowledge assumption), you know that the waiting time is uniformly distributed from 0 to 30 minutes. What is the probability that this patient will wait more than 10 minutes? If the patient has already waited 10 minutes, what is the probability that he/she will wait at least another 5 minutes prior to being seen? What is the expected waiting time?

#What is the probability that this patient will wait more than 10 minutes?
1-punif(10,0,30)
## [1] 0.6666667

Probability of waiting more than 10 minutes is 67%

#If the patient has already waited 10 minutes, what is the probability that he/she will wait at least another 5 minutes prior to being seen?
(1-punif(5,0,20)) #20 minutes becomes the maximum waiting time after 10 minutes has passed
## [1] 0.75

If the patient has already waited 10 minutes, the probability of waiting another 5 is 75%

Since it is evenly distributed, the expected waiting time would be the midpoint, 15 minutes.

Question 8

Your hospital owns an old MRI, which has a manufacturer’s lifetime of about 10 years (expected value). Based on previous studies, we know that the failure of most MRIs obeys an exponential distribution. What is the expected failure time? What is the standard deviation? What is the probability that your MRI will fail after 8 years? Now assume that you have owned the machine for 8 years. Given that you already owned the machine 8 years, what is the probability that it will fail in the next two years? The expected failure time is 10 years and the standard deviation is 10 years (equal to mean of expected failure)

1-pexp(8, 0.1) #8 years at a rate of 0.1 per year
## [1] 0.449329

The probability the MRI will fail after 8 years is 45%.

#Given that you already owned the machine 8 years, what is the probability that it will fail in the next two years? 
pexp(2,0.1)
## [1] 0.1812692

The probability it will fail in the next 2 years after owning for 8 years is 18%.