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.

  1. P(x > 65)
#Find the probability that a randomly selected person has an IQ greater than 65.
pnorm(65, 100, 15, lower.tail = FALSE)
## [1] 0.9901847

The probability that a randomly selected person has an IQ of greater than 65 is ~ 99%.

  1. P(x < 150)
#Find the probability that a randomly selected person has an IQ less than 150.
pnorm(150, 100, 15, lower.tail = TRUE)
## [1] 0.9995709

The probability that a randomly selected person has an IQ of less than 150 is ~ 100%.

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?
#Find the minimum qualifying IQ score to be considered in the top 5%.
qnorm(0.05, 100, 15, lower.tail = FALSE)
## [1] 124.6728

The minimum IQ score to be considered in the top 5% is 124.

  1. If one person is randomly selected, what is the probability that their IQ score is greater than 110?
#Find the probability that a randomly selected person has an IQ score greater than 110.
pnorm(110, 100, 15, lower.tail = TRUE)
## [1] 0.7475075

The probability that a randomly selected person has an IQ score greater than 110 is ~ 75%.

Question 3

  1. Still using the mean and standard deviation from question 1, what is the z-score for an IQ of 140?

\[z = \frac{(x - \mu)}{\sigma} \]

#Using the formula provided, find the z-score for an IQ of 140.
(140-100)/15
## [1] 2.666667

The z-score for an IQ score 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. This z-score is 2.67 which is more than 2 standard deviations from the mean, so an IQ score of 140 would be considered unusual.

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

The probability of getting an IQ score greater than 140 is ~ 0.38% or 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 number of questions you expect to answer correctly on average.
(1/5)*15
## [1] 3

If there are 15 multiple choice questions on an exam, when each question has 5 possible choices, and you guess on every question, the number you can expect to answer correctly is 3.

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

The probability that you get every question correct is ~ 3.28 x 10^-11, or 0.0000000000328, or 0%.

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

The probability that you get every question incorrect is ~ 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 score exactly a 60%?
#Find the number needed to score exactly 60%
(60*15)/100
## [1] 9

One needs to answer 9 questions correctly in order to score 60%.

  1. If a grade of 60% or lower is considered failing, then what is the probability of you failing?
#Find the probability of failing, given that a grade of 60% or lower is considered failing.
pbinom(9,15,0.2)
## [1] 0.9998868

If a grade of 60% or lower is considered failing, the probability of you failing is ~ 99.9%, or 100%.

  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 how many you must answer correctly in order to score at least 80%.
(80*15)/100
## [1] 12

In order to score at least 80% and maintain a passing grade, you must answer at least 12 questions correctly.

#Find the probability of maintaining a passing grade, with at least 80%.
1-pbinom(11,15,0.2)
## [1] 1.011253e-06

The probability of scoring at least 80% is ~ 0.00000101, or 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?
#Given that you schedule 5 employess, find the probability that all 5 show up.
dbinom(5,5,0.8)
## [1] 0.32768

The probability that 5 out of the 5 scheduled employees come to work is ~ 33%.

  1. Suppose you schedule 7 employees, what is the probability that at least 5 come to work?
#Given that you schedule 7 employees, find the probability that at least 5 show up.
dbinom(5:7,7,0.8)
## [1] 0.2752512 0.3670016 0.2097152
#Assign the vectors of 5-7 to "x".
x<-dbinom(5:7,7,0.8)

#Add the proabilities of 5-7.
sum(x)
## [1] 0.851968

Given that you schedule 7 employees, the probability that at least 5 come to work is ~ 85%.

  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 employees you need to schedule to be 99% sure at least 5 come to work.
1-pbinom(4,8,0.8)
## [1] 0.9437184
1-pbinom(4,9,0.8)
## [1] 0.9804186
1-pbinom(4,10,0.8)
## [1] 0.9936306
1-pbinom(4,11,0.8)
## [1] 0.9980346
1-pbinom(4,12,0.8)
## [1] 0.9994188

You need to schedule at least 10 employees in order to be 99% sure at least 5 of them show up.

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.
#Set a seed of 5 to ensure the same numbers are generated continuously.
set.seed(5)

#Generate a random sample of 10,000 numbers from a normal distribution with a mean of 51 and a s.d. of 7. Assign this random sample to "rand_nums".
rand_nums<-rnorm(10000,51,7)
  1. Create a histogram of that random sample.
#Create a histogram of that random sample with a title and labels. Be sure the maximum value on the y-axis supports the maximum value on the x-axis.  
hist(rand_nums, main = "Random Sample of 10,000 Numbers", xlab = "Frequency of Occurrences", ylab = "Random Numbers", ylim = range(pretty(c(0,3000,500))))

Question 8

  1. How many values in your rand_nums vector are below 40?
#Generate a table of random values that are below 40.
table(rand_nums<40)
## 
## FALSE  TRUE 
##  9414   586

There are 598 random numbers that fall below 40.

  1. For a theoretical normal distribution, how many of those 10,000 values would you expect to be below 40?
#Find the probability that one of these values is below 40.
pnorm(40,51,7)
## [1] 0.05804157
#Given that there are 10,000 values, find how many fall below 40.
0.0580*10000
## [1] 580

Out of 10,000 random values, given a mean of 51 and a s.d. of 7, I can expect 580 of them to fall below 40.

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

Yes, out of 10,000 various options, 598 and 580 are reasonably close figures.