October 2nd, 2019
We divide the number of red and blue marbles by the total number of marbles in the box.
round((54+75)/(54+9+75),4)
## [1] 0.9348
We divide the number of red golf balls by the total number of balls in the machine.
round(20/(19+20+24+17),4)
## [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.
#Probability that a customer is not male
pnotm <- (228+79+252+97+72)/1399
#Probability that a customer does not live with parents
pnotlwp <- (81+228+116+79+130+97+129+72)/1399
#Probability that a customer is not male and does not live with parents
pnotmnotlwp <- (228+79+97+72)/1399
#probability that a customer is not male or does not live with parents?
round(pnotm+pnotlwp-pnotmnotlwp,4)
## [1] 0.8463
Going to the gym. Losing weight.
Answer: A) Dependent
Since it is a known fact that exercise helps with weightloss it is apparent that going to the gym increases the probability of losing weight - so these 2 events are not independent.
choose(8,3) * choose (7,3) * choose(3,1)
## [1] 5880
It seems like the 2 event are likely independent since they are unrelated events, happening to different people are different times of the day.
factorial(14)/factorial(14-8)
## [1] 121080960
round((choose(9,0) * choose(4,1) * choose(9,3))/choose(22,4),4)
## [1] 0.0459
#Option 1
factorial(11)/factorial(7)
## [1] 7920
#Option 2
11*10*9*8
## [1] 7920
Answer: 33% of subscribers to a fitness magazine are under the age of 34.
Step 1. Find the expected value of the proposition. Round your answer to two decimal places.
#Calculation probability (method 1)
p<-choose(4,3)*((1/2)^3)*((1/2)^1)
#Calculating probability (method 2)
p<-dbinom(3,4,1/2)
#Calulating Expected Value of the proposition
EV<-97*p-30*(1-p)
round(EV,2)
## [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.)
EV*559
## [1] 978.25
Step 1. Find the expected value of the proposition. Round your answer to two decimal places.
#Calculating probability
p<-pbinom(4,9,1/2)
#Calulating Expected Value of the proposition
EV<-23*p-26*(1-p)
round(EV,2)
## [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.)
EV*994
## [1] -1491
#Constructing the table
a <- c('Result', 'Liar', 'Not Liar','Total')
b <- c('Positive', 0.59*0.2, 0.1*0.8, 0.59*0.2+0.1*0.8)
c <- c('Negative', 0.41*0.2, 0.9*0.8, 0.41*0.2+0.9*0.8)
d <- c('-', 0.59*0.2+0.41*0.2, 0.1*0.8+0.9*0.8, (0.59*0.2+0.1*0.8+0.41*0.2+0.9*0.8))
df <- data.frame(a,b,c,d)
t(df)
## [,1] [,2] [,3] [,4]
## a "Result" "Liar" "Not Liar" "Total"
## b "Positive" "0.118" "0.08" "0.198"
## c "Negative" "0.082" "0.72" "0.802"
## d "-" "0.2" "0.8" "1"
#Solving a.
p<- 0.118/0.198
round(p,3)
## [1] 0.596
p<- 0.72/0.802
round(p,3)
## [1] 0.898
Probability Statement:
P that a person is either a liar or was identified as a liar by the polygraph = P that a person is a liar + P that a person is identified as a liar - (P that a person is a liar and correctly identified as such)
p<- 0.2 + 0.198 - 0.118
round(p,3)
## [1] 0.28