The empirical confidence level

Change the code in the R function getcis so that it also returns the vector, ind, where ind[i] = 1 if the ith confidence interval is successful and 0 otherwise. Show that the empirical confidence level is mean(ind).

(a) Run 10,000 simulations for the normal setup in Exercise 4.2.11 and compute the empirical confidence level.

Exercise 4.2.11

Let be a random sample from a N(0, 1) distribution. Then the probability that the random interval verify this empirically, in this exercise, we simulate m such intervals and calculate the proportion that trap 0, which should be “close” to (1 − α).

(a) Set n = 10 and m = 50. Run the R code mat=matrix(rnorm(m*n),ncol=n) which generates m samples of size n from the N(0, 1) distribution. Each row of the matrix mat contains a sample. For this matrix of samples, the function below computes the (1 − α)100% confidence intervals, returning them in a m × 2 matrix. Run this function on your generated matrix mat. What is the proportion of successful confidence intervals?

(b) Run the following code which plots the intervals. Label the successful intervals. Comment on the variability of the lengths of the confidence intervals.

(b) Run 10,000 simulations when the sampling is from the Cauchy distribution, (1.8.8), and compute the empirical confidence level. Does it differ from (a)? Note that the R code rcauchy(k) returns a sample of size k from this Cauchy distribution.

(c) Note that these empirical confidence levels are proportions from samples that are independent. Hence, use the 95% confidence interval given in expression (4.2.14) to statistically investigate whether or not the true confidence levels differ. Comment.

Posted in Uncategorized

Leave a Reply