Question: Question 2 . 2 ( 1 0 pt ) Write a function bootstrap, which takes a data series ( data ) as an input and
Question pt
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 numpyarray, 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
Output argument:
Numpy array of size numIter that contains the estimates of the statistic ie the bootstrap sample
Hints:
You can use nprandom.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
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
