In this project, Colin will demonstrate his understanding of probability and the normal and binomial distributions and try not to forget to remove any instructions or be ridiculous.
Assume IQ scores are normally distributed with a mean of 100 and a standard deviation of 15. If a person is randomly selected, find each of the requested probabilities. Here, x, denotes the IQ of the randomly selected person.
q1_mean <- 100
q1_sd <- 15
(1 - pnorm(65,q1_mean,q1_sd)) * 100
## [1] 99.01847
pnorm(150,q1_mean,q1_sd)*100
## [1] 99.95709
Assume the same mean and standard deviation of IQ scores that was described in question 1.
qnorm(0.95, q1_mean, q1_sd)
## [1] 124.6728
(1 - pnorm(110, q1_mean, q1_sd)) * 100
## [1] 25.24925
(140 - q1_mean) / q1_sd
## [1] 2.666667
q3b_zscore <- abs(140 - q1_mean) > 2 * q1_sd
q3b_zscore
## [1] TRUE
q3b_answer <- (1 - pnorm(q3b_zscore))
q3b_answer * 100
## [1] 15.86553
You are taking a 15-question multiple choice quiz and each question has 5 options (a,b,c,d,e) and you randomly guess every question.
q4a_answer <- 15 * (1 / 5)
q4a_answer
## [1] 3
q4b_answer <- (1 / 5)^15
q4b_answer
## [1] 3.2768e-11
floor(q4b_answer)
## [1] 0
q4c_answer <- ((5 - 1)/5)^15
q4c_answer * 100
## [1] 3.518437
Consider still the 15-question multiple choice quiz that each question has 5 options (a,b,c,d,e) and you randomly guess every question.
q5a_answer <- 15 * 0.60
q5a_answer
## [1] 9
q5b_answer <- (pbinom(q5a_answer - 1, 15, 1 / 5))
q5b_answer * 100
## [1] 99.9215
q5c_answer <- 1 - pbinom(q5a_answer - 1, 15, 1 / 5)
q5c_answer
## [1] 0.0007849854
Suppose you own a catering company. You hire local college students as servers. Not being the most reliable employees, there is an 80% chance that any one server will actually show up for a scheduled event. For a wedding scheduled on Saturday, you need at least 5 servers.
q6a_answer <- dbinom(5, 5, 4/5)
q6a_answer * 100
## [1] 32.768
q6b_answer <- 1 - pbinom(4, 7, 4/5)
q6b_answer * 100
## [1] 85.1968
for(q6c_answer in 5:20) {
yes_theyre_here <- 1 - pbinom(4, q6c_answer, 4/5)
if (yes_theyre_here >= 0.99) {
break
}
}
q6c_answer
## [1] 10
rand_nums <- rnorm(10000, 51, 7)
hist(rand_nums, main = "Question 7", xlab = "Value", breaks = 30, col = "lightblue", border = "black")
q8a_answer <- sum(rand_nums < 40)
q8a_answer
## [1] 580
q8b_answer <- pnorm(40, 51, 7) * 10000
q8b_answer
## [1] 580.4157
q8a_answer
## [1] 580
q8b_answer
## [1] 580.4157
That looks reasonably close! Even when Knitting this document a few dozen times. Plus, there’s this:
((q8a_answer - q8b_answer)/q8b_answer) * 100
## [1] -0.07161569
Reasonably close.