The estimator for the population variance will be the [[sample variance]] $S^2$. Recall that for a random sample $\frac{(n-1)S^2}{\sigma^2} \sim \chi^2(n-1)$ Note that the $\chi^2$ distribution is not symmetrical, so which critical values should we select to capture the true value with a probability equal to the desired confidence level? In this case, using the $\alpha/2$ and $1-\alpha/2$ gives a reasonable interval, but you could have intervals that start at 0 or end at $\infty$. In theory you could calculate an optimal (i.e., shortest) interval however that is rarely done in practice. Solving the following probability for a $100(1-\alpha)\%$ is the confidence level for $\sigma^2$ will yield the confidence interval. $P \Big ( \chi^2_{\alpha/2,n-1} < \frac{(n-1)S^2}{\sigma^2} < \chi^2_{1-\alpha/2, n-1} \Big ) = 100(1-\alpha)\%$ Note that because the $\chi^2$ distribution is not symmetrical, we cannot simplify this to a $S^2 \pm \text{margin of error}$ as the margin of error on either side might be different. Simplifying the inequality (note the inequality is flipped) we get $P \Big ( \frac{(n-1)S^2}{\chi^2_{\alpha/2, n-1}} < \sigma^2 < \frac{(n-1)S^2}{\chi^2_{1-\alpha/2,n-1}} \Big ) = 100(1-\alpha)\%$ Note that there is no sample size restriction for this test. ## R ```R # Assume you have the following sample data sample_data <- rnorm(15, mean=50, sd=10) # Sample size and variance n <- length(sample_data) s2 <- var(sample_data) # Confidence level, typically 95% alpha <- 0.05 # Chi-squared critical values lower_chi <- qchisq(alpha/2, df=n-1) upper_chi <- qchisq(1-alpha/2, df=n-1) # Confidence interval for the variance ci_variance_lower <- (n-1)*s2 / upper_chi ci_variance_upper <- (n-1)*s2 / lower_chi # Confidence interval for the standard deviation ci_sd_lower <- sqrt(ci_variance_lower) ci_sd_upper <- sqrt(ci_variance_upper) # Output the confidence interval ci_sd <- c(ci_sd_lower, ci_sd_upper) ci_sd ```