Let A be the positive test result
\[ A : \text{Positive test Result} \]
Let B be the HIV vaiants
\[ B_{pos}: \text{Positive for HIV variant} \] \[ B_{neg}: \text{Negative for HIV variant} \]
Therefore,
\[ P( B_{pos} | A) = \frac{P(A|B_{pos}) \cdot P(B_{pos})}{P(A)} \] Simplify above formula:
\[ P( B_{pos} | A) = \frac{P(A|B_{pos}) \cdot P(B_{pos})}{P(A|B_{pos}) \cdot P(B_{pos}) + P(A|B_{neg}) \cdot P(B_{neg}) } \]
$ P(A|B_{pos}) = .96 $, the sensitivity. $ P(A|B_{neg}) = 1 - .98 = .02 $, one minus the specificity. $ P(B_{pos}) = .001 $, the prevalence rate. $ P(B_{neg}) = .1 - .001 = 999 $.
P_B_pos = (.96*.001)/((.96*.001)+(.02*.999))
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?
cost_to_test = 100000 * 1000
expected_positive_cost = .001 * 100000 *100000
total = cost_to_test + expected_positive_cost
print(total)
## [1] 1.1e+08
\[ The \ total \ expected \ cost \ is \begin{equation} \ $ \ 1.1 \ * \ 10^{8} \end{equation}. \]
What is the probability that, after 24 months, you received exactly 2 inspections?
dbinom(x = 2, size = 24, prob = .05)
## [1] 0.2232381
What is the probability that, after 24 months, you received 2 or more inspections?
1 - (dbinom(x = 2, size = 24, prob = .05))
## [1] 0.7767619
What is the probability that your received fewer than 2 inspections?
dbinom(x = 0, size = 24, prob = .05) + dbinom(x = 1, size = 24, prob = .05)
## [1] 0.6608173
What is the expected number of inspections you should have received?
24 * .05
## [1] 1.2
What is the standard deviation?
sqrt(24 * .05 * (1-.05))
## [1] 1.067708
What is the probability that exactly 3 arrive in one hour?
dpois(x = 3, lambda = 10, log = FALSE)
## [1] 0.007566655
What is the probability that more than 10 arrive in one hour?
dpois(x = 10, lambda = 10, log = FALSE)
## [1] 0.12511
How many would you expect to arrive in 8 hours?
8 * 10
## [1] 80
What is the standard deviation of the appropriate probability distribution?
sqrt(10)
## [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?
Since we there are 3 family practices that can see 24 patient which equivalent to 72 patients per day between the 3 family practices, but we are expected to see 80 patients within 8 hours. Therefore, we have more patients to see which is more than what the family practice can handle. 72 slots for patients compare to actually seeing 80 patients mean that there’s 11.1111111 % over utilization. That mean the 3 family practices are seeing 111% of patients per day, my recommendation would be for them to expand by opening a 4th family practice with more staffs, or higher more help for the current 3 practices and open more availability slots to see more patients.
what was the probability he/she would have selected five nurses for the trips?
dhyper(x = 5, m = 15, n = 15, k = 6, log = FALSE)
## [1] 0.07586207
How many nurses would we have expected your subordinate to send?
5 * 15 / 30
## [1] 2.5
How many non-nurses would we have expected your subordinate to send?
6 - ( 5 * 15 / 30)
## [1] 3.5
What is the probability that the driver will be seriously injured during the course of the year?
1 - pgeom(q = 1200, prob = .001,lower.tail = TRUE, log.p = FALSE)
## [1] 0.3007124
What is the probability that the driver will be seriously injured in the course of 15 months?
## number of hours in one month
month = 1200 / 12
print(month)
## [1] 100
## calculating number of hours in 15 months
x = 100 * 15
print(x)
## [1] 1500
In the course of 15 months?
1 - pgeom(q = 1500, prob = .001, lower.tail = TRUE, log.p = FALSE)
## [1] 0.2227398
What is the expected number of hours that a driver will drive before being seriously injured?
1 / .001
## [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?
pgeom(q = 100, prob = .001, lower.tail = TRUE, log.p = FALSE)
## [1] 0.09611265
What is the probability that the generator will fail more than twice in 1000 hours?
1 - ppois(q = 2, lambda = 1, lower.tail = TRUE, log.p = FALSE)
## [1] 0.0803014
What is the expected value?
Ans. The expected value is 1 which the number of times the generator fails within 1000 hours known as lambda.
What is the probability that this patient will wait more than 10 minutes?
when lower tail is TRUE
punif(q = 10, min = 0, max = 30, lower.tail = TRUE, log.p = FALSE)
## [1] 0.3333333
when lower tail is FALSE
punif(q = 10, min = 0, max = 30, lower.tail = FALSE, log.p = FALSE)
## [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?
when lower tail is TRUE
P10 <- punif(q = 10, min = 0, max = 30, lower.tail = TRUE, log.p = FALSE)
P15 <- punif(q = 15, min = 0, max = 30, lower.tail = TRUE, log.p = FALSE)
P15 / P10
## [1] 1.5
When lower tail is FALSE
P10 <- punif(q = 10, min = 0, max = 30, lower.tail = FALSE, log.p = FALSE)
P15 <- punif(q = 15, min = 0, max = 30, lower.tail = FALSE, log.p = FALSE)
P15 / P10
## [1] 0.75
What is the expected waiting time?
Ans. The expected waiting time is the minimum plus the maximum divide 2.
(0 + 30) / 2
## [1] 15
What is the expected failure time?
Ans. The expected failure time is the expected value which is 10.
What is the standard deviation?
Ans. The standard deviation is also 10.
What is the probability that your MRI will fail after 8 years?
When lower tail is TRUE
pexp(q = 8, rate = .1, lower.tail = TRUE, log.p = FALSE)
## [1] 0.550671
When lower tail is FALSE
pexp(q = 8, rate = .1, lower.tail = FALSE, log.p = FALSE)
## [1] 0.449329
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?
(pexp(q = 10,rate = .1, lower.tail = TRUE, log.p = FALSE) - pexp(q = 8, rate = .1, lower.tail = TRUE, log.p = FALSE)) * (pexp(q = 8, rate = .1, lower.tail = FALSE, log.p = FALSE)) / (pexp(q = 8, rate = .1, lower.tail = FALSE, log.p = FALSE))
## [1] 0.08144952