Purpose

In this project, students will demonstrate their understanding of probability and the normal and binomial distributions.


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. ` a. P(x > 65)

#Find the probobilty that x will be more than 65
pnorm( 65, mean = 100, sd = 15, lower.tail = FALSE)
## [1] 0.9901847

The probobilty that x will be greater than 65 is 99.01%

  1. P(x < 150)
# Find the probability that x will be less than a 150
pnorm(150, mean = 100, sd = 15, lower.tail = TRUE)
## [1] 0.9995709

The probability that x will be less than a 150 is 99.96%

Question 2

Assume the same mean and standard deviation of IQ scores that was described in question 1.

  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?
# Store the values for the mean and standard deviavtion into the environement
IQ_mean <- 100
IQ_sd <- 15

# Find the minimum qualifying IQ 
qnorm(0.95, mean = 100,sd= 15)
## [1] 124.6728

The minimum qualifying IQ is 124.7.

  1. If one person is randomly selected, what is the probability that their IQ score is greater than 110?
# Find the probobility thta a randomly selected person will have an IQ score greater than 110
pnorm(125, IQ_mean, IQ_sd, lower.tail = FALSE)
## [1] 0.04779035

The probability that the IQ score of a randomly selected person to greater than 110 is 4.78%

Question 3

  1. Still using the mean and standard deviation from question 1, what is the z-score for an IQ of 140?
#Find the z-score for an IQ of 140
(140-IQ_mean)/IQ_sd
## [1] 2.666667

The z-score for an IQ of 140 is 2.67

  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 considered unusual because he z-score, 2.67, is greater than 2.

  1. What is the probability of getting an IQ greater than 140?
# Find the probability of getting an IQ greater than 140
1-pnorm(140, 100, 15)
## [1] 0.003830381

The probability of getting an IQ greater than 140 is approximately 0%

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 correctly on average?
# Find the amount of questions you expect to answer correctly on average
15*0.2
## [1] 3

On average 3 questions are expected to be answered correctly.

  1. What is the probability that you get every question correct?
# Find the probability that you get every question correct
dbinom(x = 15, size = 15, prob = .2)
## [1] 3.2768e-11

The probability getting every question correct is 0.

  1. What is the probability that you get every question incorrect?
# Find the probability that you get every question incorrect
dbinom(x = 0, size = 15, prob = .2)
## [1] 0.03518437

The probability of getting every question incorrect is about 3.52%

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 score exactly a 60%?
# Find the amount of questions does one need to answer correctly in order score exactly a 60%
15*0.6
## [1] 9

9 questions need to be answered correctly in order to score exactly 60%

  1. If a grade of 60% or lower is considered failing, then what is the probability of you failing?
# Fnd the probabilty of scoring 60% or lower
pbinom(q = 9, size = 15, prob = .2)
## [1] 0.9998868

Scoring 60% or lower on the test means there is 99% probobilty of failing.

  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?
# Find the probabilty of maintaining a passing grade of 80% or higher
1- pbinom(q = 11, size =  15,prob = .2)
## [1] 1.011253e-06

The probabilty of maintaining a passing grade of 80% or higher is approximately 0.

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?
# Find the probability that all 5 come to work
dbinom(x = 5, size = 5, prob = 0.8)
## [1] 0.32768

The probability that all 5 employees come to work is 32.77%

  1. Suppose you schedule 7 employees, what is the probability that at least 5 come to work?
# Find the probability that at least 5 come to work
1-pbinom( 4, 7 , .8)
## [1] 0.851968

The probability that at least 5 employees come to work is 85.2%

  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, so maybe use some kind of trial and error method.
# Find the number of how many employees should you schedule in order to be 99% confident that at least 5 show up
data.frame(employees_scheduled = c(5:15), prob = pbinom(q = 4, size = c(5:15), prob = .8, lower.tail = FALSE))
##    employees_scheduled      prob
## 1                    5 0.3276800
## 2                    6 0.6553600
## 3                    7 0.8519680
## 4                    8 0.9437184
## 5                    9 0.9804186
## 6                   10 0.9936306
## 7                   11 0.9980346
## 8                   12 0.9994188
## 9                   13 0.9998340
## 10                  14 0.9999540
## 11                  15 0.9999875

In order to be 99% confident that at least 5 employees show up, a minimum of 10 employees should be scheduled.

Question 7

  1. Generate a random sample of 10,000 numbers from a normal distribution with mean of 51 and standard deviation of 7. Store that data in object called rand_nums.
# Store a generated random sample of 10,000 numbers from a normal distribution with mean = 51 and sd = 7 into an object called rand_nums
rand_nums <- round(rnorm(n = 10000, mean = 51, sd = 7))
  1. Create a histogram of that random sample.
# Create a histogram
hist(rand_nums, breaks = 20)

Question 8

  1. How many values in your rand_nums vector are below 40?
# Find how many values in your rand_nums vector are below 40
table(rand_nums < 40)
## 
## FALSE  TRUE 
##  9488   512

There are 511 values in the rand_nums vector that are below 40.

  1. For a theoretical normal distribution, how many of those 10,000 values would you expect to be below 40?
# Find how many of those 10,000 values would you expect to be below 40
pnorm(q = 40, mean = 51, sd = 7) * 10000
## [1] 580.4157

For a theoretical normal distribution, about 580 of those 10,000 values are expected to be below 40.

  1. Is your answer in part a reasonably close to your answer in part b?

Yes, they are reasonably close because the sample size is 10000, which is a very large sample.