# R code homework

Problem 1. This is about computing bootstrap confidence intervals.
A. Write a function sd.bootCI(x, level = 0.95, B = 2000) that returns a bootstrap pivotal confidence interval for the standard deviation based on a sample, a specified level, and a given number of bootstrap replicates.
B. Write a function sd.bootCI.student(x, level = 0.95, B = 2000) that returns a bootstrap Studentized pivotal confidence interval for the standard deviation. You have (at least) two avenues for estimating for the standard deviation of the sample standard deviation. Choose the first one if you can, otherwise choose the other (which is more computationally demanding): (a) Derive a closed form expression for the standard deviation of the sample standard deviation and then use a plug in to obtain an estimate. (No need to show how you derived it. In fact, you can search for that in books or online.) (b) Estimate the standard deviation of the sample standard deviation by bootstrap.
C. Perform some simulations to compare the two methods (pivotal and Studentized pivotal). For example, you can generate a sample of size n ∈ {10, 20, 50, 100, 200} from the exponential distribution with rate 1, compute the intervals, see if they include the true standard deviation and record their length, and repeat that N = 200 times, and present a summary of these experiments.