BookmarkSubscribeRSS Feed

Using Simulation to Estimate the Coverage Probability of a Confidence Interval

Started ‎06-04-2014 by
Modified ‎04-04-2022 by
Views 2,795

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.

Version history
Last update:
‎04-04-2022 03:19 PM
Updated by:

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

Free course: Data Literacy Essentials

Data Literacy is for all, even absolute beginners. Jump on board with this free e-learning  and boost your career prospects.

Get Started

Article Tags