3.2 Area under the curve, Part II.

What percent of a standard normal distribution mean = 0, standard deviation = 1 is found in each region? Be sure to draw a graph. (a) Z > -1.13

std <- 1
mu <- 0
z <- -1.13
x <- (z*std) - mu

paste0('The value of x is: ', x)
## [1] "The value of x is: -1.13"
#Since x > -1.13, then

p <- 1 - pnorm(x, mean = 0, sd = 1)
paste0('The percent is: ', round(p*100, 2), '%')
## [1] "The percent is: 87.08%"
shadeDist(-1.13, lower.tail = FALSE,col = c("black", "steelblue"))

  1. \[ Z < 0.18 \]
std <- 1
mu <- 0
z <- 0.18
x <- (z*std) + mu

paste0('The value of x is: ', x)
## [1] "The value of x is: 0.18"
# Since x < 0.18
p <- pnorm(x, mean = 0, sd = 1)

paste0('The percent is: ', round(p*100, 2), '%')
## [1] "The percent is: 57.14%"
shadeDist(0.18, col = c("black", "steelblue"))

  1. \[ Z > 8 \]
std <- 1
mu <- 0
z <- 8
x <- (z*std) + mu

paste0('The value of x is: ', x)
## [1] "The value of x is: 8"
# Since x > 8
p <- 1 - pnorm(x, mean = 0, sd = 1)

paste0('The percent is: ', round(p*100, 2), '%')
## [1] "The percent is: 0%"
shadeDist(8, lower.tail = FALSE,col = c("black", "steelblue"))

  1. \[ |Z| < 0.5 \]
std <- 1
mu <- 0
z <- 0.5
x <- (z*std) + mu

paste0('The value of x is: ', x)
## [1] "The value of x is: 0.5"
# Since x < 0.5
p <- 1 - pnorm(x, mean = 0, sd = 1)

paste0('The percent is: ', round(p*100, 2), '%')
## [1] "The percent is: 30.85%"
# SINCE |x| = 0.5 = -x < 0.5 < x

x1 <- pnorm(-x, mean = 0, sd = 1)
x2 <- pnorm(x, mean = 0, sd = 1)

xdiff <- x2 - x1

paste0('The value of x2-x1 is: ', xdiff)
## [1] "The value of x2-x1 is: 0.382924922548026"
shadeDist(c( -0.5, 0.5 ),, lower.tail = FALSE, 0, 1, col = c("black", "steelblue"))

3.4 Triathlon times, Part I.

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: . The finishing times of the Men, Ages 30 - 34 group has a mean of 4313 seconds with a standard deviation of 583 seconds. . The finishing times of the Women, Ages 25 - 29 group has a mean of 5261 seconds with a standard deviation of 807 seconds. . The distributions of finishing times for both groups are approximately Normal. Remember: a better performance corresponds to a faster finish. (a) Write down the short-hand for these two normal distributions.

Answer:

For men, ages 30 - 34: N(\mu = 4313, \sigma = 583) For women, ages 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?

\[ Z_{racer} = \frac{racer_{time} - \mu_{group}}{\sigma_{group}}\]

Zleo <- (4948-4313)/583
Zmary <- (5513 - 5261)/807

paste0('The Z-scores of Leo and Mary are: ', round(Zleo, 2), ' and ', round(Zmary, 2), ' respectively')
## [1] "The Z-scores of Leo and Mary are: 1.09 and 0.31 respectively"

The Z-score of an observation is the number of standard deviations it falls above or below the mean

Leo’s Z-score is 1.09 standard deviations above the mean, while Mary’s Z-score is 0.31 standard deviations above the mean

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

Answer:

Leo’s Z-score is 1.09 standard deviations above the mean (0.8621 from Z-table), which means that around 13.79% (100 - 86.21 = 13.79%) of the male racers performed better than Leo. Mary’s Z-score is 0.31 (0.6217 from the Z-table) means that about 37.83% (100 - 62.17 = 37.83%) of the female racers performed better than Mary. In summary, Leo ranked better than Mary.

  1. What percent of the triathletes did Leo finish faster than in his group? Answer:
racersBelowLeo <- pnorm(4948, 4313, 583)

