1) A box contains 54 red marbles, 9 white marbles, and 75 blue marbles. If a marble is randomly selected from the box, what is the probability that it is red or blue? Express your answer as a fraction or a decimal number rounded to four decimal places \[ \begin{aligned} P(Red\space or\space White)&= P(Red) + P(White) \\ &=\frac{54}{54+9+75}+\frac{75}{54+9+75} \\ &=\frac{54}{138}+\frac{75}{138} \\ &=0.3913 + 0.5438\\ &=0.9348 \end{aligned} \]

p1<-(54/(54+9+75))+(75/(54+9+75))
round(p1, 4)
## [1] 0.9348

2) You are going to play mini golf. A ball machine that contains 19 green golf balls, 20 red golf balls, 24 blue golf balls, and 17 yellow golf balls, randomly gives you your ball. What is the probability that you end up with a red golf ball? Express your answer as a simplified fraction or a decimal rounded to four decimal places.

\[ \begin{aligned} P(red \space golf \space balls) &= \frac{20}{19+20+24+17} \\ &= \frac{20}{80}\\ &= \frac{1}{4} \end{aligned} \]

p2<-20/(19+20+24+17)
round(p2, 4)
## [1] 0.25

3) A pizza delivery company classifies its customers by gender and location of residence. The research department has gathered data from a random sample of 1399 customers. The data is summarized in the table below.

#Define attributes
Housing <- c("Apartment","Dorm","With Parent(s)","Sorority/Fraternity House","Other")
Males <- c(81,116,215,130,129)
Females <- c(228,79,252,97,72)
df <- data.frame(Housing,Males,Females)
colnames(df) <- c("Housing Type","Males","Females")

#use kable to assemble into similar looking table as in the problem statement
kable(df, format = "pandoc",full_width = F,caption = "Gender and Residence of Customers", position = "left")
Gender and Residence of Customers
Housing Type Males Females
Apartment 81 228
Dorm 116 79
With Parent(s) 215 252
Sorority/Fraternity House 130 97
Other 129 72

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.

I will to use the formula: \(P(A \cup B) = P(A) + P(B) - P(A \cap B)\)

P( not male or does not live their parents)

= P(is female)+P(does not live with parents) - P( female and does not live with parentS) / total customer

We sum down the column in the table and divide by total number of participants.

\[ \begin{aligned} P()&= \frac{228+79+252+97+72}{1399}+\frac{81+116+130+129+228+79+97+72}{1399}-\frac{228+79+97+72}{1399} \\ &= \frac{728}{1399}+\frac{932}{1399}-\frac{476}{1399} \\ &=\frac{1184}{1399}\\ &=0.8463 \end{aligned} \]

sum=81+116+215+130+129+228+79+252+97+72

P_notmale=(228+79+252+97+72)/sum 

P_does_not_live_with_parents=(81+116+130+129+228+79+97+72)/sum

P_female_and_notwithparents=(228+79+97+72)/sum

round(P_notmale+P_does_not_live_with_parents-P_female_and_notwithparents, 4)
## [1] 0.8463

4) Determine if the following events are independent.

Going to the gym and Losing weight.

Going to the gym is Fitness activity which is correlated with a weight (I assume that people who going gym are doing some sort of exercise)

5) A veggie wrap at City Subs is composed of 3 different vegetables and 3 different condiments wrapped up in a tortilla. If there are 8 vegetables, 7 condiments, and 3 types of tortilla available, how many different veggie wraps can be made? \[ \begin{aligned} total &= {}_8C_3 + {}_7C_3 + {}_3C_1 \\ &=\frac{8!}{5!.3!} + \frac{7!}{4!.3!} + \frac{3!}{2!.1!} \\ &=\frac {8.7.6}{3!}+\frac {7.6.5}{3!} +\frac{3}{1}\\ &=5880 \end{aligned} \]

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

6) Determine if the following events are independent.

Jeff runs out of gas on the way to work. Liz watches the evening news. Answer: A) Dependent B) Independent

These events are independent.

7)The newly elected president needs to decide the remaining 8 spots available in the cabinet he/she is appointing. If there are 14 eligible candidates for these positions (where rank matters), how many different ways can the members of the cabinet be appointed?

