3.2 Area under the curve, Part II.

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

  1. Z < -1.35
visualize.norm(stat=-1.35,mu=0,sd=1,section="lower")

The percent of a standard normal distribution is 8.85%.

  1. Z > 1.48
visualize.norm(stat=1.48,mu=0,sd=1,section="upper")

The percent of a standard normal distribution is 6.94%.

  1. 0.4<Z< 1.5
visualize.norm(stat=c(0.4,1.5),mu=0,sd=1,section="bounded")

The percent of a standard normal distribution is 27.8%.

  1. |Z| > 2

Z >2 and -Z >2 or Z < -2

Finding probability of -2 > Z > 2

visualize.norm(stat=c(-2,2),mu=0,sd=1,section="bounded")

The percent of a standard normal distribution is 95.4%.

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.

  1. Write down the short-hand for these two normal distributions.
#Men Ages 30-40: 
men_mean=4313
men_sd=583 

#Women Ages 30-34: 
women_mean=5261 
women_sd=807
  1. What are the Z-scores for Leo’s and Mary’s finishing times? What do these Z-scores tell you?
Z_score_Leo<-(4948-men_mean)/men_sd
Z_score_Leo
## [1] 1.089194
Z_score_Mary<-(5513-women_mean)/women_sd
Z_score_Mary
## [1] 0.3122677

Z-score is the number of standard deviations from the mean.

Leo’s result is 1.09 standard deviations from the mean while Mary’s results is 0.31 standard deviations from the mean.

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

Mary ranks better since her result is closer to the median(since mean and median are equal in normal distribution) than Leo’s.

  1. What percent of the triathletes did Leo finish faster than in his group?
pnorm(Z_score_Leo,lower.tail=FALSE)
## [1] 0.1380342

Leo finished faster than 13.8% of the triathletes.

  1. What percent of the triathletes did Mary finish faster than in her group?
pnorm(Z_score_Mary,lower.tail=FALSE)
## [1] 0.3774186

Mary finished faster than 37.74% of the triathletes.

  1. If the distributions of finishing times are not nearly normal, would your answers to parts (b) - (e) change? Explain your reasoning.

Z-scores of not normal distributions are relevant only for analysis in a respective group. We will not be able to compare two people from different groups based on Z-scores of not normal distributions. Also, we will get different results in parts (d) and (e).

3.18 Heights of female college students.

Below are heights of 25 female college students.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 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.
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)

First, let’s check weather 68.27% lie within one standard deviation.

#mean
mean_heights<-mean(heights) 
#standard deviation
sd_heights<-sd(heights)

1-2*pnorm(mean_heights+sd_heights,mean=mean_heights,sd=sd_heights,lower=FALSE)
## [1] 0.6826895

Second, let’s check whether 95.45% lie within two standard deviations.

1-2*pnorm(mean_heights+2*sd_heights,mean=mean_heights,sd=sd_heights,lower=FALSE)
## [1] 0.9544997

Third, let’s check ether 99.73% lie within three standard deviations.

1-2*pnorm(mean_heights+3*sd_heights,mean=mean_heights,sd=sd_heights,lower=FALSE)
## [1] 0.9973002

Based on the resilts above, the heights approximately follow the 68-95-99.7% Rule

  1. Do these data appear to follow a normal distribution? Explain your reasoning using the graphs provided below.
hist(heights, probability = TRUE,ylim = c(0, 0.1))
x <- 30:90
y <- dnorm(x = x, mean = mean_heights, sd = sd_heights)
lines(x = x, y = y, col = "blue")

The data is not perfectly symmetric and bell-shaped. Moreover, it’s a little bit right-skewed. The mean should be a little bit greater than the median.

Let’s check.

summary(heights)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   54.00   58.00   61.00   61.52   64.00   73.00
qqnorm(heights)
qqline(heights)

Normal Q-Q Plot shows a slight right-skewed pattern.

In order to answer a question ether data appear to follow a normal distribution or not we have compare normal Q-Q plot of real data with normal Q-Q plot of simulated normally distribute data.

sim_norm <- rnorm(n = length(heights), mean = mean_heights, sd = sd_heights)
qqnorm(sim_norm)
qqline(sim_norm)

I would say that real data and simulated normal data have approximately the same number of points that fall on the line in normal Q-Q plot. Based on that comparison, I would suggest that real data follows normal distribution.

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 produced is the first with a defect?

It’s a case of geometric distribution. We’re counting “success”, as finding the defective part. In this case, 9 is the number of failures until we find a defective part.

(1 - 0.02)^9 * 0.02
## [1] 0.01667496
#or

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

Rate of “success” is 1-0.02. In order to find probability of getting 100 successes we have to multiply success rate by 100 times.

(1-0.02)^100
## [1] 0.1326196
#or

dbinom(0, 100, .02)
## [1] 0.1326196
  1. On average, how many transistors would you expect to be produced before the first with a defect?
1/0.02
## [1] 50

What is the standard deviation?

sqrt((1-0.02)/(0.02^2))
## [1] 49.49747
  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?
1/0.05
## [1] 20

What is the standard deviation?

sqrt((1-0.05)/(0.05^2))
## [1] 19.49359
  1. Based on your answers to parts (c) and (d), how does increasing the probability of an event a↵affect the mean and standard deviation of the wait time until success?

As probability increases mean and standard deviation 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.

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

num_boys<-2
num_kids<-3
p<-0.51

num_cases<-factorial(num_kids) / (factorial(num_boys)*factorial(num_kids - num_boys))
prob_two_boys <- num_cases*(p^num_boys)*((1-p)^(num_kids-num_boys))
prob_two_boys
## [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.

All possible orderings of 3 children: BBB,BBG,BGB,GBB,BGG,GGB,GBG,GGG

There are 8 possible orderings. 3 orderings include 2 boys.

#probability of getting two boys and a girl

0.51*0.51*(1-0.51) # this part is exactly the same as (p^num_boys)*((1-p)^(num_kids-num_boys))
## [1] 0.127449
#multiply probability of getting two boys and a girl by 3 cases

0.51*0.51*(1-0.51)*3 # 3 is exactly the same as factorial(num_kids) / (factorial(num_boys)*factorial(num_kids - num_boys)) 
## [1] 0.382347

Confirm that your answers from parts (a) and (b) match.

They match.

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

The approach from part (b) would be more tedious because it will be harder to list and count all cases with 3 boys and 5 girls than cases with 2 boys and a girl.

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?
p <- 0.15
n <- 10
k <- 3

#number of cases with 2 successes and 7 failures in 9 first attemps

num_cases <- factorial(n-1)/(factorial(k-1)*(factorial(n-k)))
prob <-num_cases*(p^k)*((1-p)^(n-k))

prob
## [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?

We have to find the probability of getting 2 successes in 9 previous attempts.

p <- 0.15
n <- 10-1
k <- 3-1

#number of cases with 2 successes and 7 failures

num_cases <- factorial(n)/(factorial(k)*(factorial(n-k)))
prob2 <-num_cases*(p^k)*((1-p)^(n-k))

prob2
## [1] 0.2596674
  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?

Part (a) calculates the probability that the 10th attempt is a success while two of the former nine attempts are successes. Part (b) calculates the probability that two of the previous nine attempts are successes.

prob in part a = prob in part b*0.15

Let’s check.

prob
## [1] 0.03895012
prob2*0.15
## [1] 0.03895012