#Event B=Positive test
#Event A1=Actual HIV pt
#Event A2=Actual non-HIV
#Seeking P(A1 | B)
#USE Bayes
#P(A1 | B) =
#P (B|A1)P(A1) / P(B|A1)P(A1)+P(B|A2)P(A2)
#P(B|A1)=.96
#P(B|A2)=1-.98=.02
#P(A1)=.001
#P(A2)=.999
#(.96*.001)/((.96*.001)+(.02*.999))
B_A1 <- 0.96
A1 <- 0.001
B_A2 <- 0.02
A2 <- 0.999
A1_B <- B_A1*A1/(B_A1*A1+B_A2*A2)
A1_B
## [1] 0.04584527
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?
Pt<-100000*.001
Cost_test<-1000*100000
Cost_Pt<-Pt*100000
TotalCost<-Cost_test+Cost_Pt
TotalCost
## [1] 1.1e+08
size <- 24
prob <-0.05
i<-2
p1 <- dbinom(i,size,prob)
p1
## [1] 0.2232381
What is the probability that, after 24 months, you received 2 or more inspections?
# 1- (P(1) +P(0))
p2 <- 1- (dbinom(1,size,prob) + dbinom(0,size,prob))
p2
## [1] 0.3391827
What is the probability that your received fewer than 2 inspections?
p3 <- dbinom(1,size,prob) + dbinom(0,size,prob)
p3
## [1] 0.6608173
What is the expected number of inspections you should have received?
size <- 24
prob <- 0.05
ai <- 1 - 0.05
p4 <- size*prob*ai
p4
## [1] 1.14
What is the standard deviation?
sd <- sqrt(size*prob*(1-prob))
sd
## [1] 1.067708
p3 <- dpois(3,10)
p3
## [1] 0.007566655
What is the probability that more than 10 arrive in one hour?
p_greater_10 <- 1-ppois(10,10)
p_greater_10
## [1] 0.4169602
How many would you expect to arrive in 8 hours?
per_hour <- 10
8*per_hour
## [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? I would recommend to either hire more staff or increase working hours.
# 3x24=72 patients seen in 8 hours
# From above result we can expect 80 to arrive in a day
# utilization percent
80/72*100
## [1] 111.1111
x<-5
m<-15
n<-15
k<-6
dhyper(x,m,n,k,log=FALSE)
## [1] 0.07586207
How many nurses would we have expected your subordinate to send?
# E(X)=KM/N expected number of nurses
6*15/30
## [1] 3
How many non-nurses would we have expected your subordinate to send?
#Expected number of nurse=3 so Expected number of #non-nurses k-E(X)
6-3
## [1] 3
pgeom(1200, .001)
## [1] 0.6992876
In the course of 15 months?
pgeom(1500, .001)
## [1] 0.7772602
What is the expected number of hours that a driver will drive before being seriously injured?
#E[X]=1/p
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(100, 0.001)
## [1] 0.09611265
1-ppois(2,1)
## [1] 0.0803014
What is the expected value?
#E[X]=lamda =1
1
## [1] 1
q <- 10
min <- 0
max <- 30
1- punif(q,min,max)
## [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?
PA<-1-punif(15,10,30)
PB<-1-punif(10,10,30)
PA/PB
## [1] 0.75
What is the expected waiting time?
1/2*(0+30)
## [1] 15
#E(x)=10 is given
What is the standard deviation?
#1/lambda=10 so lamda=
lambda<-1/10
#Std dev= Var(Lambda^2)^.5=lambda
lambda
## [1] 0.1
What is the probability that your MRI will fail after 8 years?
1-pexp(8,.1)
## [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?
1-pexp(2,.1)
## [1] 0.8187308