Problem 1

\(p(marble\quad in\quad \{ red,\quad blue\} )\quad =\quad \frac { red\quad +\quad blue }{ total }\)
\(=\frac { 54+75 }{ 54+75+9 }\)
=0.9348

Problem 2

\(p(ball\quad =\quad red)\quad =\quad \frac { red }{ total }\)
\(=\quad \frac { 20 }{ 19+20+24+17 }\)
=0.25

Problem 3

\(p(not\quad male\cup not\quad w/parents)\quad =\quad 1-p(male\cap lives\quad with\quad parents)\)
\(=1-\frac { 215 }{ 1399 }\)
=0.8463

Problem 4

\(p(weight\quad loss\quad |\quad gym)\quad \neq \quad p(weight\quad loss)\quad\)
Going to the gym and losing weight are: A) Dependent

Problem 5

Since order doesn’t matter, we use combinations:

\(\begin{pmatrix} 8 \\ 3 \end{pmatrix}*\begin{pmatrix} 7 \\ 3 \end{pmatrix}*\begin{pmatrix} 3 \\ 1 \end{pmatrix}\)

choose(8,3)*choose(7,3)*3
## [1] 5880

Problem 6

\(p(out\quad of\quad gass\quad |\quad news)\quad =\quad p(out\quad of\quad gass)\)
B) Independent

Problem 7

Since order matters, we use the permutation formula:

factorial(14)/factorial(6)
## [1] 121080960

Problem 8

Being a former poker player, I’d look at the each 4 jellybean combination like a poker hand, the probabililty of a given hand is: \(p(hand)\quad =\quad \frac { combinations\quad of\quad hand }{ total\quad hand\quad combinations }\)

total_hands <- choose(22,4)

orange_1 <- choose(4,1)
green_3 <- choose(9,3)

p_hand <- (orange_1*green_3)/total_hands

round(p_hand, 4)
## [1] 0.0459

You could also take each draw one at a time and multiply by the total permutations of the ordering of those draws: ;

round(((9*8*7*4)/(22*21*20*19))*4,4)
## [1] 0.0459

problem 9

factorial(11)/factorial(7)
## [1] 7920

Problem 10

33% of subscribers are age 34 or less.

Problem 11

library(ggplot2)
#Step 1
heads3 <- choose(4,3)*.5**4
ev <- heads3 * 97 + (1-heads3)*-30

ev
## [1] 1.75
#step 2
559*ev
## [1] 978.25
#Bootstrapped
samples <- sample(c( 97, -30), replace = T, prob = c(heads3, 1-heads3), size = 1000000*559)
dim (samples) <- c(1000000, 559)
sums <- apply(samples, 1, sum)
df <- data.frame(winnings = (sums))
ggplot(df) + geom_histogram(aes(x = winnings), fill = 'darkblue', color = 'black')

Problem 12

#Step 1
#Use the cdf instead of the pmf.
tails4 <- pbinom(4, size = 9, prob = .5)
ev <- tails4 * 23 + (1-tails4)*-26

ev
## [1] -1.5
#step 2
994*ev
## [1] -1491
#Bootstrapped
samples <- sample(c( 23, -26), replace = T, prob = c(tails4, 1-tails4), size = 300000*994)
dim (samples) <- c(300000, 994)
sums <- apply(samples, 1, sum)
df <- data.frame(winnings = (sums))
ggplot(df) + geom_histogram(aes(x = winnings), fill = 'darkgreen', color = 'black')

Problem 13

A)

\(p(liar\quad |\quad poly\quad liar)\quad =\quad \frac { p(poly\quad liar\quad |\quad liar)*p(liar) }{ p(poly\quad liar) }\)
\(p(liar\quad |\quad poly\quad liar)\quad =\quad \frac { .59*.2 }{ .59*.2+.41*.8 }\)

round((.59*.2)/(.59*.2 + .41*.8),4)
## [1] 0.2646

B)

\(p(tt\quad |\quad poly\quad tt)\quad =\quad \frac { p(poly\quad tt\quad |\quad tt)\quad *p(tt) }{ p(poly\quad tt) }\)
\(p(tt\quad |\quad poly\quad tt)\quad =\quad \frac { .9*.8 }{ \quad .9*.8+.1*.2 }\)

round(.72/(.72+.02),4)
## [1] 0.973

C)

\(p(liar\cup poly\quad liar)\quad =\quad p(false\quad positive)\quad +\quad p(liar)\)
\(=\quad (1-sensitivity)*p(tt)\quad +\quad p(liar)\)
\(=\quad (1-.59)*.8\quad +\quad .2\)

(1-.59)*.8 + .2
## [1] 0.528