Probabilities
a test’s ability to designate an individual with disease as positive.
Specificitya test’s ability to designate an individual who does not have a disease as negative.
A new test has a 96% sensitivity and a 98% specific.
Given a .001 prevalence rate, what is the probability that an individual who is reported as positive by the new test actually has the disease?
p_prevalence<-.001
p_sensitivity<-.96
p_specificity<-.98
num<-p_sensitivity * p_prevalence
den<-(p_sensitivity * p_prevalence) + ((1-p_specificity) * (1-p_prevalence))
sprintf("The probability that a person with a positive test result actually has the disease is %.6f ",num/den)## [1] "The probability that a person with a positive test result actually has the disease is 0.045845 "
Given that for every 1000 people only 1 has the disease, the majority of positive results will be from people who are not actually infected.
| Health | Population | Tests Positive |
|---|---|---|
| Infected | 10,000 | 9,600 |
| Not Infected | 9,990,000 | 199,800 |
| ———— | ———– | —————– |
| Total | 10,000,000 | 209,400 |
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?
x=2 # number of successes we want to know the probability of
n=24
p=.05
round(dbinom(x, size=n, prob=p),4)## [1] 0.2232
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?
x=seq(0,1) # number of successes we want to know the probability of
n=24
p=.05
pr<-sum(dbinom(x, size=n, prob=p))
print(paste("The probability of 2 or more is ", round(1-pr,4)))## [1] "The probability of 2 or more is 0.3392"
print(paste("The probability of 1 or less is ", round(pr,4)))## [1] "The probability of 1 or less is 0.6608"
What is the standard deviation?
n*p*(1-p)## [1] 1.14
What is the expected number of inspections you should have received?
n*p## [1] 1.2
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?
round(dpois(x = 3, lambda = 10),4)## [1] 0.0076
round(dbinom(3,10,1),4)## [1] 0
What is the probability that more than 10 arrive in one hour?
round(1 - ppois(q = 10, lambda = 10),4)## [1] 0.417
How many would you expect to arrive in 8 hours?
The expected vaue = the mean = units X lambda so 80
\[\mu \ = \ t * \lambda \]
so 80
What is the standard deviation of the appropriate probability distribution?
\[\sigma \ = \ \sqrt{\mu}\]
so 8.944272
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?
In a 10 hour day I would expect 100 patients.The capacity of the 3 providers is well below that and not sufficient to handle 100 patients.
Your subordinate is accused of favoring nurses.
15 are nurses and 15 are not.
The accuser stated that there were 6 company-paid trips to Disney World.
The supervisor sent 5 nurses and 1 non-nurse.
What was the probability of that ?
N = 30 # (Total Population)
k = 15 # of success in population
m = N-k # of failure in the population
n = 6 # of trials
x = 5 # of successes you are quantifying the probability
round(dhyper(x, m, k, n),4)## [1] 0.0759
How many nurses would we have expected your subordinate to send?
n * (k / (k + m))## [1] 3
\[P(X=x) \ = \ (1-P)^{n-1}P\]
\[P(X \le x) \ = \ 1 - (1 - P^n)\]
\[\sigma \ = \ \sqrt{\frac{1-p}{p^2}}\]
Expected Value ( Mean ) =
\[E(X) \ = \ \frac{1}{p} \]
The probability of being seriously injured in a car crash in an unspecified location is about .1% per hour.
A driver traverses the area for 1200 hours
What is the probability that the driver will be seriously injured?
p=.001
n=1200
round(1 - (1-p)^n,4)## [1] 0.699
In the course of 15 months?
# its 100 hours per months so
n=1500
round(1 - (1-p)^n,4)## [1] 0.777
What is the expected number of hours that a driver will drive before being seriously injured?
1/p## [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?
The phrase “Given” implies that we are not looking for the probability of 1300 hours of no accidents, just 100 hours.
n=100
1 - (1-p)^n## [1] 0.09520785
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?
p_fail<-1 - pbinom(2, 1000, .001)
sprintf("The probability that the generator will fail more than twice is %.2f", p_fail)## [1] "The probability that the generator will fail more than twice is 0.08"
Note: pbinom and ppois are very similar, and return almost the same result (if the rate < 1)
pbinom(2, 1000, .001) ppois(2, lambda=1)
You could also convert the time unit if you think it would improve the distribution.
What is the expected value?
.0001
A surgical patient arrives. The waiting time is uniformly distributed from 0 to 30 minutes.
What is the probability that this patient will wait more than 10 minutes?
# all this is q/(max-min)
1-punif(q=10, min = 0, max = 30)## [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?
# "at least another 5" means 5 or more
1-punif(q=4, min = 0, max = 20)## [1] 0.8
What is the expected waiting time?
The midpoint, so 15 minutes.
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?
\[\lambda \ = \ \frac{1}{E(X)}\]
The expected value is 10 and the rate is .1
What is the standard deviation?
The standard deviation is equal to the mean or Expected Value so .1
What is the probability that your MRI will fail after 8 years?
round(pexp(8,.1),4)## [1] 0.5507
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?
round(pexp(10,.1) - pexp(8,.1),4)## [1] 0.0814