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

\(96\%\) Sensitivity

\(98\%\) Specific

\(.1\%\) prevalence rate

Let \(B=Test+\)

Let \(A_1=HIV+\)

Let \(A_2=HIV-\)

\(P(B|A)=.96\)

\(P(A)= .001\)

\(P(B|A_2)=1-.98=.02\)

\(P(A_2)=1-.001=.999\)

Then we can find the probability that an individual who is reported as positive by the new test actually has the disease as:

\(P(A_1|B)=P(B|A_1)P(A_1)/ \sum_{i} P(B|A_i)P(A_i)\)

P1Ans <- (.96*.001)/((.96*.001)+(.02*.999))
print(P1Ans)
## [1] 0.04584527

\(P(A_1|B) = 0.04584527\)

Then to calculate the total cost calculate the total number of positve test results based on the prevalence rate of .001

Number of positive tests = \(100,000 * .001=100\)

Then, multiply that by the probability of a true positive

Number of True Positives = \(100 * .04584527 \approx 4.58\)

Since the cost to treat a TP is \(\$100,000\) to get the total cost we will need to multiply that by the number of TP

Cost to treat TP = \(\$100,00 * 4.58= \$458,000\)

Then since each test cost \(\$ 1,000\) we will also need to multiply the total number of test administered by \(\$1,000\)

Total cost to administer = \(100,000 * \$1,000= \$100,000,000\)

Therefore the total cost is:

Total Cost = \(\$458,000+\$100,000,000=\$100,458,000\)

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

To calculate all these probabilities use the binomial distribution mass function. \(P(X=x|N,p)=\binom{n}{x}p^x(1-p)^{n-x}\)

So for \(P(X=2) = \binom{24}{2}(.05)^2(1-.05)^{24-2}\)

\(P(X=2) = .02232381\)

x <- 2
n <- 24
p <- .05

pExactly2 = choose(24,2) * (p**2) * (.95**22)
print(pExactly2)
## [1] 0.2232381
print(dbinom(x,n,p))
## [1] 0.2232381

Then for \(P(X>2) = 1- P(X<2)\) so first calculate \(P(X<2) = P(X=0) + P(X=1)\)

\(P(X=0) = \binom{24}{0}(.05)^0(1-.05)^{24-0} = .291989\)

\(P(X=1) = \binom{24}{1}(.05)^1(1-.05)^{24-1} = .3688282\)

Then, \(P(X<2) = .291989 + .3688282 = .6608173\)

So then \(P(X>2) = 1- P(X<2) = 1- .6608173 = .3391827\)

Expected number of inspections = N * p = \(24*.05=1.2\) inspections

Standard deviation = \(\sqrt{n*p*(1-p)}=\sqrt{24*.05*.95}=1.067708\)

pExactly0 <- choose(24,0) * (p**0) * (.95**24)
print(pExactly0)
## [1] 0.291989
print(dbinom(0,n,p))
## [1] 0.291989
pExactly1 <- choose(24,1) * (p**1) * (.95**23)
print(pExactly1)
## [1] 0.3688282
print(dbinom(1,n,p))
## [1] 0.3688282
pLessThan2 <- pExactly0 + pExactly1
print(pLessThan2)
## [1] 0.6608173
pGreaterThan2 <- 1- pLessThan2
print(pGreaterThan2)
## [1] 0.3391827
expectedInspections <- n*p
print(expectedInspections)
## [1] 1.2
standardDeviation <- sqrt(n*p*(1-p))
print(standardDeviation)
## [1] 1.067708

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

To find all the probabilities use the Poisson distribution function: \(P(X=k)=\frac{e^{-\lambda}\lambda^k}{k!}\), k = number of events, and \(\lambda\) is the rate of occurrence

\(P(X=3)=\frac{e^{-10}10^3}{3!}=.007566655\)

Then, to find \(P(X>10)\) we will calculate \(P(X\leq 10)\) and subtract 1

To find \(P(X\leq 10)=P(X=0) + P(X=1)+...+P(X=10)\)

\(P(X\leq10) = \frac{e^{-10}10^0}{0!} + \frac{e^{-10}10^1}{1!} + \frac{e^{-10}10^2}{2!} + \frac{e^{-10}10^3}{3!} + \frac{e^{-10}10^4}{4!} + \frac{e^{-10}10^5}{5!} + \frac{e^{-10}10^6}{6!} + \frac{e^{-10}10^7}{7!} +\frac{e^{-10}10^8}{8!}+\frac{e^{-10}10^9}{9!}+\frac{e^{-10}10^{10}}{10!} = .5830398\)

