rm(list = ls())
library(DATA606)
## 
## Attaching package: 'DATA606'
## The following object is masked from 'package:utils':
## 
##     demo

3.2 Area under the curve

What percent of a standard normal distribution \(N(\mu = 0, \sigma = 1)\) is found in each region? Be sure to draw a graph.

  1. \(Z > -1.13\)

Graph showing shaded area of interest:

normalPlot(0, 1, c(-1.13, Inf)) 

Using a standard normal distribution table, \(P(Z < -1.13) = 0.1292\). Therefore, \(P(Z > -1.13) = 1 - P(Z < -1.13) = 0.8708\)

I can also verify the result using the pnorm function.

1-pnorm(-1.13)
## [1] 0.8707619
  1. \(Z < 0.18\)

Graph showing shaded area of interest:

normalPlot(0, 1, c(-Inf, 0.18))

Using a standard normal distribution table, \(P(Z < 0.18) = 0.5714\).

I can also verify the result using the pnorm function.

pnorm(0.18)
## [1] 0.5714237
  1. \(Z > 8\)

Graph showing shaded area of interest:

normalPlot(0, 1, c(8, Inf))

Results over 8 standard deviations from the mean are incredibly rare and do not appear on the standard normal distribution table. \(P(Z > 8)\) is practically zero.

I can also verify the result using the pnorm function.

1-pnorm(8)
## [1] 6.661338e-16
  1. \(\left| Z \right| < 0.5\)

Graph showing shaded area of interest:

normalPlot(0, 1, c(-0.5, 0.5))

Using a standard normal distribution table, \(P(Z < 0.5) = 0.6915\) and \(P(Z < -0.5) = 0.3085\). Therefore, \[P(\left| Z \right| < 0.5) = P(Z < 0.5) - P(Z < -0.5) = 0.6915 - 0.3085 = 0.3830\]

I can also verify the result using the pnorm function.

pnorm(0.5)-pnorm(-0.5)
## [1] 0.3829249

3.4 Triathlon times

In triathlons, it is common for racers to be placed into age and gender groups. Friends Leo and Mary both completed the Hermosa Beach Triathlon, where Leo competed in the Men, Ages 30 - 34 group while Mary competed in the Women, Ages 25 - 29 group. Leo completed the race in 1:22:28 (4948 seconds), while Mary completed the race in 1:31:53 (5513 seconds). Obviously Leo finished faster, but they are curious about how they did within their respective groups. Can you help them? Here is some information on the performance of their groups:

Remember: a better performance corresponds to a faster finish.

  1. Write down the short-hand for these two normal distributions.

Men 30-34: \(N(\mu = 4313, \sigma = 583)\)

Women 25-29: \(N(\mu = 5261, \sigma = 807)\)

  1. What are the Z-scores for Leo’s and Mary’s finishing times? What do these Z-scores tell you?

Leo: \(Z = \frac{4948 - 4313}{583} = \frac{635}{583} = 1.09\)

Mary: \(Z = \frac{5513 - 5261}{807} = \frac{252}{807} = 0.31\)

These Z-scores transform Leo and Mary’s finishing times into the standard normal distribution and allow us to compare them to each other on the same scale.

  1. Did Leo or Mary rank better in their respective groups? Explain your reasoning.

Since this is a race, we want to identify which runner had the lower Z-score to find whether Leo or Mary had a better finish in respect to their group. Mary’s Z-score is 0.312 compared with Leo’s Z-score of 1.089; therefore, Mary had a better ranking within her group.

  1. What percent of the triathletes did Leo finish faster than in his group?

Using the table, \(P(Z < 1.09) = 0.8621\). Since that probability identifies faster runners than Leo, we need to find \(P(Z > 1.09) = 1 - P(Z < 1.09) = 0.1379\) to show that Leo ran faster than 13.79% of runners in his group.

normalPlot(0, 1, c(1.09, Inf))

1-pnorm(1.09)
## [1] 0.1378566
  1. What percent of the triathletes did Mary finish faster than in her group?

