# The probability that an individual who is reported as positive by the new test actually has the disease is 49.48%.
#A1 = Correct Positive
#A2 = Correct Negative
#B = Positive
A1 <- 0.001
B_A1 <- 0.96
B_A2 <- 0.98
A1_B <- (B_A1*A1)/(B_A1*A1+B_A2*A1)
A1_B
## [1] 0.4948454
# Variables
n <- 100000
positive <- 100000
test <- 1000
prob <- A1_B
# There seems to be some ambiguity
# Assuming that each of the 100,000 individuals have tested positive
# Cost of test
test_cost <- n*test
# Assuming that n=100,000 is the total population
# Total people with positive case
pos_res <- n*prob
# Total cost for positive cases
pos_cost = pos_res*positive
# Total cost
total_cost <- test_cost + pos_cost
total_cost
## [1] 5048453608
n <- 24
x <- 2
p <- 0.05
# probability that, after 24 months, you received exactly 2 inspections
dbinom(x,n,p)
## [1] 0.2232381
# probability that, after 24 months, you received 2 or more inspections
# 1 minus the sum of the probabilities of having 1 or 0 inspections.
1-(dbinom(1,n,p)+dbinom(0,n,p))
## [1] 0.3391827
# probability that your received fewer than 2 inspections
# Sum of the probabilities of having 1 or 0 inspections.
dbinom(1,n,p)+dbinom(0,n,p)
## [1] 0.6608173
# expected number of inspections you should have received
# The expected number of inspections is 24*0.05
n*p
## [1] 1.2
# standard deviation
sqrt(n*(p*(1-p)))
## [1] 1.067708
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?
x <-3
lambda <- 10
#probability that exactly 3 arrive in one hour
dpois(x,lambda)
## [1] 0.007566655
#probability that more than 10 arrive in one hour
p = 0
for (x in range(0:10))
{p = p + dpois(x,10)}
1-p
## [1] 0.8748446
#How many would you expect to arrive in 8 hours?
lambda*8
## [1] 80
#standard deviation of the appropriate probability distribution
sqrt(lambda)
## [1] 3.162278
#percent utilization
80/72*100
## [1] 111.1111
There is over utilization of the services, it would be recommended to increase hours or hire more staff.
#probability he/she would have selected five nurses for the trips
dhyper(5,15,15,6,log=FALSE)
## [1] 0.07586207
# How many nurses would we have expected your subordinate to send
n <- 6*15/30
# How many non-nurses would we have expected your subordinate to send
nn <- n-3
#probability that the driver will be seriously injured during the course of the year
q <- 1200
prob <- 0.001
1-pgeom(q,prob)
## [1] 0.3007124
# In the course of 15 months
q <- 1500
1-pgeom(q, prob)
## [1] 0.2227398
#expected number of hours that a driver will drive before being seriously injured
1/0.001
## [1] 1000
#probability that he or she will be injured in the next 100 hours
pgeom(100, 0.001)
## [1] 0.09611265
# Poisson Distribution
#probability that the generator will fail more than twice in 1000 hours
1-ppois(2,1)
## [1] 0.0803014
#expected value
1
## [1] 1
#Uniform Distribution
#probability that this patient will wait more than 10 minutes
1-punif(10,0,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
(1-punif(15,0,30))/(1 - punif(10,0,30))
## [1] 0.75
#expected waiting time, average waiting time
sum(0,30)/2
## [1] 15
#Exponential Distribution
#expected failure time
10
## [1] 10
#Standard deviation
1/0.1
## [1] 10
#probability that your MRI will fail after 8 years
1-pexp(8,0.1)
## [1] 0.449329
#what is the probability that it will fail in the next two years
pexp(10,.1)-pexp(8,.1)
## [1] 0.08144952