Exercise List 3 - Interactive
Choose the right distribution function step by step
How To Pick The Right Function
Step 1: Which distribution is it?
- Binomial: fixed number of trials
n, two outcomes (success/fail), same probabilityp - Uniform: every value between
minandmaxis equally likely - Normal: bell-shaped, defined by
μandσ
Step 2: What does the question ask for?
- Exact probability (
exactly x) -> use ad...function- Binomial:
dbinom(x, n, p)
- Binomial:
- Cumulative probability (
at most x,no more than x,less than) -> use ap...function- Binomial:
pbinom(x, n, p) - Normal:
pnorm(x, mean = μ, sd = σ)
- Binomial:
- Upper tail probability (phrases like
at least xormore than x)- Use the complement (subtract from 1) or set
lower.tail = FALSE - Binomial example:
1 - pbinom(x - 1, n, p)
- Use the complement (subtract from 1) or set
- Cutoff / amount (
which score?,minimum x for top 15%) -> use aq...function- Binomial:
qbinom(prob, n, p) - Normal:
qnorm(prob, mean = μ, sd = σ)
- Binomial:
5.4 Binomial distribution
Exercise 50
A manager at 24/7 Fitness Center is strategic about contacting open house attendees. With her strategy, she believes that 40% of the attendees she contacts will purchase a club membership. Suppose she contacts 20 open house attendees.
Exercise 50a
What is the probability that exactly 10 of the attendees will purchase a club membership?
This is a binomial question, and the word “exactly” tells you to use the d... function. Then plug in the requested number of successes, the sample size, and the success probability.
dbinom(10, 20, 0.4)Exercise 50b
What is the probability that no more than 10 of the attendees will purchase a club membership?
“No more than 10” means X <= 10, so you need a cumulative probability. That means the p... function.
pbinom(10, 20, 0.4)Exercise 50c
What is the probability that at least 15 of the attendees will purchase a club membership?
“At least 15” means an upper tail. A safe way is to subtract the probability up to 14 from 1.
1 - pbinom(14, 20, 0.4)6.1 Continuous Random Variables and the Uniform Distribution
Exercise 8
Suppose the price of electricity follows the continuous uniform distribution with a lower bound of 12 cents per kilowatt-hour and an upper bound of 20 cents per kilowatt-hour.
Exercise 8a
Calculate the average price of electricity.
For a continuous uniform distribution, the average sits halfway between the lower and upper bound.
(12 + 20) / 2Exercise 8b
What is the probability that the price of electricity is less than 15.5 cents per kilowatt-hour?
“Less than 15.5” is a lower-tail probability, so use the cumulative uniform function.
punif(15.5, min = 12, max = 20)Exercise 8c
A local carnival is not able to operate its rides if the price of electricity is more than 14 cents per kilowatt-hour. What is the probability that the carnival will need to close?
“More than 14” is an upper-tail probability. So use the uniform CDF with the upper-tail option instead of the lower tail.
punif(14, min = 12, max = 20, lower.tail = FALSE)6.2 Normal distribution
Exercise 44
Scores on a marketing exam are known to be normally distributed with a mean and standard deviation of 60 and 20, respectively.
Exercise 44a
Find the probability that a randomly selected student scores between 50 and 80.
For a probability between two scores, take the cumulative probability up to the upper value and subtract the cumulative probability up to the lower value.
pnorm(80, 60, 20) - pnorm(50, 60, 20)Exercise 44b
Find the probability that a randomly selected student scores between 20 and 40.
This is another probability between two values, so use the same “upper cumulative minus lower cumulative” pattern as in 44a.
pnorm(40, 60, 20) - pnorm(20, 60, 20)Exercise 44c
The syllabus suggests that the top 15% of the students will get an A in the course. What is the minimum score required to get an A?
Top 15% means you want the cutoff with 15% above it, so 85% below it. That means a percentile question, so use the q... function.
qnorm(0.85, 60, 20)Exercise 44d
What is the passing score if 10% of the students will fail the course?
Bottom 10% means the 10th percentile. This is again a cutoff question, so use the q... function.
qnorm(0.10, 60, 20)Exercise 50
While Massachusetts is no California when it comes to sun, the solar energy industry is flourishing in this state. The state’s capital, Boston, averages 211.7 sunny days per year. Assume that the number of sunny days follows a normal distribution with a standard deviation of 20 days.
Exercise 50a
What is the probability that Boston has less than 200 sunny days in a given year?
“Less than 200” is a lower-tail normal probability, so use the cumulative normal function.
pnorm(200, 211.7, 20)Exercise 50b
Los Angeles averages 266.5 sunny days per year. What is the probability that Boston has at least as many sunny days as Los Angeles?
“At least as many as 266.5” is an upper-tail probability. So use the normal CDF with the upper-tail option.
pnorm(266.5, 211.7, 20, lower.tail = FALSE)Exercise 50c
Suppose a dismal year in Boston is one where the number of sunny days is in the bottom 10% for that year. At most, how many sunny days must occur annually for it to be a dismal year in Boston?
“Bottom 10%” means the 10th percentile, so this is a cutoff question and needs the q... function.
qnorm(0.10, 211.7, 20)Exercise 50d
Last year, Boston experienced unusually warm, dry, and sunny weather. Suppose this occurs only 1% of the time. What is the minimum number of sunny days that would satisfy the criteria for being an unusually warm, dry, and sunny year in Boston?
“Occurs only 1% of the time” means the top 1%, so you need the cutoff with 99% below it.
qnorm(0.99, 211.7, 20)