Using the table, \(P(Z < 0.31) = 0.6217\). Since that probability identifies faster runners than Mary, we need to find \(P(Z > 0.31) = 1 - P(Z < 0.31) = 0.3783\) to show that Mary ran faster than 37.83% of runners in her group.

normalPlot(0, 1, c(0.31, Inf))

1-pnorm(0.31)
## [1] 0.3782805
  1. If the distributions of finishing times are not nearly normal, would your answers to parts (b) - (e) change? Explain.

If the distributions of finishing times were not nearly normal, we could not use standardization to find Z-scores for each finisher. We could not compare Leo and Mary using this method, but would have to look at the data in detail (looking for its actual distribution) to measure their performance.

3.18 Heights of female college students

Below are heights of 25 female college students.

heights <- c(54,55,56,56,57,58,58,59,60,60,60,61,61,62,62,63,63,63,64,65,65,67,67,69,73)
  1. The mean height is 61.52 inches with a standard deviation of 4.58 inches. Use this information to determine if the heights approximately follow the 68-95-99.7% Rule.

Looking at the proportions of heights that fall within one, two, and three standard deviations, the distribution of heights does approximately follow the rule, with proportions of 68%, 96%, and 100% for the first three standard deviations, respectively.

meanhts <- mean(heights)
sdhts <- sd(heights)

(oneSD <- heights[heights < meanhts + sdhts & heights > meanhts - sdhts])
##  [1] 57 58 58 59 60 60 60 61 61 62 62 63 63 63 64 65 65
length(oneSD)/length(heights)
## [1] 0.68
(twoSD <- heights[heights < meanhts + 2*sdhts & heights > meanhts - 2*sdhts])
##  [1] 54 55 56 56 57 58 58 59 60 60 60 61 61 62 62 63 63 63 64 65 65 67 67
## [24] 69
length(twoSD)/length(heights)
## [1] 0.96
(threeSD <- heights[heights < meanhts + 3*sdhts & heights > meanhts - 3*sdhts])
##  [1] 54 55 56 56 57 58 58 59 60 60 60 61 61 62 62 63 63 63 64 65 65 67 67
## [24] 69 73
length(threeSD)/length(heights)
## [1] 1
  1. Do these data appear to follow a normal distribution? Explain your reasoning using the graphs provided below.

Though there are a few outliers towards the tail ends of the distribution, for the most part the data do appear to follow a normal distribution.

hist(heights, probability = TRUE, ylim = c(0, 0.11), col = "aquamarine")
x <- 50:75
y <- dnorm(x = x, mean = meanhts, sd = sdhts)
lines(x = x, y = y, col = "firebrick")

qqnorm(heights)
qqline(heights)

3.22 Defective rate

A machine that produces a special type of transistor (a component of computers) has a 2% defective rate. The production is considered a random process where each transistor is independent of the others.

  1. What is the probability that the 10th transistor is the first with a defect?

Let X be the random variable having geometric distribution representing the number of the first defective transistor, where p = probability of a defect: \[P(X) = (1-p)^{n-1}p = (1-0.02)^{n-1} \times (0.02)\] \[P(X = 10) = (1-0.02)^9 \times (0.02) \approx 0.0167\]

dgeom(9, 0.02)
## [1] 0.01667496
  1. What is the probability that the machine produces no defective transistors in a batch of 100?

Since the processes are independent, we can apply the multiplication rule for the probability.

\[P(\text{no defects in batch of 100}) = (1-0.02)^{100} = 0.1326\]

  1. On average, how many transistors would you expect to be produced before the first with a defect? What is the standard deviation?

\[\mu = \frac{1}{p} = \frac{1}{0.02} = 50\]

\[\sigma = \sqrt{\frac{p}{(1-p)^2}} = \sqrt{\frac{0.02}{(1-0.02)^2}} \approx 0.1443\]

  1. Another machine that also produces transistors has a 5% defective rate where each transistor is procuced independent of the others. On average how many transistors would you expect to be produced with the machine before the first with a defect? What is the standard deviation?

