Instructions

  1. Update the author line at the top to have your name in it.
  2. You must knit this document to an html file and publish it to RPubs. Once you have published your project to the web, you must copy the web url link into the appropriate Course Project assignment in MyOpenMath before 11:59pm on the due date.
  3. Answer all the following questions completely. Some may ask for written responses.
  4. Use R chunks for code to be evaluated where needed and always comment all of your code so the reader can understand what your code aims to accomplish.
  5. Proofread your knitted document before publishing it to ensure it looks the way you want it to. Tip: Use double spaces at the end of a line to create a line break and make sure text does not have a header label that isn’t supposed to.
  6. DELETE ALL THESE INSTRUCTIONS BEFORE PUBLISHING YOUR DOCUMENT.

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)
mean <- 100
sd <- 15

Zscore <- (65 - mean) / sd

1 - pnorm(Zscore)
## [1] 0.9901847
  1. P(x < 150)
Zscore2 <- (150 - mean) / sd

1 - pnorm(Zscore2)
## [1] 0.0004290603

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?
qnorm(1 - 0.05, mean, sd)
## [1] 124.6728
  1. If one person is randomly selected, what is the probability that their IQ score is greater than 110?
1-pnorm(110 - mean) / sd
## [1] 0.9333333

Question 3

  1. Still using the mean and standard deviation from question 1, what is the z-score for an IQ of 140?
(140 - mean) / sd
## [1] 2.666667
  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 as it is 2.66 standard deviations away from the mean.

  2. What is the probability of getting an IQ greater than 140?

1 - pnorm(2.67)
## [1] 0.003792562

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?
probability_correct <- 1/5

questions <- 15

probability_correct * questions
## [1] 3
  1. What is the probability that you get every question correct?
(1/5)^15
## [1] 3.2768e-11
  1. What is the probability that you get every question incorrect?
(4/5)^15  
## [1] 0.03518437

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%?
15*(60/100)
## [1] 9
  1. If a grade of 60% or lower is considered failing, then what is the probability of you failing?
fail <- 9

# Probability of guessing a question correctly
probcorrect <- 1/5

# Probability of failing
pbinom(fail, size = questions, prob = probcorrect)
## [1] 0.9998868
  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?
pass <- 12

# Probability of passing
1 - pbinom(pass - 1, size = questions, prob = probcorrect)
## [1] 1.011253e-06

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?
p <- 0.8
n <- 5

dbinom(n, size = n, prob = p)
## [1] 0.32768
  1. Suppose you schedule 7 employees, what is the probability that at least 5 come to work?
n2 <- 7

# Probability that at least 5 out of 7 servers show up
pbinom(5, size = n2, prob = p, lower.tail = FALSE)
## [1] 0.5767168
  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.
desired_prob <- 0.99

# Initialize the number of scheduled employees
scheduled_employees <- 5

# Iterate until we find the desired probability

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.
  mean_value <- 51
  sd_value <- 7
  sample_size <- 10000
  randnum <- rnorm(sample_size, mean = mean_value, sd = sd_value)
  1. Create a histogram of that random sample.
hist(randnum)

Question 8

  1. How many values in your rand_nums vector are below 40?
sum(randnum < 40)
## [1] 562
  1. For a theoretical normal distribution, how many of those 10,000 values would you expect to be below 40?
prob_below_40 <- pnorm(40, mean = 51, sd = 7)
prob_below_40 * 10000
## [1] 580.4157
  1. Is your answer in part a reasonably close to your answer in part b? #when you have 10000 values, a difference of about 28 is very miniscule so the two values are reasonably close.