How does the regress function work?

4 vues (au cours des 30 derniers jours)
Dylan Blosser
Dylan Blosser le 20 Nov 2012
Commenté : 涛 丁 le 23 Sep 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 commentaire
涛 丁
涛 丁 le 23 Sep 2022
You can use 'type regress' to see the source code of C language.

Connectez-vous pour commenter.

Réponses (1)

Star Strider
Star Strider le 21 Nov 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