How perform bootstrap balanced resampling of a dataset?

6 views (last 30 days)
Basically, I'm trying to perform a bootstrap balanced resampling of a dataset K times, where data is an [N*1] vector of data samples, and the output should be an [N*K] matrix of bootstrap resampled data, where data d1 to dN each appear (randomly dispersed) exactly K times. I figured out how to do the resampling by using the unidrnd function, but I don't know how to make the data sets randomly appears K times. Please help.

Accepted Answer

Jeff Miller
Jeff Miller on 8 Mar 2020
Edited: Jeff Miller on 8 Mar 2020
I'm not this what you want?
N = 7; % Small values of N an d K to make it easier to see what it does.
K = 5;
data = rand(N,1);
kcopies = repmat(data,K,1);
shuffled = kcopies(randperm(numel(kcopies)));
output = reshape(shuffled,N,K)
  1 Comment
Yuchen Song
Yuchen Song on 8 Mar 2020
Yes! That's exactly what I'm looking for! Thank you so much!

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!