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,735

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

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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