Q1

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?

positive <- 0.96
false_negative <- 1 - positive
negative <- 0.98
false_positive <- 1 - negative

pos_rate <- 0.001
neg_rate <- 1 - pos_rate

population <- 100000
pop_pos <- population * pos_rate
pop_neg <- (population - pop_pos) * neg_rate

P_actually_has <- (positive * pos_rate) / ((positive * pos_rate) + (false_positive * neg_rate))
print(paste0("Percentage that actually is positive: ", round(P_actually_has * 100, 2), "%"))
## [1] "Percentage that actually is positive: 4.58%"

Q2

(Binomial) P(x;p,n)=(nk)(p)x(1−p)(n−k)forx=0,1,2,…,n where:(nk)=n!k!(n−k)!

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?

p <- 0.05
n <- 24
x <- 2

prob_2 <- choose(n, x) * p^x * (1 - p)^(n - x)
print(paste0("The probability of receiving exactly 2 inspections in 24 months is: ", round(prob_2 * 100, 1), "%"))
## [1] "The probability of receiving exactly 2 inspections in 24 months is: 22.3%"
prob_at_least_2 <- sum(dbinom(x:n, n, p))
print(paste0("The probability of receiving 2 or more inspections in 24 months is: ", round(prob_at_least_2 * 100, 1), "%"))
## [1] "The probability of receiving 2 or more inspections in 24 months is: 33.9%"
prob_less_than_2 <- sum(dbinom(0:(x-1), n, p))
print(paste0("The probability of receiving fewer than 2 inspections in 24 months is: ", round(prob_less_than_2 * 100, 1), "%"))
## [1] "The probability of receiving fewer than 2 inspections in 24 months is: 66.1%"
expected_inspections <- n * p
print(paste0("The expected number of inspections is: ", expected_inspections))
## [1] "The expected number of inspections is: 1.2"
standard_deviation <- sqrt(n * p * (1 - p))
print(paste0("The standard deviation is: ", standard_deviation))
## [1] "The standard deviation is: 1.06770782520313"

Q3

(Poisson) f(k;λ)=Pr(X=k)=λke−λk! 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?

lambda <- 10

prob_3 <- dpois(3, lambda)
print(paste0("The probability that exactly 3 patients arrive in one hour is: ", round(prob_3, 4)))
## [1] "The probability that exactly 3 patients arrive in one hour is: 0.0076"
prob_more_than_10 <- 1 - ppois(10, lambda)
print(paste0("The probability that more than 10 patients arrive in one hour is: ", round(prob_more_than_10, 3)))
## [1] "The probability that more than 10 patients arrive in one hour is: 0.417"
expected_arrivals <- lambda * 8
print(paste0("The expected number of arrivals in 8 hours is: ", expected_arrivals))
## [1] "The expected number of arrivals in 8 hours is: 80"
standard_deviation <- sqrt(lambda * 8)
print(paste0("The standard deviation is: ", standard_deviation))
## [1] "The standard deviation is: 8.94427190999916"

Q4

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?

total_workers <- 30
total_nurses <- 15
total_non_nurses <- total_workers - total_nurses
trips <- 6
nurses_selected <- 5

prob_5_nurses <- choose(total_nurses, nurses_selected) * choose(total_non_nurses, trips - nurses_selected) / choose(total_workers, trips)
print(paste0("The probability of innocently selecting 5 nurses for the trips is: ", round(prob_5_nurses, 3)))
## [1] "The probability of innocently selecting 5 nurses for the trips is: 0.076"
expected_nurses <- (total_nurses / total_workers) * trips
print(paste0("The expected number of nurses to be sent is: ", expected_nurses))
## [1] "The expected number of nurses to be sent is: 3"
expected_non_nurses <- (total_non_nurses / total_workers) * trips
print(paste0("The expected number of non-nurses to be sent is: ", expected_non_nurses))
## [1] "The expected number of non-nurses to be sent is: 3"

Q5

P(X=x)=(1–p)(x–1)pforx=1,2,..,n 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?

p <- 0.001
n <- 1200

prob_injured_year <- pgeom(1, p)
print(paste0("The probability of a driver being seriously injured during the course of a year is: ", round(prob_injured_year * 100, 2), "%"))
## [1] "The probability of a driver being seriously injured during the course of a year is: 0.2%"
prob_injured_15_months <- pgeom(1, p * 15)
print(paste0("The probability of a driver being seriously injured during the course of 15 months is: ", round(prob_injured_15_months * 100, 2), "%"))
## [1] "The probability of a driver being seriously injured during the course of 15 months is: 2.98%"
expected_hours <- 1 / p
print(paste0("The expected number of hours a driver will drive before being seriously injured is: ", expected_hours))
## [1] "The expected number of hours a driver will drive before being seriously injured is: 1000"
prob_next_100_hours <- pgeom(5, p, lower.tail = FALSE)
print(paste0("The probability of a driver being injured in the next 100 hours is: ", round(prob_next_100_hours * 100, 3), "%"))
## [1] "The probability of a driver being injured in the next 100 hours is: 99.401%"

Q6

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?

lambda <- 1 / 1000
prob_more_than_twice <- ppois(2, lambda, lower.tail = FALSE)
print(paste0("The probability that the generator will fail more than twice in 1000 hours is: ", round(prob_more_than_twice * 100, 2), "%"))
## [1] "The probability that the generator will fail more than twice in 1000 hours is: 0%"
expected_value <- 1 / lambda
print(paste0("The expected value is: ", expected_value))
## [1] "The expected value is: 1000"

Q7

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?

wait_time <- 30
prob_wait_more_than_10 <- 1 - punif(10, 0, wait_time)
print(paste0("The probability of waiting more than 10 minutes is: ", round(prob_wait_more_than_10 * 100, 1), "%"))
## [1] "The probability of waiting more than 10 minutes is: 66.7%"
prob_wait_another_5 <- 1 - punif(15, 10, wait_time)
print(paste0("The probability of waiting at least another 5 minutes after waiting for 10 minutes is: ", round(prob_wait_another_5 * 100, 1), "%"))
## [1] "The probability of waiting at least another 5 minutes after waiting for 10 minutes is: 75%"
expected_waiting_time <- wait_time / 2
print(paste0("The expected waiting time is: ", expected_waiting_time, " minutes"))
## [1] "The expected waiting time is: 15 minutes"

Q8

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?

lifetime <- 10
expected_failure <- lifetime
print(paste0("The expected failure time is: ", expected_failure, " years"))
## [1] "The expected failure time is: 10 years"
standard_deviation <- 1 / lifetime
print(paste0("The standard deviation is: ", standard_deviation))
## [1] "The standard deviation is: 0.1"
prob_fail_after_8_years <- 1 - pexp(8, 1 / lifetime)
print(paste0("The probability that the MRI will fail after 8 years is: ", round(prob_fail_after_8_years * 100, 2), "%"))
## [1] "The probability that the MRI will fail after 8 years is: 44.93%"
prob_fail_in_next_2_years <- pexp(2, 1 / lifetime, lower.tail = FALSE)
print(paste0("The probability that the MRI will fail in the next two years, given that it has been owned for 8 years, is: ", round(prob_fail_in_next_2_years * 100, 2), "%"))
## [1] "The probability that the MRI will fail in the next two years, given that it has been owned for 8 years, is: 81.87%"

Q2