I could not download ‘DATA606’ package as it is not compatible with the last version of R. I have manually taken function normalPlot() from the package. source: https://github.com/jbryer/DATA606/blob/master/R/normalPlot.R

normalPlot <- function(mean=0, sd=1, bounds=c(-1,1), tails=FALSE) {
  x <- seq(-4,4,length=100)*sd + mean
  hx <- dnorm(x,mean,sd)
  
  plot(x, hx, type="n", xlab="x-Axis", ylab="",
       main="Normal Distribution", axes=FALSE)
  lines(x, hx)
  
  if(tails) {
    i.low <- x <= bounds[1]
    i.high <- x >= bounds[2]
    polygon(c(x[i.low],bounds[1]), c(hx[i.low], 0), col="red")
    polygon(c(bounds[2],x[i.high]), c(0,hx[i.high]), col="red")
  } else {
    i <- x >= bounds[1] & x <= bounds[2]
    polygon(c(bounds[1],x[i],bounds[2]), c(0,hx[i],0), col="red")
    area <- pnorm(bounds[2], mean, sd) - pnorm(bounds[1], mean, sd)
    if(diff(bounds) > 0) {
      result <- paste("P(",bounds[1],"< x <",bounds[2],") =",
                      signif(area, digits=3))
      mtext(result,3)
    }
  }
  axis(1)
}

# normalPlot(mean = 0, sd = 1, bounds = c(-1.13, 4))

Distribution of a random variables

3.2

3.2 Area under the curve, Part II. What percent of a standard normal distribution N(mu = 0, sd = 1) is found in each region? Be sure to draw a graph. (a) Z >-1.13

pnorm(1.13, mean= 0, sd= 1 )
## [1] 0.8707619
normalPlot(bounds = c(-1.13, Inf))

  1. Z <0.18
pnorm(0.18, mean= 0, sd= 1)   
## [1] 0.5714237
normalPlot(bounds = c(-Inf, 0.18))

  1. Z >8
pnorm(8, mean= 0, sd= 1)
## [1] 1
normalPlot(bounds = c(8,Inf))

  1. |Z|<0.5
pnorm(0.5, mean=0, sd= 1)
## [1] 0.6914625
normalPlot(bounds = c(-0.5, 0.5))

3.4

  1. Write down the short-hand for these two normal distributions.
  1. What are the Z-scores for Leo’s and Mary’s finishing times? What do these Z-scores tell you?
Z_Leo<-(4948-4313)/583
Z_Leo
## [1] 1.089194
Z_Mary<-(5513 -5261)/807
Z_Mary
## [1] 0.3122677

Answer: Z score tells me how many standard deviation Leo or Mary from the groups’ mean. The more st deviation (+) the worse as it is rasing results (the faster the better)

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

Answer: Mary has better performance than Leo as his Z score higher and it’s negative for racing results.

  1. What percent of the triathletes did Leo finish faster than in his group?
1 - pnorm(4948, mean = 4313, sd = 583)
## [1] 0.1380342

Answer: Leo finished faster than 13.8% triathletes in his group.

  1. What percent of the triathletes did Mary finish faster than in her group?
1-pnorm(5513, mean = 5261, sd = 807)
## [1] 0.3774186

Answer: Mary finished faster than 37.7% triathletes in his group.

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

Z scores will remain same as it is replacing the measurement unit with “number of standard deviations” away from the mean. Whereas probability will not be the same as it should be calculated on a normaly distributed data with 68%/95%/99.7& rule.

3.18

Heights of female college students. Below are heights of 25 female college students.

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.
height <- 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)
hmean <- 61.52
hsd <- 4.58
pnorm(hmean+hsd, mean =  hmean, sd = hsd)
## [1] 0.8413447
pnorm(hmean+2*hsd, mean =  hmean, sd = hsd)
## [1] 0.9772499
pnorm(hmean+3*hsd, mean =  hmean, sd = hsd)
## [1] 0.9986501

Hight is approximatly follows the 68-95-97% rule.

84.13% of the data are within 1 standard deviation of the mean.

97.72% of the data are within 2 standard deviation of the mean.

99.86% of the data are within 3 standard deviation of the mean.

  1. Do these data appear to follow a normal distribution? Explain your reasoning using the graphs provided below.
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)
qqnorm(height)
qqline(height)

Data appears to follow a normal distribution as the points on the normal probability plot seem to follow a straight line. Also graph has typical for a normally distributed data bell curve.

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?

pgeom(10-1,0.02)
## [1] 0.1829272
  1. What is the probability that the machine produces no defective transistors in a batch of 100?
1-pgeom(100,0.02)
## [1] 0.1299672
  1. On average, how many transistors would you expect to be produced before the first with a defect? What is the standard deviation?
first_prob <- 1/0.02
first_prob
## [1] 50
sd <- sqrt((1 - 0.02)/0.02^2)
sd
## [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? What is the standard deviation?
first__prob2 <- 1/0.05
first__prob2
## [1] 20
sd2 <- sqrt((1 - 0.05)/0.05^2)
sd2
## [1] 19.49359
  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?

Mean(expected value) decreases as the probabilities of each event increases (less transistors are produced before the first with a defect).

Standard deviation also decreases as the likelihood of a defecdtive transistor is less spread out.

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

Answer: possible ordering of 3 children - gbb, bgb, bbg

prob <- ((0.49*0.51*0.51)+(0.51*0.49*0.51)+(0.51*0.51*0.49))
prob
## [1] 0.382347
  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).
dbinom(3,8,0.51)
## [1] 0.2098355

In this case number of combinations will be significantly higher and process will be very tedious and time consuming.

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?
# 1. probability of  2 successes in 9 trials
P = dbinom(2,9,0.15)
# 2. probability that she will be successful on her 10th try (3 success in total)
P * 0.15
## [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?

Probability is 0.15 (each serve is independant)

  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): joint probability of all of the first 10 trials Part (b): probability of the 10th trial only