Tutorial 2: Simulation, Estimation, Sampling variability and Robustness

When 16 seventeen-year-old women were randomly selected and tested with an aerobics test, the mean of their scores was found to be 37.9 with a sample standard deviation of 7.3. Construct both a 90% confidence interval and a 99% confidence interval for the mean. Write out the meaning of your findings.

This is a small sample since n=16. The Student-t distribution is needed. The 90% confidence interval is from 34.7 to 41.1. The 99% confidence interval is from 32.5 to 43.4. Interpretation: You can be 90% (or 99%) confident that the true mean of the population is inside the interval 34.7 to 41.1 (or 32.5 to 43.4) OR there is approximately a 0.90 (or 0.99) probability that the true mean is in the given interval.

# sample size
n_obs = 16

# empirical mean
x_bar <- 37.9

# empirical variance
s2 <- 7.3^2

# confidence interval risk 10%
alpha <- 0.1

# quantile of level 1-alpha/2 for the T(n-1) distribution
t_quant <- qt(1-alpha/2, df = n_obs-1)

# lower bound
lower_bound <- x_bar - t_quant * sqrt(s2) / sqrt(n_obs)

# upper bound
upper_bound <- x_bar + t_quant * sqrt(s2) / sqrt(n_obs)

c(lower_bound, upper_bound)
[1] 34.70068 41.09932
alpha <- 0.01

# quantile of level 1-alpha/2 for the T(n-1) distribution
t_quant <- qt(1-alpha/2, df = n_obs-1)

# lower bound
lower_bound <- x_bar - t_quant * sqrt(s2) / sqrt(n_obs)

# upper bound
upper_bound <- x_bar + t_quant * sqrt(s2) / sqrt(n_obs)

c(lower_bound, upper_bound)
[1] 32.52225 43.27775

source