(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?
sensitivity = .96
specificity = .98
prevalence = .001
median_cost = 100000
test_cost = 1000
ppv = (sensitivity * prevalence)/((sensitivity * prevalence) + (1 - specificity) * (1 - prevalence))
ppv
## [1] 0.04584527
PPV = 4.58%
For those rare diseases, even a specificity of 98% hurts.
I don’t fully understand the next part of the question. Assuming we have 100,000 individuals, all of whom are tested. And then ignoring the complexities of follow-up testing for those with false positives or negatives:
positive_pop = 100000 * ppv
testing = 100000 * 1000
total_cost = positive_pop + testing
total_cost
## [1] 100004585
Total cost based on my likely misunderstanding of the question: $100,004,585
(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?
Visualizing:
months = 24
inspection_prob = .05
plot(dbinom(1:24, size = 24, prob = 0.05), type = "h", lwd = 2,
main = "Binomial probability function",
ylab = "P(X = x)", xlab = "Number of inspections")
Exactly two inspections after 24 months.
exactly_2 = dbinom(2, months, inspection_prob)
exactly_2
## [1] 0.2232381
Two or more.
two_or_more = 1 - (dbinom(1, months, inspection_prob)) - (dbinom(0, months, inspection_prob))
two_or_more
## [1] 0.3391827
Fewer than two.
fewer_than_two = 1 - two_or_more
fewer_than_two
## [1] 0.6608173
Expected number of inspections.
expected = months * inspection_prob
expected
## [1] 1.2
Standard deviation for the binomial.
sd = sqrt(months * inspection_prob * (1 - inspection_prob))
sd
## [1] 1.067708
(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?
Exactly three in an hour:
rate = 10
exactly_3 = dpois(3,rate)
exactly_3
## [1] 0.007566655
More than 10 in an hour.
more_than_10 = 1 - ppois(10, rate)
more_than_10
## [1] 0.4169602
How many are expected in 8 hours?
expected = rate * 8
expected
## [1] 80
Standard deviation of a Poisson distribution is the square root of the rate.
sd = sqrt(rate)
sd
## [1] 3.162278
Utilization and recommendations.
utilization = expected/(24 * 3)
utilization
## [1] 1.111111
We’re at 111.1% utilization. Let’s hire some mid-level providers. Or double book.
(Hypergeometric). 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?
Probability 5 nurses were innocently selected.
prob_5_nurses = dhyper(5,15,15,6)
prob_5_nurses
## [1] 0.07586207
Expected nurses.
expected_nurses = 6 * (15/30)
expected_nurses
## [1] 3
Expected non-nurses.
expected_non_nurses = 6 * (15/30)
expected_non_nurses
## [1] 3
(Geometric). 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?
Probability seriously injured in course of year.
prob_injury = .001
hours = 1200
crash_1200 = pgeom(hours,prob_injury)
crash_1200
## [1] 0.6992876
Probability serious injured in 15 months.
crash_15_mths = pgeom(hours * (15/12),prob_injury)
crash_15_mths
## [1] 0.7772602
Probability injured in next 100 hours given 1200 hours.
crash_next_100 = pgeom(100,prob_injury)
crash_next_100
## [1] 0.09611265
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?
Probability will fail more than twice in 1000 hours.
fail_more_than_twice = 1 - ppois(2,1)
fail_more_than_twice
## [1] 0.0803014
Expected value is 1 failure for 1000 hours.
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?
Wait more than 10 minutes.
wait = 10
min = 0
max = 30
wait_more_than_10 = 1- punif(wait,min,max)
wait_more_than_10
## [1] 0.6666667
After waiting 10 minutes, probability of at least another 5?
wait_2 = 15
new_min = 10
wait_more_than_15 = 1 - punif(wait_2,new_min,max)
wait_more_than_15
## [1] 0.75
Expected waiting time is 15 minutes.
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?
Expected failure time is after 10 years. As this is an exponential distribution, the standard deviation is the mean - 10 years.
Fail after 8 years.
years = 8
fail_rate = 1/10
fail_after_8_yrs = 1- pexp(years,fail_rate)
fail_after_8_yrs
## [1] 0.449329
After owning 8 years, will fail in next 2 years.
next_years = 2
fail_after_8_wi_2 = pexp(next_years,fail_rate)
fail_after_8_wi_2
## [1] 0.1812692