#1. Number of Red Marbles
R = 54
#2. Number of White Marbles
W=9
#3. Number of Blue Marbles.
B=75
# Total Marbles
T = R + W + B
#Probability of R
Pr = R/T
#Probability of W
Pw = W/T
#Probability of B
Pb = B/T
# Probability of P(R or B)
Pr + Pb
## [1] 0.9347826
#1. Number of Green Balls
G = 19
#2. Number of Red Balls
R=20
#3. Number of Blue Balls
B=24
#4. Number of Yellow Balls
Y = 17
# Total Number of Balls
T = G + R + Y + B
#Probability of R
Pr = R/T
Pr
## [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.
Male = c(81,116,215,130,129)
Fem = c(228, 79, 252, 97,72)
Category = c("Apartments","Dorm","With Parents", "Soro-Frat","Other")
# Step 1: Probability that customre is not a male.
sum(Fem)/(sum(Male)+sum(Fem))
## [1] 0.5203717
# Step 2: Conditional Probability that customer does not stay's with Parents
TotWithParents = 215 + 252
TotWithParents/(sum(Male)+sum(Fem))
## [1] 0.3338099
4.Determine if the following events are independent. Going to the gym. Losing weight.
# Ans : These are Independent. Though they seem to be dependent.
# Going to Gym does not gaurantee you that there will be weight loss, because the weight loss could happen just with diet/or some health issue
# Or any other condition depending on the Individual. So They are two independent events.
#1. Number of Vegetables
V = 8
#2. Number of Condiments
C = 7
#1. Number of Tortilla
T = 3
# Since we have 3 Tortilla. We can pick 8 Vegetables.
Combvt = choose(8,3)
# Since we have 3 Tortilla. We can pick 7 Condiments.
Combct = choose(7,3)
# Number of Veggie Wraps Combvt * Combct * T
Nvw = Combvt * Combct * choose(3,1)
Nvw
## [1] 5880
# Since we are talking about two different people we cannot have any correlation between them.
# Hence these 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?
# Number of candidates eligible for position.
Nc = 14
# Number of cabinet position available
Np = 8
# Different Appointments Since Rank Matters, we have to do Permutation. n!/(n-r)!
factorial(Nc)/factorial(Nc-Np)
## [1] 121080960
#1. Number of Red Jellybeans
R = 9
#2. Number of Orange Jellybeans
O=4
#3. Number of Green Jellybeans
G = 9
# Total Number of Jelly Bean
T = G + R + O
# Choosing 3 Greens from 9
chooseG = choose(9,3)
# Choosing 1 Orange from 4
chooseO = choose(4,1)
# choose 0 from 9
chooseR = choose(9,0)
# choose 4 from Total Sample Space
chooseSpace = choose(22,4)
# P = Size of event space/Size of Sample Space
P = (chooseG * chooseO * chooseR)/chooseSpace
P
## [1] 0.04593301
factorial(11)/factorial(7)
## [1] 7920
# Number of Subscribers > 34
Subgrtr34 = 67/100
# We know Subgrtr34 + Sublesseq34 = 1, Since Sum of Complement + Non-Complement = 1
Sublesseq34 = 1 - Subgrtr34
Sublesseq34
## [1] 0.33
# Total Number of Possible Outcomes out of 4 tosses.
# Outcome for one toss = 2
# Therefore the outcome for 4 tosses will be equal to 2 * 2* 2* 2
TotOutcome = 2 * 2* 2 *2
# Out of 4 tosses, we want to see whether 3 heads are in there.
# For that we are getting first all possible combinations of heads outcome
TotalHeadOutcome = choose(4,3)
# Probability of getting 3 heads of four toses.
P = TotalHeadOutcome/TotOutcome
P
## [1] 0.25
# From this we can see there is 25% chance of of Winning 97$ and 75% Chance of ending pay the guy $30
#Step 1: The Expected Value of this is
Ex = (97) * .25 + (-30) * .75
Ex
## [1] 1.75
# Step 2 : If Played 559 times
559 * Ex
## [1] 978.25
# Total Number of Possible Outcomes out of 9 tosses.
# Outcome for one toss = 2
# Therefore the outcome for 9 tosses will be equal to 2^9
TotOutcome = 2^9
# Out of 9 tosses, we want to see how many 4 or less tails are in there.
# For that we are getting first all possible combinations of tails outcome
TotalTailOutcome = choose(9,4) + choose(9,3) + choose(9,2) + choose(9,1)
# Probability of getting 4 or less tails of 9 toses.
P = TotalTailOutcome/TotOutcome
P
## [1] 0.4980469
# From this we can see there is 49% chance of winning $23 or 51% chance of loosing $26
#Step 1: The Expected Value of this is
Ex = (23) * P + (-26) * (1-P)
Ex
## [1] -1.595703
# Step 2 : If Played 994 times
round((994 * Ex),0)
## [1] -1586
#1. The value of Senstivity and Specificity are given as .59 and .90 respectively
# Probability of Folks who lie P(L) = .20
PL = .20
# Probability of Folks who do not lie P(No Lie) = 1-.20 = .80
PNL = .80
# Probability of detecting Liar Senstivity = P(Lie Detect) = .59
PLD = .59
# Probability of Not Detecting Lie P(Not Lie Detect) = 1=.59 = .41
PNLD = .41
# Probability of Telling Truth Specificity P(Truth) = .90
PT = .90
# Probability of Not Telling Truth P(Not Truth) = 1-.90 = .1
PNT = 1-PT
# Q1. Probability a Person is Liar and the test detected same.
PLGivenD = (PLD * PL)/((PL * PLD) + (PNL * PNT))
PLGivenD
## [1] 0.5959596
# Q2. Probability a Person is Truth Teller and test detected same.
TruthTeller = (PT * PNT)/((PL * PNLD) + (PNL * PT))
TruthTeller
## [1] 0.1122195
# Q3. Either a Liar or Test identifier Liar
# P(A U B) = P(A) + P(B) - P(A) and P(B)