data generation using bootstrap method

Hi all,
I have a data series like 'a':
a= [50;46;28;31;38;49;52;33;38;32;61;90;42;42;45;29;36;30;27;20;31;30;34;23;];
I want to genarate more data which originated from 'a' using bootstrap method.
How can I write this program?
Thanks in advance.

답변 (1개)

José-Luis
José-Luis 2012년 12월 5일
편집: José-Luis 2012년 12월 5일

0 개 추천

Bootstrapping consists in selecting a subset of the data. That sounds like a job for randperm()
a = randi(60,1,50);
subsetSize = numel(a) - 1; %How many values in your bootstrap
numSamples = 10; %number of simulations
your_data = ones(numSamples,subsetSize); %one sample per row
for ii = 1:numSamples
your_data(ii,:) = a(randperm(subsetSize));
end
Note that you could also generate all possible subsets:
allSets = nchoosek(1:numel(a),subsetSize);
your_data = a(allSets);
And select your data from it, if you want to avoid repeated values.

댓글 수: 1

peach_R
peach_R 2024년 11월 9일
I wonder why it starts from a = randi(60,1,50) as I think that 60 means integer from 1 to 60 not from elements in 'a'.

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

카테고리

도움말 센터File Exchange에서 Logical에 대해 자세히 알아보기

태그

질문:

som
2012년 12월 5일

댓글:

2024년 11월 9일

Community Treasure Hunt

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

Start Hunting!

Translated by