How to computing confidence bounds of the regression model using the bootstrap method

조회 수: 9 (최근 30일)
I would like to compute and plot the bootstrap confidence bounds of the non-linear regression model. I have computed the bootstrap confidence intervals of the coefficients and now I want to visually display the confidence bounds. In other words, I would like to have something similar to the red dotted lines in this figure
Here is what I have done so far.
modelfun = @(b,t)( 100*b(1).*exp(-b(3).*(1-exp(-b(4).*t))./b(4)-b(2).*((exp(-b(4).*t)-1+b(4).*t)./b(4).^2)) );
b=[1.0190; 2.2297e-5; 6.668e-13; 8.3576e-6];
t=exprnd(2,100,1);
y = modelfun(b,t) + normrnd(0,0.1,100,1);
beta0 = [1; 0.0001; .0000000001; .000001];
beta = @(predictor,response)nlinfit(predictor,response,modelfun,beta0);
newci = bootci(100,{beta,t,y},'Alpha',0.01)
I do not know how to proceed from here.
I appreciate any insights that can help me solve my question. Thanks
  댓글 수: 1
Editor
Editor 2022년 10월 27일
Since I posted the question, I have not received any feedback from the community. Could it that my question is not clear? Can someone kindly advise.

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

채택된 답변

Jeff Miller
Jeff Miller 2022년 10월 28일
I'm assuming that your figure shows t on the horizontal axis and y on the vertical.
The problem is that bootci is giving you confidence intervals for the parameter values but what you really want (judging from the figure) is confidence intervals for the predicted y values at each t.
I think you can get those but it will be more work. You will have to use the bootstr function to generate bootstrap datasets, fit the model to each dataset, and then generate the predicted y values at each of a preselected set of t's for each bootstrap iteration. Then, after lots of iterations, you can look at the small and large (2.5% and 97.5%ile) y values that you generated for each t separately. Plotting the small ones vs t should give you your lower dotted line, and large versus t the upper.
I hope this is what you were asking for...

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Regression에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by