Bootstrap data in MATLAB

2019-06-11 11:09发布

问题:

I have data similar to this:

x = 0:0.1:10; y = exppdf(x,2); plot(x,y, 'o')

and then I want to have some resampled data close to them, but when I use the command below , the resampled data are really far from the original one!

[resampling, bootsam]=bootstrp(100, 'corr', x,y); plot(x,y(bootsam(:,100)), 'r*')

Could you please help me? I guess I need to change option 'corr' in the bootstrp command.

回答1:

I think this is what you are trying to do:

plot(x, sort(y(bootsam(:,100)), 'descend'), 'r*')

or maybe this:

plot(x(bootsam(:,100)),y(bootsam(:,100)), 'r*')

I guess it depends on what x is for you.