Resample with replacement - bootstrap Kolmogorov–Smirnov test

2 次查看(过去 30 天)
Good afternoon,
I am trying to apply the bootstrap Kolmogorov–Smirnov test developed by Abadie (2002) to test if two series of results are from the same continuous distribution.
The first step of the methodology is the application of the ks test to the original series of results:
[ks_h,ks_p] = kstest2(results_1, results_50);
Then I need to resample n observations (in results_1 and in results_50) with replacement. I took a look at some Matlab built in functions but it seems to me that none of them do exactly what is proposed by Abadie (2002). The bootstrp function returns the result of some calculation (bootfun argument)made with the resampled series (and I just want the resampled series). The datasample function returns a subsample (and that is not what I need).
How can I resample n observations with replacement without using this kind of built in functions? Please find attached the paper with the described methodology.
Thanks in advance!

采纳的回答

Adam Danz
Adam Danz 2019-9-8
编辑:Adam Danz 2019-9-8
"How can I resample n observations with replacement without using this kind of built in functions?"
Those function can be useful for your needs but to resample your data with replacement all you need is randi().
nResamp = 1000; % number of resamples; use numel(results_1) to equate sample size.
results_1_resamp = results_1(randi(numel(results_1),1,nResamp));
results_50_resamp = results_50(randi(numel(results_50),1,nResamp));
*Assuming results_1 and _50 are vectors.
  6 个评论

请先登录,再进行评论。

更多回答(0 个)

Community Treasure Hunt

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

Start Hunting!

Translated by