How does the regress function work?

조회 수: 4 (최근 30일)
Dylan Blosser
Dylan Blosser 2012년 11월 20일
댓글: 涛 丁 2022년 9월 23일
Here is the sample code below:
LF = [-1.9659;-1.9274;-1.9229;-1.8499;-1.8524;-1.8509];
LN = [1.0000;1.0414;1.0792;1.1139;1.1461;1.1761];
xf = [LN ones(10,1)]
[b,bINT,R,RINT,STATS]=regress(LF,xf,0.05)
I've figured out how to calculate b manually. My problem is calculating bINT. MATLAB prints out this as the result of bINT:
bINT = [0.3475 1.0852;-3.0814 -2.2741]
bint description from MATLAB: returns a p-by-2 matrix bint of 95% confidence intervals for the coefficient estimates. The first column of bint contains lower confidence bounds for each of the p coefficient estimates; the second column contains upper confidence. bounds.
I know how to find the confidence interval of given data. My question is what data is MATLAB using to calculate this interval? I've tried using LF as the data, and I've tried using LN as the data.
Does anyone have any ideas on how to calculate bINT?
Thanks
  댓글 수: 1
涛 丁
涛 丁 2022년 9월 23일
You can use 'type regress' to see the source code of C language.

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

답변 (1개)

Star Strider
Star Strider 2012년 11월 21일
The short answer to the bINT calculation is given in the discussion on Coefficient Confidence Intervals. The standard error, SE, is calculated from the Jacobian (J) of the regression model and the standard deviation of the residuals (R), and the number of observations (N):
SE = sqrt(diag(J'*J)) * sqrt(R'*R / N)

카테고리

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