t <- 54+9+75
p_red <- 54/t
p_blue <- 75/t
round(p_red+p_blue,4)
## [1] 0.9348
t <- 19+20+24+17
p_red <- 20/t
round(p_red,4)
## [1] 0.25
t <- 81 + 116 + 215 + 130 + 129 + 228 + 79 + 252 + 97 + 72
round(1 - (215/t),4)
## [1] 0.8463
Going to the gym. Losing weight.
Going to the gym and Losing weight is A. Dependent events.
veggies <- choose(8,3)
condiments <- choose(7,3)
tortilla <- choose(3,1)
wraps <- veggies*condiments*tortilla
wraps
## [1] 5880
Jeff runs out of gas on the way to work. Liz watches the evening news.
Jeff runs out of gas on the way to work and Liz watches the evening news are B. Independent events.
t <- factorial(14) / factorial(14-8)
t
## [1] 121080960
jelly_red <- choose(9,0)
jelly_orange <- choose(4,1)
jelly_green <- choose(9,3)
jelly_total <- choose(22,4)
jelly_prob <- ((jelly_green*jelly_orange*jelly_red)/jelly_total)
jelly_prob
## [1] 0.04593301
a <- factorial(11)/factorial(7)
a
## [1] 7920
67% of subscribers to a fitness magazine are over the age of 34.
Complement: 33% of subscribers are 34 or younger.
Step 1. Find the expected value of the proposition. Round your answer to two decimal places
heads <- pbinom(3, 4, 0.5) - pbinom(2, 4, 0.5)
paste("Probabilty of 3 heads is",heads)
## [1] "Probabilty of 3 heads is 0.25"
EV <- (97*heads) - (30*(1-heads))
paste("Expected value is",round(EV,2))
## [1] "Expected value is 1.75"
Step 2. If you played this game 559 times how much would you expect to win or lose? (Losses must be entered as negative.)
Expected_Win <- 559*EV
paste("If I play 559 times I can expect to win",Expected_Win)
## [1] "If I play 559 times I can expect to win 978.25"
Step 1. Find the expected value of the proposition. Round your answer to two decimal places.
tails <- pbinom(4, 9, 0.5)
paste("Probabilty of 4 tails or less is",tails)
## [1] "Probabilty of 4 tails or less is 0.5"
EV2 <- (23*tails) - (26*(1-tails))
paste("Expected value is",round(EV2,2))
## [1] "Expected value is -1.5"
Step 2. If you played this game 994 times how much would you expect to win or lose? (Losses must be entered asnegative.)
Expected_Win2 <- 994*EV2
paste("If I play 994 times I can expect to lose",abs(round(Expected_Win2,4)))
## [1] "If I play 994 times I can expect to lose 1491"
probabilty of liar given that the polygraph detected
P(liar | positive test) / P(liar | positive test) + P(truth | positive test)
p_liar <- .2
p_truth <- .8
p_sensitivity<- .59
p_specificity <- .9
#probabilty of liar given that the polygraph detected
#P(liar | positive test) / P(liar | positive test) + P(truth | positive test)
p_liar_sensitivity <- (p_liar*p_sensitivity) / ((p_liar*p_sensitivity) + (p_truth*(1-p_specificity)))
paste("The probabilty that an individual is a liar given that the polygraph detected is",round(p_liar_sensitivity,4))
## [1] "The probabilty that an individual is a liar given that the polygraph detected is 0.596"
probabilty of truth teller given that the polygraph detected
P(truth | negative test) / P(truth | negative test) + P(liar | negative test)
p_liar_sensitivity <- (p_truth*p_specificity) / ((p_truth*p_specificity) + (p_liar*(1-p_sensitivity)))
paste("The probabilty that an individual is a truth-teller given that the polygraph detected is",round(p_liar_sensitivity,4))
## [1] "The probabilty that an individual is a truth-teller given that the polygraph detected is 0.8978"
probability that someone was a liar or detected as one by the polygraph
P(liar) + P(truth | positive test )
paste("probability that someone was a liar or detected as one by the polygraph is",p_liar +((1 - p_specificity)*p_truth))
## [1] "probability that someone was a liar or detected as one by the polygraph is 0.28"