How does the regress function work?

6 visualizaciones (últimos 30 días)
Dylan Blosser
Dylan Blosser el 20 de Nov. de 2012
Comentada: 涛 丁 el 23 de Sept. de 2022
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 comentario
涛 丁
涛 丁 el 23 de Sept. de 2022
You can use 'type regress' to see the source code of C language.

Iniciar sesión para comentar.

Respuestas (1)

Star Strider
Star Strider el 21 de Nov. de 2012
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)

Community Treasure Hunt

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

Start Hunting!

Translated by