How perform bootstrap balanced resampling of a dataset?

1 Ansicht (letzte 30 Tage)
Yuchen Song
Yuchen Song am 8 Mär. 2020
Kommentiert: Yuchen Song am 8 Mär. 2020
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.

Akzeptierte Antwort

Jeff Miller
Jeff Miller am 8 Mär. 2020
Bearbeitet: Jeff Miller am 8 Mär. 2020
I'm not sure...is 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)

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by