This function gives a demonstration of the concept of confidence intervals in mathematical statistics in this way: keep on drawing samples from the Normal distribution N(0, 1), computing the intervals based on a given confidence level and plotting them as segments in a graph. In the end, we may check the coverage rate against the given confidence level.
CIa matrix of confidence intervals for each sample
CRcoverage rate
Details
Intervals that cover the true parameter are denoted in gray color, otherwise in red color. As the process of drawing samples goes on, there will be a legend indicating the numbers of the two kinds of intervals respectively.
The argument nmax in control means the times of drawing samples.
References
George Casella and Roger L. Berger. Statistical Inference. Duxbury Press, 2th edition, 2001.