How to compute the slop of bootstrap population with its confidence interval?
1 回表示 (過去 30 日間)
古いコメントを表示
Hi everyone,
I read through all the documentions and avaible function of Bootsrap in matlab most of them compute the mean or correlation of each iteration. However, i need to compute the slop of bootstrap population. For example:
My data set consist of around 50 observations, i like to randomly pick 100 observations with replacmenet for 2000 bootstrap iterations. For each iteration, i require to compute the slop and eventually, i will get 2000 slop observations. Then i need to compute the 95% confidence interval of these observations.
May someone suggets me how i can do this:
Here is a simpel start:
A = [0.045494, 0.065669, 0.073061, 0.104542, 0.296978, 0.498353, 0.503342...
0.515458, 0.660300, 0.663664, 0.677255, 0.724817, 0.805800, 0.899355...
0.987775, 2.121619, 2.165055, 2.196833, 3.265653, 3.479858, 8.702472 ...
10.070092, 10.720080, 12.896169, 12.912647, 14.24436,1 14.287428, 17.337397, 18.903783, 20.940314, 21.404639, 22.234169]
% A is the data
m = bootstrp(100,@mean,A);
2 件のコメント
Jeff Miller
2022 年 8 月 15 日
I think we need a bit more information about what you are trying to do.
First, what do you mean by slope (e.g., how would you compute the slope just for the single sample A that you show)? To compute a slope requires (X,Y) pairs, but you only seem to be using a single variable (values of A).
Second, your values of A are sorted from largest to smallest. Is that important for your analysis? If you take random bootstrap samples from A, the sample values will be in random order.
回答 (1 件)
Jeff Miller
2022 年 8 月 16 日
編集済み: Jeff Miller
2022 年 8 月 16 日
It sounds like this is what you are after, although I'm not sure why you want to do it:
m = bootstrp(100,@mySlope,A);
LowerCI = prctile(m,2.5); % lower / upper bounds for 95% conf interval
UpperCI = prctile(m,97.5);
function slope = mySlope(Yvals)
Xvals = 1:numel(Yvals);
P = polyfit(Xvals,Yvals,1);
slope = P(1);
end
参考
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!