############################################################### # the Central Limit Theorem: Exercises # (from file Exercises_01-The central limit theorem.pdf) ############################################################### # Problems "number of samples for a probability alpha of sample mean exceeding threshold" # X - N(mu, sigma^2), X = mu + sigma * Z (Z standard normal) # compute the 1-alpha quantile of Z, z.alpha # the 1-alpha quantile of X will be x.alpha = mu + sigma * z.alpha # taking the sample mean X bar with n samples, X bar - N(mu, sigma^2/n) # therefore x.bar.alpha = mu + (sigma / sqrt(n)) * z.alpha # setting threshold = mu + delta, # we want to find n s.t. mu + delta = x.bar.alpha # solving the equation, we have n = ((sigma * z.alpha) / delta) ^ 2 mu <- 7 sigma <- 2 alpha <- 0.05 threshold <- 7.1 delta <- threshold - mu z.alpha <- qnorm(1-alpha) z.alpha x.alpha <- mu + sigma * z.alpha x.alpha n <- 10 x.bar.alpha <- mu + (sigma / sqrt(n)) * z.alpha x.bar.alpha n = ((sigma * z.alpha) / delta) ^ 2 n qnorm(1-alpha, mean=mu, sd=sigma/sqrt(n)) # EXERCISE 6 ############### mu <- 1.3 sigma <- 0.1 n <- 200 # CLT var.x.bar <- sigma^2/n sd.x.bar <- sqrt(var.x.bar) # a) Probability that the sample mean warpage exceeds 1.305 mm 1 - pnorm(1.305, mean = mu, sd = sd.x.bar) # b) 25th percentile of the sample mean qnorm(0.25, mean = mu, sd = sd.x.bar) # c) Number of wafers to sample for a 0.05 probability of exceeding 1.305 w <- (qnorm(0.95, mean = 0, sd = sigma) / (1.305 - mu))^2 w pnorm(1.305, mean=mu, sd=sigma/sqrt(w)) # EXERCISE 8 ############### mu <- 30.01 sd <- 0.1 n <- 50 # a) Probability that the total amount of solution in 50 drums is more than 1500 L 1 - pnorm(1500, mean = n * mu, sd = sd * sqrt(n)) # b) Probability that 80 drums can be filled without running out given the total amount is 2401 L n <- 80 pnorm(2401, mean = n * mu, sd = sd * sqrt(80)) # c) Solution amount needed for a 0.9 probability that 80 drums can be filled without running out qnorm(0.9, mean = n * mu, sd = sd * sqrt(80)) # EXERCISE 13 ############### # Given parameters lambda.A <- 20 # mean rate for mass A lambda.B <- 25 # mean rate for mass B time.period <- 5 # a) Probability that fewer than 200 particles are emitted by both masses together in a five-minute time period lambda.total <- time.period * (lambda.A + lambda.B) lambda.total # Exaxt solution ppois(199, lambda = lambda.total) # Normal approximation via CLT sd.total <- sqrt(time.period * (lambda.A + lambda.B)) # Using normal approximation pnorm(200, mean = lambda.total, sd = sd.total) # b) Probability that mass B emits more particles than mass A in a two-minute time period lambda.diff <- 2 * (lambda.B - lambda.A) sd.diff <- sqrt(2 * (lambda.A + lambda.B)) # Using normal approximation 1 - pnorm(0, mean = lambda.diff, sd = sd.diff) # EXERCISE 16 ############### mu <- 40 sd <- 5 n <- 100 sd.x.bar <- sd / sqrt(n) # a) Probability that X is less than or equal to 36.7 hours pnorm(36.7, mean=mu, sd=sd.x.bar) # d) Probability that X is less than or equal to 39.8 hours pnorm(39.8, mean=mu, sd=sd.x.bar) # EXERCISE 18 ############### mu1 <- 0.5 sd1 <- 0.4 mu2 <- 0.6 sd2 <- 0.5 n <- 100 # a) Probability that the total time used by machine 1 is greater than 55 hours mu.t1 <- n * mu1 sd.t1 <- sqrt(n) * sd1 1 - pnorm(55, mean = mu.t1, sd = sd.t1) # b) Probability that the total time used by machine 2 is less than 55 hours mu.t2 <- n * mu2 sd.t2 <- sqrt(n) * sd2 pnorm(55, mean = mu.t2, sd = sd.t2) # c) Probability that the total time used by both machines together is greater than 115 hours mu.sum <- n * (mu1 + mu2) sd.sum <- sqrt(n) * sqrt(sd1^2 + sd2^2) 1 - pnorm(115, mean = mu.sum, sd = sd.sum) # d) Probability that the total time used by machine 1 is greater than the total time used by machine 2 mean.diff <- mu.t1 - mu.t2 sd.diff <- sqrt(sd.t1^2 + sd.t2^2) 1 - pnorm(0, mean = mean.diff, sd = sd.diff)