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 <- 0.96
specificity <- 0.98
prevalence <- 0.001
total_individuals <- 100000
cost_per_positive <- 100000
test_cost_per_administration <- 1000
p_positive <- (sensitivity * prevalence) + ((1 - specificity) * (1 - prevalence))
p_disease_given_positive <- (sensitivity * prevalence) / p_positive
total_positive_cases <- p_positive * total_individuals
total_cost <- total_positive_cases * cost_per_positive + total_individuals * test_cost_per_administration
cat("Probability that an individual who tests positive actually has the disease:", p_disease_given_positive, "\n")
## Probability that an individual who tests positive actually has the disease: 0.04584527
cat("Total first-year cost for treating 100,000 individuals:", total_cost, "\n")
## Total first-year cost for treating 100,000 individuals: 309400000
2: The probability of your organization receiving a Joint Commission inspection in any given month is .05. a)What is the probability that, after 24 months, you received exactly 2 inspections? b)What is the probability that, after 24 months, you received 2 or more inspections? c)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?
n <- 24
p <- 0.05
k<-2
## a) exactly 2 inspections
prob_1 <- dbinom(k, size=n, prob = p)
print(prob_1)
## [1] 0.2232381
prob <- 0
for (k in 2:n) {
prob_k <- dbinom(k, size = n, prob = p)
prob <- prob + prob_k
}
print(prob)
## [1] 0.3391827
prob_0 <- dbinom(0, size = n, prob = p)
prob_1 <- dbinom(1, size = n, prob = p)
prob_2 <- dbinom(2, size = n, prob = p)
prob_2_or_less <- prob_0 + prob_1 + prob_2
print(prob_2_or_less)
## [1] 0.8840554
print(n*p)
## [1] 1.2
print(sqrt(n * p * (1 - p)))
## [1] 1.067708
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?
tot_work <- 30 # total workers
tot_nur <- 15 # total nurses
tot_non <- 15 # total non-nurses
sel_work <- 6 # selected workers
sel_nur <- 5 # selected nurses
# 1. Probability of selecting exactly 5 nurses for the trips
prob_5_nur <- dhyper(sel_nur, tot_nur, tot_non, sel_work)
# 2. Expected number of nurses selected for the trips
exp_nur <- (sel_work / tot_work) * tot_nur
# 3. Expected number of non-nurses selected for the trips
exp_non <- (sel_work / tot_work) * tot_non
print(prob_5_nur)
## [1] 0.07586207
print(exp_nur)
## [1] 3
print(exp_non)
## [1] 3
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?
avg <- 10
hours <- 8
# 1. Probability that exactly 3 arrive in one hour
prob_3 <- dpois(3, avg)
# 2. Probability of more than 10 arrive in one hour
prob_10 <- 1 - ppois(10, avg)
# 3. Expected number of arrivals in 8 hours
expected_arrivals <- avg * hours
# 4. Standard deviation of the Poisson distribution
standard_deviation <- sqrt(avg)
print(prob_3)
## [1] 0.007566655
print(prob_10)
## [1] 0.4169602
print(expected_arrivals)
## [1] 80
print(standard_deviation)
## [1] 3.162278
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?
ps = .001
hours <- 1200
probabilitys <- pgeom(hours, prob = ps)
cat("Probability that the driver will be seriously injured during the course of the year:", probabilitys, "\n")
## Probability that the driver will be seriously injured during the course of the year: 0.6992876
In the course of 15 months?
prob_per_hour <- 0.001
hours_per_month <- 1200 / 12
months <- 15
total_hours_15_months <- hours_per_month * months
probability_15_months <- pgeom(total_hours_15_months, prob = prob_per_hour)
cat("Probability that the driver will be seriously injured within 15 months:", probability_15_months, "\n")
## Probability that the driver will be seriously injured within 15 months: 0.7772602
What is the expected number of hours that a driver will drive before being seriously injured?
prob_per_hour <- 0.001
expected_hours <- 1 / prob_per_hour
cat("Expected Number:", expected_hours, "\n")
## Expected Number: 1000
Given that a driver has driven 1200 hours, what is the probability that he or she will be injured in the next 100 hours?
hours_already_driven <- 1200
hours_next <- 100
probability_next <- pgeom(hours_already_driven + hours_next, prob = prob_per_hour) - pgeom(hours_already_driven, prob = prob_per_hour)
print(probability_next)
## [1] 0.02863018
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?
avg <- 1/1000
n <- 1000
prob_2 <- 1 - ppois(2, avg * n)
expected_failures <- avg * n
print(prob_2)
## [1] 0.0803014
print(expected_failures)
## [1] 1
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?
small <- 0 # Lower bound
large <- 30 # Upper bound
# 1. Probab that patient will wait more than 10 minutes
prob_wait_10 <- 1 - punif(10, min = small, max = large)
# 2. Probability that, if the patient has already waited 10 minutes, they will wait at least another 5 minutes
prob_wait_15 <- 1 - punif(15, min = small, max = large)
# 3. Expected waiting time
expected_wait <- (small + large) / 2
print(prob_wait_10)
## [1] 0.6666667
print(prob_wait_15)
## [1] 0.5
print(expected_wait)
## [1] 15
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?
mean_life <- 10
# 1. Expected failure time (mean of the exponential distribution)
expected_failure_time <- mean_life
# 2. Standard deviation of the exponential distribution
standard_deviation <- mean_life
# 3. Probability that the MRI will fail after 8 years
prob_fail_after_8_years <- pexp(8, rate = 1 / mean_life, lower.tail = FALSE)
# 4. Probability that the MRI will fail in the next two years, given that it has already been owned for 8 years
prob_fail_next_2_years <- pexp(10, rate = 1 / mean_life) - pexp(8, rate = 1 / mean_life)
print(expected_failure_time)
## [1] 10
print(standard_deviation)
## [1] 10
print(prob_fail_after_8_years)
## [1] 0.449329
print(prob_fail_next_2_years)
## [1] 0.08144952