Resample with replacement - bootstrap Kolmogorov–Smirnov test

조회 수: 2 (최근 30일)
Bárbara Ferreira
Bárbara Ferreira 2019년 9월 8일
댓글: Adam Danz 2019년 9월 8일
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
Bárbara Ferreira
Bárbara Ferreira 2019년 9월 8일
I already have changed that.
Thank you!
Adam Danz
Adam Danz 2019년 9월 8일
Glad I could help!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by