Purpose

This project will demonstrate your understanding of the normal and binomial probability distributions in R and RStudio.


Question 1

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.

  1. P(x > 65)
# pnorm calculates the probability of a value being less than the one you input.
pnorm(65, 100, 15)
## [1] 0.009815329
# We do not need to know the probability of a value being less than 65, we need to know the probability of a value being more than 65. Therefore, I found the compliment of the probability of a value being on the left to find the probability of a value being on the right.
1-0.009815329
## [1] 0.9901847

There is a 99% chance that a randomly selected person will have an IQ score higher than (greater than) 65.

  1. P(x < 150)
# pnorm calculates the probability of a value being less than the one you input.
pnorm(150, 100, 15)
## [1] 0.9995709

There is a 99.96% chance that a randomly selected person will have an IQ score lower than (less than) 150.


Question 2

Assume the same mean and standard deviation of IQ scores that were described in question 2.

  1. A high school offers a special program for gifted students. In order to qualify, students must have IQ scores in the top 5%. What is the minimum qualifying IQ?
# qnorm is the quantile function 
qnorm(0.95, 100, 15)
## [1] 124.6728

The minimum qualifying IQ score is 124.67 for the special program at this high school.

  1. If one person is randomly selected, what is the probability that their IQ score is greater than 125?
# pnorm calculates the probability of a value being less than the one you input.
pnorm(125, 100, 15)
## [1] 0.9522096
# We do not need to know the probability of a value being less than 125, we need to know the probability of a value being more than 125. Therefore, I found the compliment of the left side's probability to give me the right side's probability.
1-0.9522096
## [1] 0.0477904

The probability of randomly selecting a person with an IQ score of more than 125 is 4.78% which means not very likely.


Question 3

  1. Still using the mean and standard deviation from question 1, what is the z-score for an IQ of 140?
# The z-score is the data value minus the mean, then divided by the standard deviation.
(140-100)/15
## [1] 2.666667

The z-score for an IQ of 140 is 2.66.

  1. We mentioned in week 6 that a data value is considered “unusual” if it lies more than two standard deviations from the mean. Is an IQ of 140 considered unusual?

Yes, an IQ of 140 is very “unusual” because the average IQ is 100 so 140 is well above average. In fact, a score of 140 is almost 3 standard deviations from the mean (well, 2.66) making it very rare.

  1. What is the probability of getting an IQ greater than 140?
# pnorm calculates the probability of a value being less than the one you input.
pnorm(140, 100, 15)
## [1] 0.9961696
# We do not need to know the probability of a value being less than 140, we need to know the probability of a value being more than 140. Therefore, I found the compliment of the left side's probability to give me the right side's probability.
1-0.9961696
## [1] 0.0038304

The probability of getting an IQ score that is greater than 140 is 0.38% which is not even 1% which is BEYOND rare.


Question 4

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.

  1. How many questions do you expect to answer correct on average?
# mean=n*p
15*0.20
## [1] 3

I expect to answer three questions correctly based on this scenario.

  1. What is the probability that you get every question correct?
# dbinom is used to find the probability that exactly x number of successes will occur in a binomial experiment.
dbinom(15, 15, 0.20)
## [1] 3.2768e-11

The probability of me getting every question correct in this scenario is 0.000000000032768, so in other words, it’s not going to happen.

  1. What is the probability that you get every question incorrect?
# dbinom is used to find the probability that exactly x number of successes will occur in a binomial experiment.
dbinom(0, 15, 0.20)
## [1] 0.03518437

The probability that I answer every question incorrectly is 0.03518 which is the same as 3.5%.


Question 5

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.

  1. How many questions does one need to answer correctly in order to score exactly a 60%?
# Here I cross-multiplied. 
# 60/100=x/15
# 100x=900
# x=9

In order to recieve exactly a 60% on this quiz, you need to answer exactly 9 questions correctly.

  1. If a grade of 60% or lower is considered failing, then what is the probability of you failing?
# pbinom calculates the probability of x or fewer successes occuring (in this case, getting 9 or less answers correct).
pbinom(9, 15, 0.20)
## [1] 0.9998868

The probability of me failing this quiz is 99.98%. In other words, I’m going to fail it.

  1. If you need a grade of 80% or higher on this quiz to maintain a passing grade, what is the probability of you maintaining that passing grade?
# Here I cross-multiplied. 
# 80/100=x/15
# 100x=1200
# x=12
pbinom(11, 15, 0.20)
## [1] 0.999999
# Now I will find the compliment of 11 or less to give me 12 or more.
1-0.999999
## [1] 1e-06

The probability of me maintaining that passing grade is 0.000001. In other words, it’s not going to happen.


Question 6

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.

  1. Suppose you schedule 5 employees, what is the probability that all 5 come to work?
# dbinom is used to find the probability that exactly x number of successes will occur in a binomial experiment.
dbinom(5, 5, 0.8)
## [1] 0.32768

The probability that all five people actually come to work is 32.77%.

  1. Suppose you schedule 7 employees, what is the probability that at least 5 come to work?
# Here I used dbinom
dbinom(5, 7, 0.8)
## [1] 0.2752512
dbinom(6, 7, 0.8)
## [1] 0.3670016
dbinom(7, 7, 0.8)
## [1] 0.2097152
0.2752512+0.3670016+0.2097152
## [1] 0.851968
# Here I used pbinom just to check my answer
pbinom(4, 7, 0.8, lower.tail = FALSE)
## [1] 0.851968

The probability that at least five people come to work is 85.19%.

  1. It is really important that you have at least 5 servers show up! How many employees should you schedule in order to be 99% confident that at least 5 show up? Hint: there is no single formula for the answer here, perhaps use some kind of trial and error method, but show all work in an r chunk below.
# 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.