paste0('Leo finished faster than ', round(racersBelowLeo*100, 2), '% of racers in his group')
## [1] "Leo finished faster than 86.2% of racers in his group"
  1. What percent of the triathletes did Mary finish faster than in her group?

Answer:

racersBelowMary <- pnorm(5513, 5261, 807)
paste0('Mary finished faster than ', round(racersBelowMary*100, 2), '% of racers in her group')
## [1] "Mary finished faster than 62.26% of racers in her group"
  1. If the distributions of finishing times are not nearly normal, would your answers to parts
      1. change? Explain your reasoning.

Answer:

Parts (b) and (c) will not change as Z-scores can still be calculated for disribuions that are not normal, while parts (d) and (e) can not be answered because we cannot use the normal distribution table to calculate probabilities and other values without a normal distribution model.

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)
femaleHeights <- data.frame(heights)
summary(femaleHeights)
##     heights     
##  Min.   :54.00  
##  1st Qu.:58.00  
##  Median :61.00  
##  Mean   :61.52  
##  3rd Qu.:64.00  
##  Max.   :73.00
  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.

Answer:

sd <- 4.58
meanHeight <- 61.52

femaleHeights$z <- (femaleHeights$heights - meanHeight)/4.58
femaleHeights
##    heights          z
## 1       54 -1.6419214
## 2       55 -1.4235808
## 3       56 -1.2052402
## 4       56 -1.2052402
## 5       57 -0.9868996
## 6       58 -0.7685590
## 7       58 -0.7685590
## 8       59 -0.5502183
## 9       60 -0.3318777
## 10      60 -0.3318777
## 11      60 -0.3318777
## 12      61 -0.1135371
## 13      61 -0.1135371
## 14      62  0.1048035
## 15      62  0.1048035
## 16      63  0.3231441
## 17      63  0.3231441
## 18      63  0.3231441
## 19      64  0.5414847
## 20      65  0.7598253
## 21      65  0.7598253
## 22      67  1.1965066
## 23      67  1.1965066
## 24      69  1.6331878
## 25      73  2.5065502
# to find x within 1 Standard deviation
Z <- 1
x1 <- Z * sd + meanHeight
x1
## [1] 66.1
# Probaility by using x1
sum(femaleHeights$heights < x1)/length(femaleHeights$heights)
## [1] 0.84
# to find  Probability using 'pnorm'
pnorm(x1, meanHeight, sd)
## [1] 0.8413447
# to find x within 2 Standard deviation
Z <- 2
x2 <- Z * sd + meanHeight
x2
## [1] 70.68
# Probaility x2
sum(femaleHeights$heights < x2)/length(femaleHeights$heights)
## [1] 0.96
# to find  Probability using 'pnorm'
pnorm(x2, meanHeight, sd)
## [1] 0.9772499
# to find x within 3 Standard deviation
Z <- 3
x3 <- Z * sd + meanHeight
x3
## [1] 75.26
# Probaility x3
sum(femaleHeights$heights < x3)/length(femaleHeights$heights)
## [1] 1
# to find  Probability using 'pnorm'
pnorm(x3, meanHeight, sd)
## [1] 0.9986501

From these computations, these heights approximately follow the 66-95-99.74% rule because:

84% of the heights are within standard deviation of 1, 96% are within standard deviation of 2, and 100% are within standard deviation of 3

  1. Do these data appear to follow a normal distribution? Explain your reasoning using the graphs provided below.

Answer:

hist(femaleHeights$heights, probability = TRUE, main="Histogram of Female Students' Heights", xlab = "Students' Heights", ylim = c(0, 0.1), col = 'steelblue')
x <- c(50:75)
y <- dnorm(x = x, mean = meanHeight, sd = sd)
lines(x = x, y = y, col = "red")
abline(v = mu, col = "orange")

qqnorm(femaleHeights$heights)
qqline(femaleHeights$heights, col = 2)

qqnormSim(femaleHeights$heights)

The distribution is symmetrical and unimodal as the red curve line seems to approximate it well. The plot points of the normal probability plot show that the distribution seem to follow straight line. It can be said that the distribution is nearly a normal one.

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. (a) What is the probability that the 10th transistor produced is the first with a defect?

