Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Problem 4. This problem is to be done in R. When computing the bootstrap, there are two extremes we talked about in class: either completely
Problem 4. This problem is to be done in R. When computing the bootstrap, there are two extremes we talked about in class: either completely enumerating all of the possible cases (which is compu- tationally infeasible most of the time), or drawing of a few samples at random with possibility of repetition. In between these is an algorithm known as the Balanced Bootstrap. The algorithm goes as follows: Generate a list of B repetitions of each of the observations in our original data set, X1, ... , Xn, that is, X1, ... , X1 (B times), 22, ... , Xx (again, B times), and so on to In, ... , Xn (B times). This is a total of nB elements. Permute this list completely at random. Take the first n elements as bootstrap replicate 1, the second n elements as bootstrap replicate 2, and so on, obtaining B bootstrap replicates. For this question, implement a function balanced boot which takes two arguments: dat (for the inputs) and B (for the number of replicates). In this function, implement a Balanced Bootstrap estimate of the mean. Return the set of replicates. Test this function using n = 15 and n = 30 samples drawn from a standard normal (N(0,1)) and estimate the standard error in both cases. Compare these quantities to the theoretical values they are estimating. Problem 4. This problem is to be done in R. When computing the bootstrap, there are two extremes we talked about in class: either completely enumerating all of the possible cases (which is compu- tationally infeasible most of the time), or drawing of a few samples at random with possibility of repetition. In between these is an algorithm known as the Balanced Bootstrap. The algorithm goes as follows: Generate a list of B repetitions of each of the observations in our original data set, X1, ... , Xn, that is, X1, ... , X1 (B times), 22, ... , Xx (again, B times), and so on to In, ... , Xn (B times). This is a total of nB elements. Permute this list completely at random. Take the first n elements as bootstrap replicate 1, the second n elements as bootstrap replicate 2, and so on, obtaining B bootstrap replicates. For this question, implement a function balanced boot which takes two arguments: dat (for the inputs) and B (for the number of replicates). In this function, implement a Balanced Bootstrap estimate of the mean. Return the set of replicates. Test this function using n = 15 and n = 30 samples drawn from a standard normal (N(0,1)) and estimate the standard error in both cases. Compare these quantities to the theoretical values they are estimating
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started