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?

Formula for Bayesian probability for the situation when the positive test is actually positive \[P(A1|B)=\frac{P(B|A1)*P(A1)}{(P(B|A1)*P(A1)+P(B|A2)*P(A2))}\] B is when the test is positive
A1 is when there is HIV
A2 is when there is no HIV
P(B|A1)=0.96 the test postive for the case when there is actually HIV
P(A1)=0.001
P(B|A2)=0.02
P(A2)=0.999

B_A1 <- 0.96
A1 <- 0.001
B_A2 <- 0.02 
A2 <- 0.999
A1_B <- B_A1*A1/(B_A1*A1+B_A2*A2)
A1_B 
## [1] 0.04584527

The probability that an individual who is reported as positive by the new test actually has the disease is 4.58%
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?

treat <- 100000
test <- 1000
cases <- 100000
preval <- 0.001
false_pos <- 0.02
sens <- 0.96

2. (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?

The probability is 22.32% using formula \[P(X=2)=C_{2}^{24}*0.05^2*(1-0.05)^{24-2}=\frac{24!}{(24-2)!2!}*0.05^2*(1-0.05)^{24-2}=0.2232\]

months <- 24
probability <- 0.05
inspect <- 2
dbinom(inspect,months,probability)
## [1] 0.2232381

What is the probability that, after 24 months, you received 2 or more inspections?

The chance to get X>2 or X=2 inspections is just we need to find the chance of 0, 1 inspections and subtract it from 1.
The probability is 33.92% using formulas below: \[P(X=0)=C_{0}^{24}*0.05^0*(1-0.05)^{24-0}=\frac{24!}{(24-0)!0!}*0.05^0*(1-0.05)^{24-0}=0.292\] \[P(X=1)=C_{1}^{24}*0.05^1*(1-0.05)^{24-1}=\frac{24!}{(24-1)!1!}*0.05^1*(1-0.05)^{24-1}=0.369\] \[P(X\geq 2)=1 -(P(X=0)+P(X=1))=0.339\]

months <- 24
probability <- 0.05
1-(dbinom(0,months,probability)+dbinom(1,months,probability))
## [1] 0.3391827

What is the probability that your received fewer than 2 inspections?

Using previous calculations below, the probability is 66.08% \[P(X<0)=P(X=0)+P(X=1)=0.292+0.369=0.661\]

(dbinom(0,months,probability)+dbinom(1,months,probability))
## [1] 0.6608173

What is the expected number of inspections you should have received? What is the standard deviation?

Expected number is 1.2, standard deviation is 1.068.

expect <- months*probability
expect
## [1] 1.2
std <- sqrt(probability*months*(1-probability))
std
## [1] 1.067708

3. (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?

The chance of 3 patients is 0.757%. \[P(X=3)=\frac{e^{-\mu}*\mu^X}{X!}=\frac{e^{-10}*10^3}{3!}=0.00757\]

dpois(3,10)
## [1] 0.007566655

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?

The probability is 41.7%, in 8 hours there should be 10*8=80 patients. The standard deviation is 3.16.

1-ppois(10, 10)
## [1] 0.4169602
std <- sqrt(10)
std
## [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?

72 patients can be accepted by 3 provider during the work day. In the previous problem we found that 80 patients can be accepted during 8 hr work day which means they should be able to accept 11.11% more patients (80/72*100%=111.11%). They should hire more people, maybe part-time to accept them.

4. (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?

The chance that he/she would have selected five nurses is 7.59%.
In the formula below:
N=30 - population, k=15 - nurses, n=6 - randomly selected samples, x=5 - nurses out of samples. \[h(x; N, n, k)=\frac{C^k_x( N-C^{N-k}_{n-x})}{NC^N_n}=0.0759\]

sent_nurse <- 5
trips <- 6
nurse <- 15
non_nurse <- 15
dhyper(sent_nurse,nurse,non_nurse,trips,log=FALSE)
## [1] 0.07586207

How many nurses would we have expected your subordinate to send? How many non-nurses would we have expected your subordinate to send?

Since 15 of the subordinate’s workers are nurses and 15 are other than nurses, they should send 3 nurses and 3 non-nurses.

5. (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 15months? 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?

The probability that the driver will be seriously injured during the course of the year is 69.93%. In the course of 15 months, 77.73%. The expected number of hours that a driver will drive before being seriously injured is 999. The probability that he or she will be injured in the next 100 hours is 2.86%
Chance of getting injured per hour is 0.001, 1200 hours in a year. \[P=1-q^{1200}=1-(1-0.001))^{1200}=69.89\] \[Hours=\frac{1-0.001}{0.001}=999\]

injured_1200 <- pgeom(q=1200 ,prob=0.001)
injured_1500 <- pgeom(q=1500 ,prob=0.001)
injured_1200
## [1] 0.6992876
injured_1500
## [1] 0.7772602
injured_1300 <- pgeom(q=1300 ,prob=0.001)
injured_1300 - injured_1200
## [1] 0.02863018

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

Poisson probability. The probability that the generator will fail more than twice in 1000 hours is 8%. Expected value is 1. \[P(X>2)=1-P(0)-P(1)-P(2)=1-0.368-0.368-0.184=0.08\] \[P(X=2)=\frac{e^{-\mu}*\mu^X}{X!}=\frac{e^{-1}*1^2}{2!}=0.184\]

1-ppois(2, 1)
## [1] 0.0803014

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

The probability that this patient will wait more than 10 minutes is 66.67%, the probability that he/she will wait at least another 5 minutes is 75%, the expected waiting time is 15 minutes. Probability for Uniform distribution: \[P=\frac{20}{30-0}=0.667\]

min=0
max=30
1-punif(10, min, max)
## [1] 0.6666667
1-punif(15, min=10, max)
## [1] 0.75
expect <- (min+max)/2
expect
## [1] 15

8. 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 10 years. The standard deviation is also 10 years as it equal to geometric mean of expected value. The probability that your MRI will fail after 8 years is 44.93%. The probability that it will fail in the next two years is 8.14%. Formula for exponential distribution: \[P=e^{-k/\mu}=e^{-8/10}=0.4493\]

exp_time <- 10
time<- 8
1-pexp(8,1/exp_time)
## [1] 0.449329
pexp(10,1/exp_time) - pexp(8,1/exp_time)
## [1] 0.08144952