1
p_rorb<-(54/(54+9+75))+(75/(54+9+75))
round(p_rorb, 4)
## [1] 0.9348
2
p_r<-20/(19+20+24+17)
round(p_r, 4)
## [1] 0.25
3
sum=81+116+215+130+129+228+79+252+97+72
not_male_p=(228+79+252+97+72)/sum
not_parents_p=(212+252)/sum
round(not_male_p+not_parents_p, 4)
## [1] 0.852
4
#The events are dependent. The more you go to the gym, the faster you lose the weight.
5
choose(8,3) * choose(7,3) * choose(3,1)
## [1] 5880
6
#The fact that Jeff runs out of gas does not affect the events of Liz and vice versa.
#The events are independent
7
permutations <- function(n,k)
{
choose(n,k) * factorial(k)
}
permutations(14, 8)
## [1] 121080960
8
p_n <- choose(9,0)*choose(4,1)*choose(9,3)
p_k <- choose((9+4+9),4)
prob <- p_n/p_k
round(prob, 4)
## [1] 0.0459
9
(11*10*9*8*7*6*5*4*3*2*1)/(7*6*5*4*3*2*1)
## [1] 7920
10
#33% of subscribers to a fitness magazine are under the age of 34
11 part 1
4*0.5^4*(97) + (1+4+6+1)* 0.5^4 * (-30)
## [1] 1.75
11 part 2
win <- pbinom(3, size=4, prob=0.5) - pbinom(2, size=4, prob=0.5)
lose <- 1 - win
w <- win*97
l <- lose*30
round(559*(w-l), 2)
## [1] 978.25
12 part 1
(9*2*7+3*4*7+9*4+9+1)*0.5^9*(23-26)
## [1] -1.5
12 part 2
994*(-1.5)
## [1] -1491
13 a.
p_liar <- 0.2
p_truth <- 0.8
senstivity <- 0.59
specificity <- 0.90
p_detect_liar <- 0.59 * p_liar
p_detect_truth <- 0.90 * p_truth
p_false_detect_liar <- (1-0.59)*p_liar
p_false_detect_truth <- (1-0.9)*p_truth
#a
p_detect_liar /(p_detect_liar + p_false_detect_truth)
## [1] 0.5959596
#b
p_detect_truth / (p_detect_truth + p_false_detect_liar)
## [1] 0.8977556
#c
#p(liar OR detect_liar) = p(liar) + p(detect_liar) - p(liar AND detect_liar)
# = 0.2 + 0.59 - 0.118 = 0.672