This program uses simulation to estimate the coverage probability of the exact 95% confidence interval for normally distributed N(0,1) data. The confidence interval is [xbar - delta, xbar + delta], where xbar is the sample mean, delta = t_{alpha/2, n-1} s / sqrt(n), and s is the sample standard deviation.
The program is from page 77 of Wicklin (2013), Simulating Data with SAS. The program simulates 10,000 samples from the normal distribution, and each sample contains 50 observations. (You can change those values by changing the macro variables N and NumSamples.) The program prints an estimate of the coverage probability: the percentage of samples that produce a confidence interval that contains the true mean (0) of the population.
The program also creates a histogram of the sampling distribution of the mean. Theory says that this distribution should be a t distribution with n-1 degrees of freedom.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
Data Literacy is for all, even absolute beginners. Jump on board with this free e-learning and boost your career prospects.