In this project, students will demonstrate their understanding of probability and the normal and binomial distributions.
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.
# Using the pnorm function to find the probability that x will be less than 65, and subtracting the value from 1 to find its complement (The complement is the probability that x will be greater than 65)
# first assign values to the mean and standard deviation
IQ_mean <- 100
IQ_sd <- 15
# Then use the pnorm function
pnorm(65, mean = IQ_mean, sd = IQ_sd, lower.tail = FALSE)
## [1] 0.9901847
The probability that a randomly selected person has an IQ score greater than 65 is 0.9902 or 99.02%
# Using the pnorm function to find the probability that x will be less than 150
pnorm(150, mean = 100, sd = 15, lower.tail = TRUE)
## [1] 0.9995709
The probability that a randomly selected person has IQ score less than 150 is 0.9996 or 99.96%
Assume the same mean and standard deviation of IQ scores that was described in question 1.
# using the qnorm to find the score that seperates the bottom 95% from the top 5%
qnorm( 0.95, mean = IQ_mean, sd = IQ_sd)
## [1] 124.6728
The minimum qualifying IQ score to qualify for the special program is approximately 124.67
# Using the pnorm function to find the probability of the IQ score greater than 110
pnorm( 110, mean = IQ_mean, sd = IQ_sd, lower.tail = FALSE)
## [1] 0.2524925
The probanbility that a person will have an IQ score greater than 110 is 0.252495 0r 25.25%
# Using the Z-score formular and plugging the value for an IQ of 140
(140 - IQ_mean)/IQ_sd
## [1] 2.666667
The Z-score for an IQ of 140 is 2.6666667 or 2.67.
Yes, because an IQ score of 140 is considered “unusual” because 140 i2 2.67 standard deviations away from the mean, and 2.67 is greater than 2
# Using the pnorm function with "lower.tail = FALSE" to find the probability of a random individual having an IQ greater than 140
pnorm(140, mean = IQ_mean, sd = IQ_sd, lower.tail = FALSE)
## [1] 0.003830381
The probability of getting an IQ greater than 140 is 0.00383, or 0.38%
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.
# Multiplying the number of questions by the probability of guessing an answer correctly
15*0.2
## [1] 3
I would expect to see 3 questions answered correctly on average.
# Using the dbinom function to find the probability of the specific instance where 15/15 answers are correct
dbinom(x = 15, size = 15, prob = 0.2)
## [1] 3.2768e-11
The probability of getting every question correct is 3.2768e-11, or 0.000000000032768, which is approximately 0%.
# Using the dbinom function to find the probability of the specific instance where 0/15 answers are correct
dbinom(x = 0, size = 15, prob = 0.2)
## [1] 0.03518437
The probabiltiy of getting every question incorrect is 0.0352, or 3.52%.
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.
# Finding 60% of 15
0.6*15
## [1] 9
One would need to get 9 questions out of 15 correct to score exactly a 60%.
# Using pbinom to find the cumulative probability of scoring either 60% or lower
pbinom(q = 9, size = 15, prob = 0.2)
## [1] 0.9998868
The probability of failing is 0.9999, making failure very likely.
# Calculating 79% of 15 to find q, as 80% still maintains a passing grade
0.79*15
## [1] 11.85
# Using the pbinom function with the "lower.tail = FALSE" argument to find the probability of scoring an 80% or higher
pbinom(q = 11.85, size = 15, prob = 0.2, lower.tail = FALSE)
## [1] 1.011253e-06
The probability of maintaining a passing grade is 1.011253e-06, or 0.000001011253, which is approximately 0%.
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.
# Using the dbinom function to find the probability of the specific instance where 5/5 employees come to work
dbinom(x = 5, size = 5, prob = 0.8)
## [1] 0.32768
The probability of all 5 employees coming to work is 0.3277.
# Using the pbinom function to find the probability of the specfic instance where at least 5/7 employees come to work
pbinom(q = 4, size = 7, prob = 0.8, lower.tail=FALSE)
## [1] 0.851968
The probability of at least 5 employees out of 7 showing up to work is approximately 0.8520.
# Knowing that scheduling 7 people only gives us about an 85% chance of having five people show up and knowing I need that 85 to be a 99, I tried a few more numbers. For example, what if we schedule 8, 9, or 10 people?
pbinom(4, 8, 0.8, lower.tail = FALSE)
## [1] 0.9437184
pbinom(4, 9, 0.8, lower.tail = FALSE)
## [1] 0.9804186
pbinom(4, 10, 0.8, lower.tail = FALSE)
## [1] 0.9936306
In order to be 99% confident that at least five people show up, ten employees will have to be scheduled.
rand_nums <- round(rnorm(10000, 51, 7))
hist(rand_nums)
# use the pnorm function
pnorm(40, mean = 51, sd = 7)
## [1] 0.05804157
The number of values in the my rand_nums that are below 40 is 0.05804157 or 5.8%
pnorm(10000, mean = 51, sd = 7)
## [1] 1
The 10000 values that I xpect to be below 40 is 1