Question: Question 2 . 2 ( 1 0 pt ) Write a function bootstrap, which takes a data series ( data ) as an input and

Question 2.2(10pt)
Write a function bootstrap, which takes a data series (data) as an input and then performs a bootstrap. The function should take numIter samples from the data (with replacement) of size N. It should then calculate the statistics defined in fcn for each iteration and record it in a numpy-array, which it should then return.
Input arguments
data: data series to resample
N: Sample size for each iteration
fcn: function to apply to the sample to get the statistics
numIter: Number of resamples (should default to 1000)
Output argument:
Numpy array of size numIter that contains the estimates of the statistic (i.e. the bootstrap sample)
Hints:
You can use np.random.choice to draw a sample (with or without replacement) from a data series

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!