Set of Probability Problems

  1. 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?

This problem sounds like one I did in high school. It was like this…What is the chance to get a 6 when rolling a dice one time? Answer: P = 1/6, What is the probability to a 6 after rolling the same dice 10 times? to get three 6 after rolling a dice 10 times? This problem become a Bernoulli process.

The probability for the generator to fail one time over 1000 hours is P = 1/1000.

The probability for the generator to fail two times over 1000 hours is : success is p = 1/1000, q = 1-p, n = 1000, x = 2

\[ P(X = x) = \quad \dbinom{n}{x} p^2 q^{n-x} \]

p = 0
p <- round((1 - (pbinom (2, size = 1000, prob = 0.001))), 4)
cat("\n What is the probability that the generator will fail more than twice in 1000 hours?\n Answer:", p)
## 
##  What is the probability that the generator will fail more than twice in 1000 hours?
##  Answer: 0.0802
## dbinom (0, size = 1000, prob = 0.001)
# 0.001*100 + 0.999*500

What is the expected value? the expected value is calculated by multiplying each of the possible outcomes by the likelihood (L(k) ) each outcome will occur and then summing all of those values.

\[ Expected \quad Value (EV) = \sum_{k=1}^N P(k).L(k)\] We could say since the probability for the generator to fail one time over 1000 hours is P = 1/1000 or 0.1% for no fail is 1-0.1 = 99% if we were to assume financial loss due to generator failure is $100k and win \(500k, then EV = 0.001*100 + 0.999*500 = 499.6k\) , ratio EV/perfect situation= 499.6/500 = 99.92%, nearly 100%. so for more than 2 times meaning from 3 till 1000…that is 997 times…so EV = 499.6k*997 = 498,101.2k…hummm I am not sure… If we were to take discrete random event , then we would have to find the probability for each event since events aren’t equal…this sounds more like Poisson distribution \[ P(X=k)= \frac{λ^k e^{−λ}}{k!} \]

# 1 fail per 1000 hrs, lambda = 1
#dpois(1, lambda = 1)
# surprisely , I get the same result
#1- sum(dpois(0:2, lambda = 1))
#1- ppois(2,lambda = 1)
p <- ppois(2, lambda = 1, lower.tail = FALSE)
cat("\nWhat is the probability that the generator will fail more than twice in 1000 hours?\nAnswer: ", p)
## 
## What is the probability that the generator will fail more than twice in 1000 hours?
## Answer:  0.0803014
# Expected value (EV)
EV = 0
for (i in 1:11){
  EV <- EV + i*dpois(i, lambda = 1)
} 
cat ("\nExpected value is ", EV)
## 
## Expected value is  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?

What is the probability that this patient will wait more than 10 minutes? This is close to poisson but the event are uniformly distributed…So, this can be as simple as saying patient could wait 2/3 of the max waiting time which is 20…so P = 20/30 = 0.667

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? This is to say the patient would spend 25 min expected…So, P = 25/30 = 0.8333

What is the expected waiting time? (30+0)/2 = 15 min

  1. 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?

\[ P(X=k)= λe^{−λk}, where \quad k > 0 \quad and \quad P(X=x) = 0\quad as \quad otherwise, \quad EX \quad or \quad \\EV = expected \quad value = \frac{1}{λ}\\ Var(X) = EX^2 - (EX)^2 = \frac{1}{λ^2} \\ SD = \sqrt{Var(X)} \] lambda = 1/10, EV = 1 What is the expected failure time? The expected failure time is 10.

What is the standard deviation? The standard deviation is 10.

