필터 지우기
필터 지우기

Plot confidence interval for the slope

조회 수: 3 (최근 30일)
Lucile
Lucile 2012년 12월 3일
Hi all,
I've been looking for an answer for a while, but it seems nobody asked it before.
So : I have a linear regression. I can find the confidence interval of the slope with the regress function. It gives me 2 numbers (for the slope). Of course. But how to plot it ? I mean, plots of the "confidence interval of the slope" look like curves when I google it. How do I obtain those curves ?
Thank you very much for your help !
Lucile

채택된 답변

Wayne King
Wayne King 2012년 12월 3일
편집: Wayne King 2012년 12월 3일
You will get more than the confidence interval of the slope. In a simple linear (1st order) regression model, keep in mind that you will have a confidence interval for the intercept and the slope terms. You can plot those lines as confidence bounds, see the following example
load carsmall
x1 = Weight;
y = MPG;
X = [ones(size(x1)) x1];
[b,bint] = regress(y,X)
xval = min(x1):0.01:max(x1);
yhat = b(1)+b(2)*xval;
ylow = bint(1,1)+bint(2,1)*xval;
yupp = bint(1,2)+bint(2,2)*xval;
plot(x1,y,'k*');
hold on;
plot(xval,ylow,'r-.');
plot(xval,yupp,'r-.');
plot(xval,yhat,'b','linewidth',2);
  댓글 수: 1
Lucile
Lucile 2012년 12월 3일
Thank you very much for your answer ! Problem solved ! (and I feel stupid)

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

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by