p_red <- 54/138
p_blue <- 75/138
round(p_red + p_blue, 4)
## [1] 0.9348
p_red = 20 / 80
p_red
## [1] 0.25
What is the probability that a customer is not male or does not live with parents? Write your answer as a fraction or a decimal number rounded to four decimal places.
N.B \(P(A\cup B) = P(A) + P(B) - P(A \cap B)\)
\(P(Not Male) = \frac{228 + 79 + 252 + 97 + 72}{1399} = \frac{728}{1399}\)
\(P(NotwithParents) =\frac{1399 - (215 + 252)}{1399} = \frac{932}{1399}\)
\(P(Not Male \cap NotwithParents) = \frac{215 + 252}{1399} = \frac{467}{1399}\)
Therefore:
\(P(Not Male \cup NotwithParents)\)
nM <- sum(c(228,79, 252, 97, 72))/1399
nwP <- (1399 - (215 + 252)) / 1399
nM_and_nwP <- (215 + 252) / 1399
round(((nM + nwP) - nM_and_nwP), 4)
## [1] 0.8528
Going to the gym. Losing weight.
Answer: Dependent
\[\binom{8}{3} \times \binom{7}{3} \times 3\]
choose(8, 3)* choose(7, 3) * 3
## [1] 5880
Veggie wraps cab me made in 5880 different ways.
Jeff runs out of gas on the way to work. Liz watches the evening news.
Answer: Independent
factorial(14) / factorial(14 - 8)
## [1] 121080960
\[\frac{\binom{9}{0} \times \binom{4}{1} \times \binom{9}{3}}{\binom{22}{7}}\]
round((choose(9, 0) * choose(4, 1) * choose(9, 3)) / choose(22, 4), 4)
## [1] 0.0459
\[\frac{11!}{7!}\]
factorial(11) / factorial(7)
## [1] 7920
complement = (1- 0.67) * 100
cat(complement, "% of subscribers to a fitness magazine are under the age of 34")
## 33 % of subscribers to a fitness magazine are under the age of 34
$97
. If not, you pay me $30
Step 1. Find the expected value of the proposition. Round your answer to two decimal places.
There are two possible outcomes in each toss (\(H\) or \(T\)). The likelihood of observing
\(k=5\) successes \(H\) that occur with probability \(p=0.5\).
If True with 3 exact heads in 4 tosses then the probabaility of this occruing is:
dbinom(x = 3, size = 4, prob = 0.5)
## [1] 0.25
Cost if true:
0.25 * 97
## [1] 24.25
Probability if false:
1 - dbinom(x = 3, size = 4, prob = 0.5)
## [1] 0.75
Cost if false:
0.75 * -30
## [1] -22.5
Expected value:
24.25 + -22.5
## [1] 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.)
cat("$", 559 * 1.75)
## $ 978.25
$23
. Otherwise you pay me $26
.Step 1. Find the expected value of the proposition. Round your answer to two decimal places.
Probability for 4 tails or less:
dbinom(0, size=9, prob=0.5) +
+ dbinom(1, size=9, prob=0.5) +
+ dbinom(2, size=9, prob=0.5) +
+ dbinom(3, size=9, prob=0.5) +
+ dbinom(4, size=9, prob=0.5)
## [1] 0.5
Cost if true:
0.5 * 23
## [1] 11.5
Probability if false, i.e 5 or more:
round(pbinom(size = 9, prob = 0.5, q = 9) - pbinom(size = 9, prob = 0.5, q = 4), 4)
## [1] 0.5
Cost if false:
0.5 * -26
## [1] -13
Expected value:
11.5 + -13
## [1] -1.5
Step 2. If you played this game 994 times how much would you expect to win or lose? (Losses must be entered as negative.)
Loss:
cat("$", 994 * -1.5)
## $ -1491
dl <- 0.59 #detected liar
dt_t <- 0.90 # detected truth teller
al <- 0.20 # actual liar
at_t <- 0.80 # actual truth teller
Using this guide finding the probability \(P(al|dl)\) will be shown as:
round(dl * al / ((at_t * (1 - dt_t)) + (dl * al)), 4)
## [1] 0.596
\(P(at\_t|dt)\)
round(at_t * dt_t / ((at_t * dt_t) + (al * (1 - dl))),4)
## [1] 0.8978
\(P(al \cup dl)\)
round(((1 - dt_t) * at_t) + al ,4)
## [1] 0.28