Then we can get \(P(X>10) = 1- P(X\leq10) = 1- .5830398=.4169602\)

To get the number of patients expected in 8 hours we just multiply \(8*\lambda= 8 * 10 = 80\) patients expected in 8 hours

The standard deviation is = \(\sqrt{\lambda} = \sqrt{10} = 3.162278\)

To find the percent utilization we have 3 family practice providers that can handle 24 patients a day

This means that they can handle \(24*3=72\) patients and we know from the previous question that we expect 80 patients so this means that we have a percent utilization of \((80/72)*100=111.1111\) This means that they are about 11% over utilized so they should hire more staff.

lambda <- 10
pExactly3 <- ((exp(1)**-10) * (10**3))/(factorial(3))
print(pExactly3)
## [1] 0.007566655
print(dpois(3,lambda))
## [1] 0.007566655
pLessThan10 <- ((exp(1)**-10) * (10**0))/(factorial(0)) + ((exp(1)**-10) * (10**1))/(factorial(1)) + ((exp(1)**-10) * (10**2))/(factorial(2)) + ((exp(1)**-10) * (10**3))/(factorial(3)) + ((exp(1)**-10) * (10**4))/(factorial(4)) + ((exp(1)**-10) * (10**5))/(factorial(5)) + ((exp(1)**-10) * (10**6))/(factorial(6)) + ((exp(1)**-10) * (10**7))/(factorial(7)) + ((exp(1)**-10) * (10**8))/(factorial(8)) + ((exp(1)**-10) * (10**9))/(factorial(9)) + ((exp(1)**-10) * (10**10))/(factorial(10))

print(pLessThan10)
## [1] 0.5830398
print(sum(dpois(0:10,lambda)))
## [1] 0.5830398
pGreaterThan10 <- 1 - pLessThan10
print(pGreaterThan10)
## [1] 0.4169602
sD <- sqrt(10)
print(sD)
## [1] 3.162278
percentUt <- 80/72
print(percentUt*100)
## [1] 111.1111

Problem 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? How many nurses would we have expected your subordinate to send? How many non-nurses would we have expected your subordinate to send?

The probability mass function for a hypergeometric variable is \(P(X=k)=\frac{\binom{K}{n} \binom{N-K}{n-k}}{\binom{N}{n}}\)

Here we have:

\(N=30\) (15 Nurses + 15 non nurses)

\(n=6\) (6 Company paid trips to Disney World)

\(K=15\) (15 Nurses)

\(P(X=5) = \frac{\binom{15}{5} \binom{30-15}{6-5}}{\binom{30}{6}}\)

pFiveNurses <- (choose(15,5)*choose(15,1))/(choose(30,6))
print(pFiveNurses)
## [1] 0.07586207
print(dhyper(5,15,15,6))
## [1] 0.07586207

The Expected number of nurses can be calculated using \(E(x)=\frac{n*K}{N}\)

So, the Expected number of nurses would be:

\(\frac{6*15}{30}=3\) nurses

expectedNurses <- (6*15)/(30)
print(expectedNurses)
## [1] 3

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

To calculate the probability of being injured in a car crash in a year use the geometric probability mass function.

\(P(X=k) = (1-p)^{k-1}*p\)

Where k = number of trials until first success, p = probability success on each trial

So, we need to find \(P(X\leq1200)=1-(1-.001)^{1200}=.6989866\)

pAccidentLessThan1200 <- 1-(.999)^1200
print(pAccidentLessThan1200)
## [1] 0.6989866
print(sum(dgeom(1:1200,.001)))
## [1] 0.6982876

To find the probability of being injured in the course of 15 months we need to get the number of hours driven in 15 months

We have \(1200/12=100\) hours per month so for 15 months we have \(15*100 = 1500\) hours

Then, \(P(X\leq1500)=1-(1-.001)^{1500} = .7770372\)

pAccidentLessThan1500 <- (1-(1-.001)^1500)
print(pAccidentLessThan1500)
## [1] 0.7770372
print(sum(dgeom(1:1500,.001)))
## [1] 0.7762602

To find the expected number of hours a driver will drive before being seriously injured can be found using the expected value of a geometric probability mass function: \(E(X)=\frac{1}{p}\)

In our case we have \(p=.001\)

So, \(E(x)=\frac{1}{.001}=1000\) hours

