red <- 54
white <- 9
blue <- 75
round((red + blue) / (red + blue + white),4)
## [1] 0.9348
green_golf <- 19
red_golf <- 20
blue_golf <- 24
yellow_golf <- 17
red_golf / (green_golf + red_golf + blue_golf + yellow_golf)
## [1] 0.25
total <- 1399
females <- 228 + 79 + 252 + 97 +72
not_parent_female <- females - 252
round(not_parent_female / total,4)
## [1] 0.3402
Dependent
choose(8,3) * choose(7,3) * choose(3, 1)
## [1] 5880
Independent
P <- function(n, r){
factorial(n)/factorial(n-r)
}
permutation <- P(14, 8)
cat("Total number of ways is:", permutation)
## Total number of ways is: 121080960
round(choose(9, 0) * choose(4, 1) * choose(9, 3) / choose((9+4+9),4),4)
## [1] 0.0459
factorial(11)/factorial(7)
## [1] 7920
complement <- 100 - 67
print(paste(complement, "under the age of 34"))
## [1] "33 under the age of 34"
Step 1. Find the expected value of the proposition. Round your answer to two decimal places.
Expected value of the proposition is: (P exactly 3 heads * 97 + P not 3 heads * (-30))
(choose(4,3)/2^4) * (97) + (1-choose(4,3)/2^4) * (-30)
## [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.)
((choose(4,3)/2^4) * (97) + (1-choose(4,3)/2^4) * (-30)) * 559
## [1] 978.25
Step 1. Find the expected value of the proposition. Round your answer to two decimal places.
Expected value of the proposition is: (P of 4 tails or less * 23 + P more than 4 tails * (-26))
n1 <- 9
k1 <- 4
temp <- 0
while (k1 >= 0){
temp <- temp + (factorial(n1) / ((factorial(k1) * factorial(n1-k1))))
k1 <- k1 - 1
}
p1 <- temp/(2^9)
pf <- 1 - (p1)
E1 <- round(23 * (p1) + (-26) * pf, 2)
E1
## [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.)
E1 * 994
## [1] -1491
(a)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.)
\[0.59 * 0.2/(0.59 * 0.2+0.1 * 0.8)\]
0.59*0.2 / ( 0.59*0.2 + 0.1*0.8)
## [1] 0.5959596
(b)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.)
0.9*0.8 / ( (1 - 0.59)*0.2 + 0.9*0.8)
## [1] 0.8977556
(c)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
B = 0.1*0.8 / ( (0.59*0.2) +( 0.1*0.8))
0.2 + B
## [1] 0.6040404