cat("\nWhat is the probability that your MRI will fail after 8 years?")
## 
## What is the probability that your MRI will fail after 8 years?
cat("\n The probability that your MRI will fail after 8 years is ", round((1-pexp(8, 0.1)), 4))
## 
##  The probability that your MRI will fail after 8 years is  0.4493
cat("\n Given that you already owned the machine 8 years, what is the probability that it will fail in the next two years?")
## 
##  Given that you already owned the machine 8 years, what is the probability that it will fail in the next two years?
cat("\n The probability that it will fail in the next two years is", round(pexp(2, 0.1), 4))
## 
##  The probability that it will fail in the next two years is 0.1813
  1. (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?
cat("\nThe probability that the driver will be seriously injured during the course of the year is ", round( (1-(1-0.001)^1200) , 4))
## 
## The probability that the driver will be seriously injured during the course of the year is  0.699
cat("\nIn the course of 15 months is ", round((1-(1-0.001)^1500), 4) )
## 
## In the course of 15 months is  0.777
cat("\nWhat is the expected number of hours that a driver will drive before being seriously injured?\n Answer : ", 1/0.001)
## 
## What is the expected number of hours that a driver will drive before being seriously injured?
##  Answer :  1000
cat("\nwhat is the probability that he or she will be injured in the next 100 hours? \n Answer: ", round(pgeom(100, 0.001), 4))
## 
## what is the probability that he or she will be injured in the next 100 hours? 
##  Answer:  0.0961
  1. (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?
cat("\n what was the probability he/she would have selected five nurses for the trips?\n Answer: ", round(phyper(4,15,15,6), 4))
## 
##  what was the probability he/she would have selected five nurses for the trips?
##  Answer:  0.9157
cat("\nHow many nurses would we have expected your subordinate to send?\n Answer: ", (15*6)/(30))
## 
## How many nurses would we have expected your subordinate to send?
##  Answer:  3
cat("\nHow many non-nurses would we have expected your subordinate to send?\n Answer", (15*6)/30 )
## 
## How many non-nurses would we have expected your subordinate to send?
##  Answer 3
  1. (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?

This is the Bernouli

\[ EV = (np) (p +(1 – p))n – 1 = np \\ Var = n * P * ( 1 - P ) = EV(1-p) \\ SD = \sqrt{Var} = \sqrt{EV(1-p)}\]

cat("\nWhat is the probability that, after 24 months, you received exactly 2 inspections?\n Answer", round(dbinom(2, 24, 0.05), 4) )
## 
## What is the probability that, after 24 months, you received exactly 2 inspections?
##  Answer 0.2232
cat("\nWhat is the probability that, after 24 months, you received 2 or more inspections? \nAnswer", 1- sum(dbinom(0:1, 24, 0.05)))
## 
## What is the probability that, after 24 months, you received 2 or more inspections? 
## Answer 0.3391827
cat("\nWhat is the probability that your received fewer than 2 inspections? \n Answer: ", sum(dbinom(0:1, 24, 0.05)))
## 
## What is the probability that your received fewer than 2 inspections? 
##  Answer:  0.6608173
cat("\nWhat is the expected number of inspections you should have received?\nAnswer: ", 24*0.05)
## 
## What is the expected number of inspections you should have received?
## Answer:  1.2
cat("\nWhat is the standard deviation?\n Answer: " , round(sqrt(24*0.05*(1-0.05)), 4))
## 
## What is the standard deviation?
##  Answer:  1.0677
  1. (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?
cat("\n What is the probability that exactly 3 arrive in one hour? \n Answer:", round((exp(-10)*10^3)/factorial(3),4))
## 
##  What is the probability that exactly 3 arrive in one hour? 
##  Answer: 0.0076
cat("\nWhat is the probability that more than 10 arrive in one hour?\nAnswer:", round((1- sum(dpois(0:10, 10))),4))
## 
## What is the probability that more than 10 arrive in one hour?
## Answer: 0.417
cat("\nHow many would you expect to arrive in 8 hours?\n Answer: Expected value , EV = 10, so in 8hrs we can expect 8x10 =80 patients to arrive")
## 
## How many would you expect to arrive in 8 hours?
##  Answer: Expected value , EV = 10, so in 8hrs we can expect 8x10 =80 patients to arrive
cat("\nWhat is the standard deviation of the appropriate probability distribution?\n Answer: ", sqrt(10))
## 
## What is the standard deviation of the appropriate probability distribution?
##  Answer:  3.162278
cat ("\nIf there are three family practice providers that can see 24 templated patients each day, what is the percent utilization and what are your recommendations?\n Answer: total 24*3=72 patients in 24hr , now how many hours the clinic is open per 24hrs. Let's assume the 8hrs, the expected number of patients is 10 in 1hr . Thus , we have 72/80 = 0.9 or 90%. My recommendation is that there are about 8 patients not being seen at the clinic. Maybe, the clinic can make the pre-screening process a little faster or why not having nurse finish the pre-screening" )
## 
## 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?
##  Answer: total 24*3=72 patients in 24hr , now how many hours the clinic is open per 24hrs. Let's assume the 8hrs, the expected number of patients is 10 in 1hr . Thus , we have 72/80 = 0.9 or 90%. My recommendation is that there are about 8 patients not being seen at the clinic. Maybe, the clinic can make the pre-screening process a little faster or why not having nurse finish the pre-screening
  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?

negative HIV is 98% of x people with no disease tested positive HIV is 96% of x people with disease tested prevalence rate is 0.1% or 0.001

\[ P(disease|Positive) = \frac{P(Positive|disease)P(disease)}{P(Positive)} \\P(disease|Positive) = \frac{P(Positive|disease)P(disease)}{P(Positive|disease)P(disease)+P(Positive|No-disease)P(No-disease)} \]

cat("\nwhat is the probability that an individual who is reported as positive by the new test actually has the disease?\nAnswer: ", round((0.96*0.001)/(0.98*0.001 + 0.96*0.001), 4))
## 
## what is the probability that an individual who is reported as positive by the new test actually has the disease?
## Answer:  0.4948
cat("\n")
cat("\nIf 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?\nAnswer: I know little about financial estimation...I want to say on the 100k people, the prevalence says only 1% will be conductive, 100k*0.001 = 100, on which 0.96*100 = 96 can be positive HIV with Disease, so treating cost = 96x1000X100k = 9600million dollar...I am shocked by the number")
## 
## 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?
## Answer: I know little about financial estimation...I want to say on the 100k people, the prevalence says only 1% will be conductive, 100k*0.001 = 100, on which 0.96*100 = 96 can be positive HIV with Disease, so treating cost = 96x1000X100k = 9600million dollar...I am shocked by the number