#install.packages("epiR")
library(epiR)
1. 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 0.1% or .001 prevalence rate. Given the prevalence rate, sensitivity, and specificity estimates:
a.)what is the probability that an individual who is reported as positive by the new test actually has the disease?
A: Pt has dz
B: Pt tests positive
P(A) = 0.001
Sensitivity=0.96
Specificity=0.98
Find: P(A|B)= Probability that a pt has a disease given the patient
tests positive
Solution:
P(B) = 1- P(A)
P(B) = 1- 0.001
P(B) = 0.999
TP = Sensitivity * P(A)
TP = 0.96*0.001
TP = 0.00096
FN = P(A) - TP
FN = 0.001-0.00096
FN = 0.0004
TN = Specificity * P(B)
TN = 0.98*0.999
TN = 0.97902
FP = P(B) - TN
FP = 0.999-0.97902
FP = 0.01998
Therefore
P(A|B)=TP / (TP+FP)
P(A|B)=0.00096/(0.00096+0.01998)
P(A|B)= 0.4584
The probability that an indivdiual who is reported positive by the test
actually has the
disease is 4.58% of the sample.
b.) 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?
Total cost of administrations= $1000 * 100,000
patients=100,000,000
Total cost of treating positive cases = $100,000 per positive * (0.001
(prevalence)* 100,000)
= $100,000 * 100
= $10,000,000
The total first-year cost for treating 100,000 individuals is (10,000,000+ $100,000,000)= $110,000,000
2.) (Binomial). 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?
\({24 \choose 2} * 0.05^2 *
(1-0.05^{22})\)
=276 0.05^20.95^22
=2760.00250.3235
=0.2232
b) What is the probability that, after 24 months, you received 2 or more inspections?
P(X≥2)=1−P(X<2)
=1−(P(X=0)+P(X=1))
P(X=1)=\({24 \choose 1} * 0.05^1 *
(1-0.05^{23})\)
=240.05(1-.05^23)
=240.050.3074
=0.3688
P(X=0)=\({24 \choose 0} * 0.05^0 *
(1-0.05^{24})\)
= 11(1-.05^24)
=0.29199
P(X≥2)=1-(0.3688+0.29199)=0.3391
c) What is the probability that your received fewer than 2
inspections?
P(X<2)= 1-P(X≥2)=1-0.3391=0.6609
d) What is the expected number of inspections you should have
received?
24(0.05)= 1.2
e)What is the standard deviation?
\(SD = \sqrt{n \times p \times (1 -
p)}\)
= sqrt (24 (.05)(1-.05))
= sqrt(1.14)=1.0677
3. (Poisson). You are modeling the family practice clinic and notice that patients arrive at a rate of 10 per hour.
a)What is the probability that exactly 3 arrive in one
hour?
\(P(X=k) = \frac{e^{-\lambda}
\lambda^k}{k!}\)
\(P(X=3) = \frac{2.71828^{-10}
10^3}{3!}\)
= 0.00004.541000/321
= 0.04541000/6= 0.007566
b)What is the probability that more than 10 arrive in one
hour?
This would be very lengthy to calculate by hand.
Below is the only one iteration of \({10
\choose 0}\) where k=10.
There would be nine more to calculate.
To save time I calculated in R, with the answer being 0.4169602
\(P(X > 10) = 1 - P(X \leq
10)\)
= 1 - \({10 \choose 0}\frac{e^{-\lambda}
\lambda^k}{k!}\)
= 1 - \({10 \choose 0}\frac{2.71828^{-10}
10^{10}}{10!}\)
= 1- (0.000005399)*10,000,000,000/3,628,800
= 1- (53,990/3,628,800)
= 1- 0.0148782
= 0.9851218
p<-ppois(10, 10)
answer<-1-p
answer
## [1] 0.4169602
c)How many would you expect to arrive in 8
hours?
E(X)=λ×hours
=10*8
=80
d)What is the standard deviation of the appropriate
probability distribution?
SD = \(\sqrt{\lambda}\)
= 3.162
e)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?
Assuming the question means that all three providers see a total of 24
pt per day combined the utilization can be calculated by 80/24 = 3.333
which is 333% which means there are many more appointments 333% more
appointments scheduled than the practice can accommodate for.
I would suggest the practice make less appointments or see more patients per day.
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.
\[ P(X=k) = \frac{{\binom{n}{k} \times \binom{N-K}{n-k}}}{{\binom{N}{n}}} \] a)If your subordinate acted innocently, what was the probability he/she would have selected five nurses for the trips? K Number of events (RN) in the population (all candidates)=15 k Outcome of interest is selecting 5 RN =5 N is the population size=30 n is the number of draws=6
#dhyper(x, m, n, k)
x=5#x,q vector of quantiles representing the number of white balls drawn without replacement
#from #an urn which contains both black and white balls.=5 nurses
m=15#m the number of white balls in the urn.=15 nurses
n=15#n the number of black balls in the urn.=15 non nurses
k=6#k the number of balls drawn from the urn.=6 trips
N=30#total population
#p probability, it must be between 0 and 1.
dhyper(5, 15, 15, 6)
## [1] 0.07586207
b)How many nurses would we have expected your subordinate to
send?
If this question means without replacement before any trip are awarded,
then the total population is 15 nurse and 15 non-nurses. The probabilty
at a nurse is selected is 0.5 for each trip (15/30). Half of 6 trips is
3 trips. One would expect 3 nurses and 3 non-nurses be selected.
answer<-(m/N)*k
answer
## [1] 3
c)How many non-nurses would we have expected your subordinate
to send?
Same answer as above. If this question means Without replacement before
any trip are awarded, then the total population is 15 nurse and 15
non-nurses, so the probabilty at a nurse is selected is 0.5 for each
trip (15/30). Half of 6 trips is 3trips. One would expect 3 nurses and 3
non-nurses be selected.
answer<-(n/N)*k
answer
## [1] 3
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.
a)What is the probability that the driver will be seriously injured during the course of the year?
prob_crash <- .001
answer <- pgeom(1200, prob_crash)
answer
## [1] 0.6992876
b)In the course of 15 months?
Assuming the driver drives 1000hours per month
answer <- pgeom(1500, prob_crash)
answer
## [1] 0.7772602
c)What is the expected number of hours that a driver will drive before being seriously injured?
answer <- 1 / prob_crash
answer
## [1] 1000
d)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 <- 100
# Probability of being injured in the next 100 hours
answer <- pgeom(100,prob_crash)
answer
## [1] 0.09611265
6.)You are working in a hospital that is running off of a primary generator which fails about once in 1000 hours.
a.) What is the probability that the generator will fail more than twice in 1000 hours? More than 2 means 3 or greater
\(lambda\)= 1 k>2 \(P(X > 2) = 1 - P(X \leq 2)\)
#\(P(X=k) = \frac{e^{-\lambda}
\lambda^k}{k!}\)
= 1 - \({2 \choose 0}\frac{e^{-\lambda}
\lambda^k}{k!}\)
= 1 - \({2 \choose 0}\frac{2.71828^{-1}
1^{2}}{2!}\)
p<-ppois(2, 1)
answer<1-p
## [1] FALSE
answer
## [1] 0.09611265
b) What is the expected value?
E(X)=λ×hours
= 1/1000 X 1,000
= 1 per 1000 hours or 1/1000 = 0.001 failures per hour
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.
a.) What is the probability that this patient will wait more
than 10 minutes?
P(x)>10 = 1- 10/30 = 1-0.3333= 0.6666. There is 66.7% that the
patient will wait in excess of 10 minutes.
b.) 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?
P(x)>10+5 | P(x)>10
P(x)> 2/3 = 66.7%
P(x)>10+5 = 1- (5/20) = 75%
c.) What is the expected waiting time?
f(x)= (30+0)/2 = 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.
a)What is the expected failure time?
It is actually stated in the question, 10!
lambda <- 1/10
answer <- 1/lambda
answer
## [1] 10
b)What is the standard deviation?
answer <- 1/lambda
answer
## [1] 10
c)What is the probability that your MRI will fail after 8 years?
answer<- exp(-lambda*8)
answer
## [1] 0.449329
d)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?
answer <- exp(-lambda*2)
answer
## [1] 0.8187308