How to fix the replacement rate in bootstrap method?

1 Ansicht (letzte 30 Tage)
Andi
Andi am 29 Jun. 2022
Kommentiert: Adam Danz am 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);
  1 Kommentar
Adam Danz
Adam Danz am 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.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Statistics and Machine Learning Toolbox finden Sie in Help Center und File Exchange

Tags

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by