# what is the probability that an individual who is
# reported as positive by the new test actually has the disease?
positive_rate <- 0.96
false_positive <- .04
negative_rate <- 0.98
false_negative <- .02
prevalence_rate <- .001
non_prevalence_rate <- .999
# Event B = Tested Positive (0.96)
event_b <- 0.96
# Event A1 = Prevalence Rate (.001)
event_A1 <- .001
# Tested negative but is positive (1-specificity)
event_b2 <- .02
# Event A2 = Non-Prevalence Rate
event_A2 <- .999
# Bayes Formula: P(A1|B) = P(B)*P(A1) / P(B2) + P(A2))
bayes_formula <- (event_b*event_A1) / ((event_b*event_A1) + (event_b2 * event_A2))
bayes_formula
## [1] 0.04584527
# 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?
median_positive_cost <- 100000
test_cost <- 1000
individuals <- 100000
# multiplying positive rate by number of individuals
total_positive_case <- individuals*bayes_formula
total_first_year_cost <- (total_positive_case*median_positive_cost) + (individuals*test_cost)
total_first_year_cost
## [1] 558452722
inspection_in_month <- .05
n_months <- 24
# What is the probability that, after 24 months, you received exactly 2 inspections?
exactly_2 <- dbinom(2, n_months, inspection_in_month)
exactly_2
## [1] 0.2232381
# What is the probability that, after 24 months, you received 2 or more inspections?
two_or_more <- 1 - pbinom(1, n_months, inspection_in_month)
two_or_more
## [1] 0.3391827
# What is the probability that your received fewer than 2 inspections?
fewer_than_2 <- pbinom(1, 24, inspection_in_month)
fewer_than_2
## [1] 0.6608173
# What is the expected number of inspections you should have received?
# E = n*k
expected_number <- n_months * inspection_in_month
expected_number
## [1] 1.2
# What is the standard deviation?
sd_inspection <- sqrt(n_months*inspection_in_month*(1-inspection_in_month))
sd_inspection
## [1] 1.067708
# What is the probability that exactly 3 arrive in one hour?
lambda <- 10 # patients per hour
exactly_3 <- dpois(3, lambda)
exactly_3
## [1] 0.007566655
# What is the probability that more than 10 arrive in one hour?
more_than_10 <- 1 - ppois(10, lambda)
more_than_10
## [1] 0.4169602
# How many would you expect to arrive in 8 hours?
arrive_in_8_hours <- lambda*8
arrive_in_8_hours
## [1] 80
# What is the standard deviation of the appropriate probability distribution?
sd_prob_dist <- sqrt(lambda)
sd_prob_dist
## [1] 3.162278
# 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?
number_of_providers <- 3
patients_per_provider <- 24
total_number_of_patients <- number_of_providers*patients_per_provider
percent_utilization <- (arrive_in_8_hours/total_number_of_patients)*100
percent_utilization
## [1] 111.1111
Based on the high percent utilization, it appears that the family practice providers are operating at or near max capacity when it comes to the amount of patients they are seeing. Possible remedies to lower the percent utilization is opening another practice to alleviate the congestion. Another strategy would be seeing less patients. However, this may not be a good business decision to see less patients, and patients may not have any other options besides these three practice providers. The best option is to open another practice. As you can see, adding a 4th provider would lower the percent utilization:
number_of_providers2 <- 4
patients_per_provider <- 24
total_number_of_patients <- number_of_providers2*patients_per_provider
percent_utilization2 <- (arrive_in_8_hours/total_number_of_patients)*100
percent_utilization2
## [1] 83.33333
# If your subordinate acted innocently, what was the probability he/she would have
# selected five nurses for the trips?
supervisors <- 30
nurses <- 15
non_nurses <- 15
paid_trips <- 6
selected_nurses <- 5
selected_non_nurses <- 1
five_nurses_for_trip <- dhyper(selected_nurses, nurses, non_nurses, paid_trips)
five_nurses_for_trip
## [1] 0.07586207
# How many nurses would we have expected your subordinate to send?
expected_nurses <- (nurses*paid_trips)/(nurses + non_nurses)
expected_nurses
## [1] 3
# How many non-nurses would we have expected your subordinate to send?
expected_non_nurses <- (non_nurses*paid_trips)/(nurses + non_nurses)
expected_non_nurses
## [1] 3
# What is the probability that the driver will be seriously injured during the course of the year?
seriously_injured <- .001
required_hours <- 1200
injured_during_year <- pgeom(1200, .001) # Alternative method: 1 - (1-seriously_injured)^required_hours
injured_during_year
## [1] 0.6992876
# In the course of 15 months?
hours_in_15_months <- 1200 + (1200*.25) # 3 months is .25 of 12 months = 1500 hours
injured_in_15_months <- pgeom(1500, .001) # Alternative Method: 1 - (1-seriously_injured)^hours_in_15_months
injured_in_15_months
## [1] 0.7772602
# What is the expected number of hours that a driver will drive before being seriously injured?
hours_before_injury <- 1/seriously_injured
hours_before_injury
## [1] 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?
injured_in_next_100_hours <- pgeom(1300, .001) - pgeom(1200, .001)
injured_in_next_100_hours
## [1] 0.02863018
# What is the probability that the generator will fail more than twice in 1000 hours?
failure_rate <- .001
generator <- 1000
generator_fail <- 1 - ppois(2, (failure_rate * generator))
generator_fail
## [1] 0.0803014
# What is the expected value?
expected_value <- failure_rate * generator
expected_value
## [1] 1
# What is the probability that this patient will wait more than 10 minutes?
a <- 0
b <- 30
more_than_10_minutes <- punif(10, min = 0, max = 30, lower.tail = FALSE) # Alternative Method: (b-10)/(b-a)
more_than_10_minutes
## [1] 0.6666667
# 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?
another_5_minutes <- punif(15, min = 10, max = 30, lower.tail = FALSE) # Alternative Method: (b-15)/(b-10)
another_5_minutes
## [1] 0.75
# What is the expected waiting time?
expected_wait_time <- (a+b)/2 # a = 0, b = 30
expected_wait_time
## [1] 15
# What is the expected failure time?
lifetime <- 10 # years
expected_failure_time <- 1/lifetime
expected_failure_time
## [1] 0.1
# What is the standard deviation?
sd_mri <- 1/lifetime
sd_mri
## [1] 0.1
# What is the probability that your MRI will fail after 8 years?
mri_fail <- 1 - pexp(8,0.1)
mri_fail
## [1] 0.449329
# Given that you already owned the machine 8 years, what is the probability that it will fail in the next two years?
fail_two_years <- pexp(10, 0.1) - pexp(8,0.1)
fail_two_years
## [1] 0.08144952