This is a case of permutation since order matters There is no function for permutations so lets make a simple one

# The permutation of 14 people taking 8 at a time is:
permutations14_8 <- factorial(14)/factorial(6)

There are 1.210809610^{8} ways that the members of the cabinet can be appointed.

8) A bag contains 9 red, 4 orange, and 9 green jellybeans. What is the probability of reaching into the bag and randomly withdrawing 4 jellybeans such that the number of red ones is 0, the number of orange ones is 1, and the number of green ones is 3? Write your answer as a fraction or a decimal number rounded to four decimal places

P(0 red, 1 oranges and 3 green) = 9C0 x 4C1 x 9C3 / 22C4 = 0.0459

permutations8_n<-choose(9,0)*choose(4,1)*choose(9,3)
permutations8_k<-choose((9+4+9),4)
permutations8<-permutations8_n/permutations8_k
round(permutations8, 4)
## [1] 0.0459

9) Evaluate he following expression. \(\frac{11!}{7!}\)

\[ \frac{11!}{7!}=\frac{11\cdot10\cdot9\cdot8\cdot7!}{7!}=11\cdot10\cdot9\cdot8=7920 \]

11*10*9*8
## [1] 7920

10) Describe the complement of the given event. 67% of subscribers to a fitness magazine are over the age of 34

The complement is 33% of subscribers to a fitness magazine are 37 years old or younger

11) If you throw exactly three heads in four tosses of a coin you win $97. If not, you pay me $30. Step 1. Find the expected value of the proposition. Round your answer to two decimal places.

P <- round(((1/4)*97 - (3/4)*30),2)
P
## [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.)

round(559*(P), 2)
## [1] 978.25

12) Flip a coin 9 times. If you get 4 tails or less, I will pay you $23. Otherwise you pay me $26.

Step 1. Find the expected value of the proposition. Round your answer to two decimal places. The probability of getting a tail on one toss p = 0.5

Number of tosses n = 9 Using Binomial tables, P(X <= 4) = 0.5

Expected value = (23 * 0.5) - (26 * 0.5) = -$1.5

b_v = pbinom(4, size=9, prob=0.5) #  n = 9, x<=4, and  p at 0.5
P_12<- (23*b_v)-(26*b_v)
P_12
## [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.)

994 * (P_12)
## [1] -1491

13)The sensitivity and specificity of the polygraph has been a subject of study and debate for years. A 2001 study of the use of polygraph for screening purposes suggested that the probability of detecting a liar was .59 (sensitivity) and that the probability of detecting a “truth teller” was .90 (specificity). We estimate that about 20% of individuals selected for the screening polygraph will lie.

Lets collect our givens within variables

Liar <- 0.2
Truth <- 0.8
senstivity <- 0.59
specificity <- 0.90

detected_liar <- senstivity * Liar
detected_truth <- specificity * Truth
false_detect_liar <- (1-senstivity)*Liar
false_detect_truth <- (1-specificity)*Truth
  1. What is the probability that an individual is actually a liar given that the polygraph detected him/her as such? (Show me the table or the formulaic solution or both.) L = Liar AND DL = Detected Liar \[ \begin{aligned} P(L|DL) &= \frac {P(DL \cap L)}{P(DL)} \\ &= \frac {P(DL|L)P(L)}{( P(DL|L)P(L) + P(DL|L`)P(L`) )} \\ &=\frac{0.59*0.2}{0.59*0.2 + 0.1 *0.8} \\ &=0.596 \end{aligned} \]
detected_liar/(detected_liar + false_detect_truth)
## [1] 0.5959596
  1. What is the probability that an individual is actually a truth-teller given that the polygraph detected him/her as such? (Show me the table or the formulaic solution or both.)
detected_truth / (detected_truth + false_detect_liar)
## [1] 0.8977556
  1. What is the probability that a randomly selected individual is either a liar or was identified as a liar by the polygraph? Be sure to write the probability statement.

We should consider use of inclusion exclusion formula

\[ P(liar\bigcup { detect\_ liar)=P(liar)+P(detect\_ liar)-P(liar\bigcap { detect\_ liar)}} \\ =0.2+0.59-0.118\\ =0.672 \]