Answer:

This is a geometric distribution

# let pf = probability of failure, ps = probability for success, n = number of counts
pf <- 0.02
ps <- 1 - pf
n <- 10

p10 <- (1 - pf)^(n - 1) * pf

paste0('Probability that the 10th transistor produced is the first with a defect: ', round(p10, 4))
## [1] "Probability that the 10th transistor produced is the first with a defect: 0.0167"
  1. What is the probability that the machine produces no defective transistors in a batch of 100?
# let pf = probability of failure, ps = probability for success, n = number of counts

n <- 100

p100 <- (1 - pf)^(n)

paste0('Probability that the machine produces no defective transistors in a batch of 100: ', round(p100, 4))
## [1] "Probability that the machine produces no defective transistors in a batch of 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?

Answer:

Expected value of a geometric distribution is denoted by

\[ E_{(X)} = \frac{1}{P}\]

Ex <- 1/pf

paste0('We expect about ', round(Ex, 4), ' transistors to be produced before the first defect')
## [1] "We expect about 50 transistors to be produced before the first defect"

Standard deviation for a geometric distribution: \[sd = \sqrt{\frac{1 - pf}{pf^2}}\]

sd <- sqrt((1 - pf)/pf^2)

paste0('The standard deviation will then be ', round(sd, 4))
## [1] "The standard deviation will then be 49.4975"
  1. Another machine that also produces transistors has a 5% defective rate where each transistor is produced independent of the others. On average how many transistors would you expect to be produced with this machine before the first with a defect? What is the standard deviation?

Answer:

pf2 <- 0.05
Ex2 <- 1/pf2

paste0('For the second machine, We expect about ', round(Ex2, 4), ' transistors to be produced before the first defect')
## [1] "For the second machine, We expect about 20 transistors to be produced before the first defect"
sd2 <- sqrt((1 - pf2)/pf2^2)

paste0('And the standard deviation will then be ', round(sd2, 4))
## [1] "And the standard deviation will then be 19.4936"
  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?

Answer:

If the probability of attaining the first deffect is increased, the standard deviation will decrease, the wait time to attain defect will decrease

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. (a) Use the binomial model to calculate the probability that two of them will be boys.

n <- 3
k <- 2
pboy <- choose(n, k) * (1 - 0.51)^(n - k) * (0.51)^k

paste0('The probability that two of them are boys is: ', pboy)
## [1] "The probability that two of them are boys is: 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.
case1 <- c("BOY", "BOY", "GIRL")
case2 <- c("BOY", "GIRL", "BOY")
case3 <- c("GIRL", "BOY", "BOY")
kable(data.frame(case1,case2,case3)) %>%
          kable_styling(full_width = F) %>%
          column_spec(1, bold = T, width = "30em",  border_right = F, background = "#fafafa", color = "black") %>%
          column_spec(2, bold = T, width = "30em", background = "#fafafa", color = "black") %>%
          column_spec(3, bold = T, width = "30em", background = "#fafafa", color = "black")
case1 case2 case3
BOY BOY GIRL
BOY GIRL BOY
GIRL BOY BOY
0.51 * 0.51 * (1 - 0.51) + 0.51 * 0.51 * (1 - 0.51) + 0.51 * 0.51 * (1 - 0.51)
## [1] 0.382347

OR

This can simply be done as follows:

(0.51 * 0.51 * (1 - 0.51))*3
## [1] 0.382347

The outcomes are the same

  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).

Answer:

It will be more tedious to list and count all the cases for 3 boys and 5 girls than it is in part (a)

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. (a) What is the probability that on the 10th try she will make her 3rd successful serve?

Answer:

This is a Negative Binomial distribution

p <- 0.15
n <- 10
k <- 3
choose(n - 1, k - 1) * (1 - p)^(n - k) * p^k
## [1] 0.03895012
  1. Suppose she has made two successful serves in nine attempts. What is the probability that her 10th serve will be successful?

Answer:

The probability that her 10th serve will be successful is still 15% since they are all independent of each other.

  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?

Answer:

This is because the last trial is taken as a success in the negative binomial model.