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

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

Join us for our biggest event of the year!

Four days of inspiring keynotes, product reveals, hands-on learning opportunities, deep-dive demos, and peer-led breakouts. Don't miss out, May 6-9, in Orlando, Florida.

 

View the full agenda.

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