expectedInjury <- 1/.001
print(expectedInjury)
## [1] 1000

To find the probability that the driver will be injured in the next 100 hours given that they have driven 1200 hours can be found by calculating: \(P(X\leq1300)=1-(1-.001)^{100}=.09611265\)

pNext100 <- (1-(1-.001)**100)
print(pNext100)
## [1] 0.09520785
print(sum(dgeom(0:100,.001)))
## [1] 0.09611265

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

We can model this using the Poisson distribution \(P(X=k)=\frac{e^{-\lambda}\lambda^k}{k!}\)

Where \(\lambda=1\), \(n=1000\)

To find the probability the generator fails more than twice is equal to \(P(X>2)=1-P(X\leq2)\)

To find \(P(X\leq2) = P(X=0) + P(X=1) + P(X=2)\)

\(P(X\leq2) = (\frac{e^{-1}(1)^{0}}{0!}) + (\frac{e^{-1}(1)^{1}}{1!}) + (\frac{e^{-1}(1)^{2}}{2!}) = .9196986\)

Then to find \(P(X>2) = 1 - .9196986=.0803014\)

pGenFailLessThanOrEqaul2 <- ((exp(1)^(-1))*(1^0))/(factorial(0)) +  ((exp(1)^(-1))*(1^1))/(factorial(1)) +  ((exp(1)^(-1))*(1^2))/(factorial(2))
print(pGenFailLessThanOrEqaul2)
## [1] 0.9196986
print(sum(dpois(0:2,1)))
## [1] 0.9196986
print(1-pGenFailLessThanOrEqaul2)
## [1] 0.0803014

To find the expected value for the Poisson you just need to find \(E(x) = \lambda=1\)

Therefore the Expected Value is 1

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

Since this is a uniform distribution this means that the the PDF = \(1/30\)

Then to find \(P(X>10) = \frac{30-10}{30}=\frac{20}{30}= \frac{2}{3}\)

pWaitMoreThan10 <- sum(dunif(11:30,0,30))
print(pWaitMoreThan10)
## [1] 0.6666667

Then to find the probability that the patient will wait at least another 5 mins given that they have already waited 10 mins we need to calculate: \(P(x\geq15|x=10)=\frac{30-15}{30-10}=\frac{15}{20}=\frac{3}{4}\)

pWait5More <-sum(dunif(16:30,10,30))/sum(dunif(11:30,10,30))
print(pWait5More)
## [1] 0.75

The Expected Value for a uniform distribution is equal to \(E(x)=\frac{a+b}{2}\)

In our case \(a=0,b=30\)

\(E(x)=\frac{30+0}{2}=15\)

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

The PDF for the exponential distribution is given by: \(f(x|\lambda)=\lambda e^{-\lambda x}\)

The CDF is given by: \(F(x|\lambda)=1-e^{-\lambda x}\)

Where x is a random variable representing the time until the next event (MRI failure)

and \(\lambda\) is the average number of events that occur

The Expected Value and Standard Deviation are both equal to \(\frac{1}{\lambda}\)

So for the MRI machine \(\lambda=1/10\) because the Expected value is 10 and \(E(x)=\frac{1}{\lambda}\) therefore \(\lambda=10\)

The expected failure time is given by \(\frac{1}{\lambda}= \frac{1}{1/10}= 10\)

Since in a exponential distribution the Standard Deviation = the expected value we also get a standard deviation of 10

The probability of failure after 8 years = \(P(x>8)=1-P(x\leq8)\)

\(P(x\leq8) = 1- e^{-8/10}=.550671\)

\(P(x>8)=1- 0.550671=.449329\)

pLessThan8 <- 1 - exp(1)^-.8
print(pLessThan8)
## [1] 0.550671
pGreaterThan8 <- 1- pLessThan8
print(pGreaterThan8)
## [1] 0.449329
print(1-pexp(8,.1))
## [1] 0.449329

For the last part to find the probability of failure in the next two years given that its been owned for 8 years already is given by \(P(8<x \leq 10) = P(x\leq10)-P(x\leq8)\)

\(P(x\leq10)=1-e^{-1}=.6321206\)

\(P(x\leq8)= 1- e^{-8/10}=.550671\)

\(P(8<x \leq 10) = .6321206 - .550671=.08144952\)

pLessThan10 <- 1 - exp(1)^-1
print(pLessThan10)
## [1] 0.6321206
pFailNext2 <- pLessThan10 - pLessThan8
print(pFailNext2)
## [1] 0.08144952