

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


Name: ________________________________________ 22S:166 Computing in Statistics Instructor: Cowles PRACTICE PROBLEMS for Midterm 2, 2007 Instructions: You may use Windows R, or if you prefer, you may log into a Linux computer and run Linux R. Copy and paste your solutions into this Word document. Submit your exam by uploading the Word document into ICON.
library(boot) boot.out <- boot( mydat, qfunc, R=100) percentile.ci <- boot.ci(boot.out, .90, type="perc")$perc[4:5] Use the above code as part of an R function (or functions) to carry out a simulation study to estimate the coverage of nominal 90% bootstrap percentile confidence intervals when the population distribution is Gamma(2,5) and the sample size is 20. Note that the following line of R code calculates the true theoretical .1 quantile in a Gamma(2,5) population: truth <- qgamma( 0.1, 2,5) Since the bootstrap is computationally intensive, a simulation study of the bootstrap could take a very long time! While you’re coding and testing your R function(s), use no more than 5 replicate datasets and R no larger than 5 in the “boot” function. When you do the final run of simulation study, use 100 replicate datasets and R=100. a. Paste your R code here. b. Paste the output here.