Load necessary libraries -
library(VennDiagram)
library(ggplot2)
What percent of a standard normal distribution N(\(\mu\) = 0, \(\sigma\) = 1) is found in each region? Be sure to draw a graph.
– (a) Z > -1.13 (b) Z < 0.18 (c) Z > 8 (d) |Z| < 0.5
Ans:
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.
Part (a): Write down the short-hand for these two normal distributions.
Ans:
For Men’s (Ages 30 - 34) group: N(\(\mu\) = 4313, \(\sigma\) = 583)
for Women’s (Ages 25 - 29) group: N(\(\mu\) = 5261, \(\sigma\) = 807)
Part (b): What are the Z-scores for Leo’s and Mary’s finishing times? What do these Z-scores tell you?
Ans:
Z score for Leo = (4948 - 4313)/583 = 1.09
Z score for Mary = (5513 - 5261)/807 = 0.31
Both Mary and Leo have positive Z scores which indicate that they both were slower in terms of finish time compared to average no. of participants.
Part (c): Did Leo or Mary rank better in their respective groups? Explain your reasoning.
Ans:
Because Leo has a higher Z score than Mary, it can be inferred that Leo ranked lower in the Men’s group than Mary did in Women’s group because Leo’s time was higher than average no. of male participants compare to Mary’s timing compared to average no. of female participants.
Part (d): What percent of the triathletes did Leo finish faster than in his group?
Ans:
Based on Normal Probability Table, the percentile score for Leo is 0.8621. So Leo finished faster than (100% - 86.21%) = 13.79% of the triatheletes in his group.
Part (e): What percent of the triathletes did Mary finish faster than in her group?
Ans:
Based on Normal Probability Table, the percentile score for Mary is 0.6217. So Mary finished faster than (100% - 62.17%) = 37.83% of the triatheletes in her group.
Part (f): If the distributions of finishing times are not nearly normal, would your answers to parts (b) - (e) change? Explain your reasoning.
Ans: As long as normal approximations can be applied to the distributions, answers should not change.
Part (a): 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.
Ans:
femaleHgtVector <- 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)
hgtMean <- mean(femaleHgtVector)
hgtSd <- sd(femaleHgtVector)
### Mean
hgtMean
## [1] 61.52
### Standard Deviation
hgtSd
## [1] 4.583667
#Determine the 68-95-99.7% Rule
#Find the range
Low68 <-hgtMean - hgtSd
High68 <-hgtMean + hgtSd
Low95 <-hgtMean - (2 * hgtSd)
High95 <-hgtMean + (2 * hgtSd)
Low99_7 <-hgtMean - (3 * hgtSd)
High99_7 <-hgtMean + (3 * hgtSd)
#Create a data frame listing the values
rangeSummary <- data.frame(Low68,High68,Low95,High95,Low99_7,High99_7)
rangeSummary
Low68 | High68 | Low95 | High95 | Low99_7 | High99_7 |
---|---|---|---|---|---|
56.93633 | 66.10367 | 52.35267 | 70.68733 | 47.769 | 75.271 |
### Check 68% rule for values within +/- 1 SD
OneSDPerc = length(femaleHgtVector[femaleHgtVector >= Low68 & femaleHgtVector <= High68])/length(femaleHgtVector)
OneSDPerc
## [1] 0.68
### Check 95% rule for values within +/- 2 SD
TwoSDPerc = length(femaleHgtVector[femaleHgtVector >= Low95 & femaleHgtVector <= High95])/length(femaleHgtVector)
TwoSDPerc
## [1] 0.96
### Check 99.7% rule for values within +/- 3 SD
ThreeSDPerc = length(femaleHgtVector[femaleHgtVector >= Low99_7 & femaleHgtVector <= High99_7])/length(femaleHgtVector)
round(ThreeSDPerc,2)
## [1] 1
Based on the above, the female student height distribution doesn’t completely follow 68-95-99.7% Rule.
Part (b): Do these data appear to follow a normal distribution? Explain your reasoning using the graphs provided below.
Ans:
Based on the density histogram and the normal probability distribution, it seems the outcome is unimodal and it somewhat follows a normal distribution but skews to the right towards the upper tails.
#Construct a density histogram
hist(femaleHgtVector, probability=TRUE, ylim=c(0,0.09))
x <-50:75
y <-dnorm(x=x, mean = hgtMean, sd=hgtSd)
lines (x=x, y=y, col="blue")
#Construct a normal probability plot
qqnorm(femaleHgtVector)
qqline(femaleHgtVector)
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.
Part (a): What is the probability that the 10th transistor produced is the first with a defect?
Ans:
#The success of Transistor production rate is 98%
#The faiilure rate is 2%
prob <- (0.98^9)*(0.02)
cat("Probability for 10th Transistor truning out to be a defect :", prob)
## Probability for 10th Transistor truning out to be a defect : 0.01667496
Part (b): What is the probability that the machine produces no defective transistors in a batch of 100?
Ans:
cat("Probability for not finding any defective transistor in a batch of 100 :", (0.98^100))
## Probability for not finding any defective transistor in a batch of 100 : 0.1326196
Part (c): On average, how many transistors would you expect to be produced before the first with a defect? What is the standard deviation?
Ans: Since this problem follows Geometric distribution, the average no. of production before finding the first defect will be represened by the mean, \(\mu\) = 1/p.
pDefect = 0.02
mean = 1/pDefect
cat("No. of Transistors produced before first defect :", round(mean,0))
## No. of Transistors produced before first defect : 50
For Geometric dsistribution, Standard Deviation, \(\sigma\) = \(\sqrt { 1-p/p^ 2 }\)
std <- sqrt((1 -pDefect)/pDefect^2)
cat("Standard Deviation :", std)
## Standard Deviation : 49.49747
Part (d): 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?
Ans:
pDefect = 0.05
mean = 1/pDefect
cat("No. of Transistors produced before first defect :", round(mean,0))
## No. of Transistors produced before first defect : 20
std <- sqrt((1 -pDefect)/pDefect^2)
cat("Standard Deviation :", std)
## Standard Deviation : 19.49359
Part (e): 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?
Ans: With the increase in probability of a success, the mean (avg. no. of trials for the 1st occurrence) and standard deviation get drastically reduced.
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.
Part (a): Use the binomial model to calculate the probability that two of them will be boys.
Ans: As per Binomial distribution model, the probability of at least k successes in n trials is denoted by the expression, (factorial(n)/(factorial(k)factorial(n-k)))p^k*(1-p)^(n-k)
n <- 3
k <- 2
pBoy <- 0.51
p <- (factorial(n)/(factorial(k)*factorial(n-k)))*pBoy^k*(1-pBoy)^(n-k)
cat ("Probability of having 2 boys out of 3 kids :",p)
## Probability of having 2 boys out of 3 kids : 0.382347
Part (b): 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.
Ans: Possible ordering of having 2 boys out of 3 kids -
A. Boy Boy Girl
B. Boy Girl Boy
C. Girl Boy Boy
Probability of each ordering = (0.51)^2*0.49 = 0.127449
Using the addition rule, total proabability = 3*0.127449 = 0.382347
This is exactly the same as derived by the Binomial model above.
Part (c): If we wanted to calculate the probability that a couple who plans to have 8 kids will have 3 boys, briefly describe
Ans:
As per Binomial distribution model, the probability of at least k successes in n trials is denoted by the expression, (factorial(n)/(factorial(k)factorial(n-k)))p^k*(1-p)^(n-k)
n <- 8
k <- 3
pBoy <- 0.51
p <- (factorial(n)/(factorial(k)*factorial(n-k)))*pBoy^k*(1-pBoy)^(n-k)
cat ("Probability of having 3 boys out of 8 kids :",p)
## Probability of having 3 boys out of 8 kids : 0.2098355
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.
Part (a): What is the probability that on the 10th try she will make her 3rd successful serve?
Ans: Since in this problem, we are trying to find the probability of kth success in nth trial, this follows negative Binomial distribution. This probability is defined as factorial(n-1)/(factorial(k-1)factorial(n-k))p^k*(1-p)^(n-k)
n <- 10
k <- 3
pSuccess <- 0.15
p <- factorial(n-1)/(factorial(k-1)*factorial(n-k))*pSuccess^k*(1-pSuccess)^(n-k)
cat("Probability of 3rd successful serve in 10th try :",p)
## Probability of 3rd successful serve in 10th try : 0.03895012
Part (b): Suppose she has made two successful serves in nine attempts. What is the probability that her 10th serve will be successful?
Ans: As stated in the question, all correct serves are independent of each other. Therefore, the probability that the 10th serve will be successful is 0.15.
Part (c): 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?
Ans: Part B talks about the 10th serve only, where the first 9 outcomes had already occurred. Given that this is independent, this is why the success rate is still 0.15. Whereas, in Part A, the first 9 attempts have NOT yet been attempted, and we do not know the outcomes of these events. Therefore, the calculations need to take into account for this, which is why we used the negative binomial equation.