Problem 1

Let \(X \sim \text{Binomial}(28, 0.37)\).

(a) \(P(X > 10)\)

p1a <- pbinom(q = 10, size = 28, prob = 0.37, lower.tail = FALSE)
p1a
## [1] 0.4713774

The probability that \(X\) is greater than 10 is 0.4714. This shows that if we repeat this Binomial experiment (\(n=28\) trials, each with a 0.37 probability of success) many times, we would expect to see more than 10 successes in about 47.14% of those repetitions.

(b) \(P(6 < X \le 9)\)

p1b <- pbinom(q = 9, size = 28, prob = 0.37) - pbinom(q = 6, size = 28, prob = 0.37)
p1b
## [1] 0.3128212

The probability that \(X\) falls between 6 and 9 (inclusive of 9) is 0.3128. Note that because \(X\) is discrete, pbinom(q = 6, ...) correctly excludes \(X = 6\) from the count while pbinom(q = 9, ...) includes \(X = 9\), so the difference gives exactly \(P(6 < X \le 9)\).

(c) \(P(X \ge 14)\)

p1c <- pbinom(q = 13, size = 28, prob = 0.37, lower.tail = FALSE)
p1c
## [1] 0.1106816

Since \(X\) is discrete, \(P(X \ge 14) = P(X > 13) = 1 - P(X \le 13)\), which is what pbinom(q = 13, ..., lower.tail = FALSE) shows. The probability is 0.1107, meaning it is somewhat unlikely (about a 11.1% chance) to observe 14 or more successes out of 28 trials when the true success probability is only 0.37.

Problem 2

Let \(X \sim N(100, 9^2)\). We generate and store a sample of \(n = 2000\) values of \(X\).

set.seed(2611)
x <- rnorm(n = 2000, mean = 100, sd = 9)

(a) Estimated vs. exact probabilities

# Estimated probabilities using the sample
est_p_ge72   <- mean(x >= 72)
est_p_90_95  <- mean(x >= 90 & x <= 95)

# Exact probabilities using the Normal distribution formulas
exact_p_ge72  <- pnorm(q = 72, mean = 100, sd = 9, lower.tail = FALSE)
exact_p_90_95 <- pnorm(q = 95, mean = 100, sd = 9) - pnorm(q = 90, mean = 100, sd = 9)

kable(data.frame(
  Probability = c("P(X >= 72)", "P(90 <= X <= 95)"),
  Estimated   = round(c(est_p_ge72, est_p_90_95), 4),
  Exact       = round(c(exact_p_ge72, exact_p_90_95), 4)
))
Probability Estimated Exact
P(X >= 72) 0.9995 0.9991
P(90 <= X <= 95) 0.1695 0.1560

The sample-based (estimated) probability of \(P(X \ge 72)\) is 0.9995, compared to the exact probability of 0.9991 calculated from the \(N(100,9^2)\) distribution — a difference of only 4^{-4}. Similarly, the estimated \(P(90 \le X \le 95)\) is 0.1695, versus an exact value of 0.156, a difference of 0.0135. Both estimated probabilities are very close to their exact counterparts, which makes sense because a sample size of \(n = 2000\) is large enough for the sample proportions to closely approximate the true population probabilities.

(b) Estimated vs. exact expected value and standard deviation

est_mean <- mean(x)
est_sd   <- sd(x)

kable(data.frame(
  Statistic = c("Mean", "Standard Deviation"),
  Estimated = round(c(est_mean, est_sd), 4),
  Exact     = c(100, 9)
))
Statistic Estimated Exact
Mean 100.0664 100
Standard Deviation 8.9173 9

The sample mean is 100.0664, extremely close to the exact population mean of \(\mu = 100\), and the sample standard deviation is 8.9173, extremely close to the exact population standard deviation of \(\sigma = 9\). This close agreement is expected: with a large random sample (\(n=2000\)) drawn from a \(N(100, 9^2)\) population, the sample mean and standard deviation should converge to the true population parameters.

