how to plot prediction and confidence interval

조회 수: 14 (최근 30일)
piethal
piethal 2016년 2월 3일
댓글: the cyclist 2016년 2월 3일
Hi all,
I try to plot a prediction interval and a Confidence interval, of a linear regression fit. The prediction interval seem to be fine, but the confidence interval seems to be wrong. For the confidence interval I use ‘’ confint’’, see File.
Suggestions? Thanks a lot!!!
Matlab r2014a
  댓글 수: 1
the cyclist
the cyclist 2016년 2월 3일
Could you upload the image you get? I don't have the curve-fitting toolbox, so I can't run your code, but I'm curious about your result.
Also, can you be more specific about why you think the confidence interval is wrong? (Sometimes people have misconceptions about the relationship between these intervals.)

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

채택된 답변

dpb
dpb 2016년 2월 3일
편집: dpb 2016년 2월 3일
p = predint(fitresult,x,0.95,'observation','off');
ci = confint(fitresult,0.95);
ciup = polyval( ci(2,:),x);
cilow = polyval(ci(1,:),x);
NO! ci ARE the confidence limits; they are bounds on the coefficients themselves, hence only an upper/lower for each of the N+1 coefficients. Remove the last two lines entirely; they're a total misuse of ci
All you can plot for them would be something like
errorbar([0 1],coeffvalues(fitresult),ci(1,:),ci(2,:),'x')

추가 답변 (1개)

piethal
piethal 2016년 2월 3일
Thanks I knew there was something wrong whit my understanding of confint. Can I use
ci = predint(fitresult,x,0.95,'functional','off');
to calculate the confidence interval?
Thanks,
  댓글 수: 2
dpb
dpb 2016년 2월 3일
Confidence interval of what??? predint is, as the name implies and the document states, the prediction interval for a new observation.
"Confidence interval" refers to a sample statistic like the coefficients or the sample mean or the like.
the cyclist
the cyclist 2016년 2월 3일
You can generate a confidence interval for the fitted curve (as opposed to the coefficients of the curve). The only way I know how to do this is via bootstrap resampling. See my answer to this question for an example.

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

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by