SAS Communities Library

We’re smarter together. Learn from this collection of community knowledge and add your expertise.
BookmarkSubscribeRSS Feed

Using Simulation to Estimate the Coverage Probability of a Confidence Interval

Started ‎06-04-2014 by
Modified ‎04-04-2022 by
Views 4,895

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-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

Register now!

SAS AI and Machine Learning Courses

The rapid growth of AI technologies is driving an AI skills gap and demand for AI talent. Ready to grow your AI literacy? SAS offers free ways to get started for beginners, business leaders, and analytics professionals of all skill levels. Your future self will thank you.

Get started

Article Tags