How to compute the slop of bootstrap population with its confidence interval?

1 回表示 (過去 30 日間)
Andi
Andi 2022 年 8 月 14 日
コメント済み: Jeff Miller 2022 年 8 月 16 日
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
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.
Andi
Andi 2022 年 8 月 15 日
For slope, we use number of observations as X and Y is the bootstrap population. For example, if we set bootstrap population 30 then the x is 1, 2, 3... 30,
Regarding the second, point, I think it be good for me to test both approaches, and see how it effect my analysis.

サインインしてコメントする。

回答 (1 件)

Jeff Miller
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
  2 件のコメント
Andi
Andi 2022 年 8 月 16 日
and how about the confidnecve interval.
Jeff Miller
Jeff Miller 2022 年 8 月 16 日
see edit

サインインしてコメントする。

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by