# How to fix the replacement rate in bootstrap method?

3 views (last 30 days)
Andi on 29 Jun 2022
Commented: Adam Danz on 29 Jun 2022
Hi everyone,
My script of bootstrap resampling working very well. However, I require to visulize my data in different aspects. For example, I want to see the variation of bootstrap mean and its upper/lower limits, when i vary the length of bootstrap window and fix the replacement rate.
My data set consists of 168 rows and varying number of columns (20 to 60 after removing nan enteries). Afterward, I use my bootstrap scipt for nboots=2000, and get a mean value along its upper lower bounds. However, in my script there is no option to fix the replacement rate. For exmaple, I want to compute the bootsrap in such a way that length of random matrix is 20 with a replacement of 2, 4, 8, 10 values.
May someoen help me to modify my script:
s=data;
nBoot=2000;
for i=1:148;
bb=s(:,i);
X = bb(~isnan(bb));
[bci(:,i),bmeans(:,i)] = bootci(nBoot,{@mean,X},'alpha',.05,'type','norm');
bmu(i,1) = mean(bmeans(:,i));
end
R_bound=bci';
R_mean=bmu;
R_upper=R_bound(:,2);
R_lower=R_bound(:,1);
Adam Danz on 29 Jun 2022
To create each bootstrap sample, bootci randomly selects with replacement n out of the n rows of data. If your question is how to change the value of n, you'll need to temporarily change the data between each bootstrap sample which will require making your own custom bootstrap function. You could use randi to make a radome selection of n rows of data with replacement.

### Categories

Find more on Time Series Objects in Help Center and File Exchange

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!