rm(list = ls())
library(DATA606)##
## Attaching package: 'DATA606'
## The following object is masked from 'package:utils':
##
## demo
What percent of a standard normal distribution \(N(\mu = 0, \sigma = 1)\) is found in each region? Be sure to draw a graph.
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
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
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
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
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.
Men 30-34: \(N(\mu = 4313, \sigma = 583)\)
Women 25-29: \(N(\mu = 5261, \sigma = 807)\)
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.
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.
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
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
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.
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)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
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)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.
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
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\]
\[\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\]
\[\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\]
With an increase in probability, the mean wait time until a success is shorter but the standard deviation is larger.
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.
\[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
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} \]
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\]
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.
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} \]
\[P(10^{th} \text{ is a success}) = 0.15\]
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%.