\[\mu = \frac{1}{p} = \frac{1}{0.05} = 20\]

\[\sigma = \sqrt{\frac{p}{(1-p)^2}} = \sqrt{\frac{0.05}{(1-0.05)^2}} \approx 0.2354\]

  1. Based on your answers to parts (c) and (d), how does increasing the probability of an event affect the mean and standard deviation of the wait time until success?

With an increase in probability, the mean wait time until a success is shorter but the standard deviation is larger.

3.38 Male children

While it is often assumed that the probabilities of having a boy or a girl are the same, the actual probability of having a boy is slightly higher at 0.51. Suppose a couple plans to have 3 kids.

  1. Use the binomial model to calculate the probability that two of them will be boys.

\[P(X = 2) = \left( \begin{matrix} 3 \\ 2 \end{matrix} \right) (0.51)^2 \times (0.49)^1 \approx 0.3823\]

Using R:

dbinom(2, 3, 0.51)
## [1] 0.382347
  1. Write out all possible orderings of 3 children, 2 of whom are boys. Use these scenarios to calculate the same probability from part (a) but using the addition rule for disjoint outcomes. Confirm that your answers from parts (a) and (b) match.

The three ways of having two boys out of three kids are BBG, BGB, GBB. Since these are disjoint outcomes, the probability of any of these outcomes occuring is: \[ \begin{aligned} P(BBG | BGB | GBB) &= P(BBG) + P(BGB) + P(GBB) \\ &= P(B) \times P(B) \times P(G) + P(B) \times P(G) \times P(B) + P(G) \times P(B) \times P(B) \\ &= (0.51)(0.51)(0.49) + (0.51)(0.49)(0.51) + (0.49)(0.51)(0.51) \\ &\approx 0.1274 + 0.1274 + 0.1274 \\ &\approx 0.3822 \end{aligned} \]

  1. If we wanted to calculate the probability that a couple who plans to have 8 kids will have 3 boys, briefly describe why the approach from part (b) would be more tedious than the approach from part (a).

Using the choose function shows that there are 56 ways to have 3 boys out of 8 children. With method b, the probability of each of those instances would have to be computed individually and then summed. With method a, the formula for the binomial distribution computes the probability in one step.

\[\left( \begin{matrix} 8 \\ 3 \end{matrix} \right) = \frac{8!}{3!(8-3)!} = \frac{8!}{3!5!} = \frac{(8)(7)(6)}{(3)(2)(1)} = 56\]

3.42 Serving in volleyball.

A not-so-skilled volleyball player has a 15% chance of making the serve, which involves hitting the ball so it passes over the net on a trajectory such that it will land in the opposing team’s court. Suppose that her serves are independent of each other.

  1. What is the probability that on the 10th try she will make her 3rd successful serve?

We can use the negative binomial distribution to model the likelihood of the \(k^{th}\) success occurring on the \(n^{th}\) trial.

\[P(k^{th} \text{ success out of } n \text{ trials})={\binom {n-1}{k-1}}p^{k}(1-p)^{n-k}\]

\[ \begin{aligned} P(3^{rd} \text{ success out of } 10 \text{ trials}) &= {\binom {10-1}{3-1}}(0.15)^{3}(1-0.15)^{10-3} \\ &= {\binom {9}{2}}(0.15)^{3}(0.85)^{7} \\ &\approx 36(0.0034)(0.3206) \approx 0.0390 \end{aligned} \]

  1. Suppose she has made two successful serves in nine attempts. What is the probability that her 10th serve will be successful?

\[P(10^{th} \text{ is a success}) = 0.15\]

  1. Even though parts (a) and (b) discuss the same scenario, the probabilities you calculated should be different. Can you explain the reason for this discrepancy?

The two scenarios look at the 10th serve in different ways. In part (a), we’re looking at the 10 serves as a whole and asking what the probability is that in those 10 serves there will be three successes, one of which will occur on the 10th serve. In part (b), we’re only examining the probability of the success on the tenth serve. Since each serve is assumed to be independent, the probability of success is the given probability of success on any serve, 15%.