(c) Histogram of the sample

x_df <- data.frame(x)

ggplot(data = x_df, aes(x = x)) +
  geom_histogram(bins = 30, fill = "steelblue4", colour = "navy") +
  labs(title = "Histogram of Simulated Sample from X ~ N(100, 9^2)",
       x = "Simulated Value of X",
       y = "Frequency")

The histogram is roughly symmetric and bell-shaped, centered at approximately 100.1, which matches the estimated (and exact) mean from part (b). Most of the values fall within roughly one to two standard deviations (about 8.9) of the center, and the spread of the bars tapering off toward the tails on both sides visually confirms the estimated standard deviation — consistent with the shape we would expect from a Normal distribution with \(\mu = 100\) and \(\sigma = 9\).

Problem 3

Let \(X \sim N(18, 2^2)\).

(a) \(P(19 \le X \le 20)\)

p3a <- pnorm(q = 20, mean = 18, sd = 2) - pnorm(q = 19, mean = 18, sd = 2)
p3a
## [1] 0.1498823

The probability that \(X\) falls between 19 and 20 is 0.1499.

(b) \(P(X \ge 15)\)

p3b <- pnorm(q = 15, mean = 18, sd = 2, lower.tail = FALSE)
p3b
## [1] 0.9331928

The probability that \(X\) is at least 15 is 0.9332, meaning about 93.3% of the distribution lies at or above 15 — which makes sense since 15 is only 1.5 standard deviations below the mean of 18.

(c) 95th and 10th percentiles of X

p95 <- qnorm(p = 0.95, mean = 18, sd = 2)
p10 <- qnorm(p = 0.10, mean = 18, sd = 2)
p95
## [1] 21.28971
p10
## [1] 15.4369

The 95th percentile of \(X\) is 21.2897, meaning 95% of values of \(X\) fall at or below 21.2897. The 10th percentile is 15.4369, meaning only 10% of values of \(X\) fall at or below 15.4369.

Problem 4

Using the built-in ChickWeight data frame.

(a) Normal QQ Plot of weight

ggplot(ChickWeight, aes(sample = weight)) +
  geom_qq(colour = "firebrick3", shape = 17, size = 2) +
  geom_qq_line(colour = "goldenrod3") +
  labs(title = "Normal QQ Plot of Chick Weight",
       x = "Theoretical Quantiles",
       y = "Sample Quantiles")

The points spread out slightly from the QQ line, especially in the upper tail, where the sample quantiles curve upward and away from the line. This upward bend indicates the “weight” data is right-skewed (has a longer right tail than a Normal distribution would), so the overall (ungrouped) weight data does not appear to be statistically likely to follow a normal distribution.

(b) Normal QQ Plot of weight grouped by diet

ggplot(ChickWeight, aes(sample = weight, colour = Diet, shape = Diet)) +
  geom_qq() +
  geom_qq_line() +
  labs(title = "Normal QQ Plot of Chick Weight by Diet",
       x = "Theoretical Quantiles",
       y = "Sample Quantiles") +
  scale_colour_manual(values = c("steelblue4", "firebrick3", "darkorchid4", "chocolate3")) +
  scale_shape_manual(values = c(15, 16, 17, 18))

When grouped by diet, each diet group’s points fall noticeably closer to their respective QQ lines than the ungrouped data did in part (a), although some deviation still remains in the tails for a few of the diet groups.

(c) Comparison

Compared to the single ungrouped QQ plot in part (a), the QQ plots grouped by diet in part (b) show points that track their QQ lines more closely overall. This suggests that at least part of the non-normality seen in part (a) was due to mixing together four different diet groups (each with a somewhat different weight distribution) into a single sample. Once the data is separated by diet, each individual group’s weights appear closer to satisfying the assumption of normality, though some tail deviation persists in the grouped plots as well, so normality is only approximately, not perfectly, satisfied even after grouping.