95% confidence interval on a linear regression with polyfit?

106 vues (au cours des 30 derniers jours)
Jesse
Jesse le 8 Sep 2014
Modifié(e) : Chad Greene le 6 Août 2018
Greetings once again all,
Pardon the title line, but if it shows confusion on my end, it's because I am!
I am trying to find a 95% confidence interval on my data set of 15 values. I did use polyfit to receive the slope and intercept, so I take it the next steps are the standard error and the t-test/Student's T-distribution (???).
But, there are so many functions and methods out there (I've done a search) it's confusing to me as I am doing this for the first time.
I do have some code already, and I'd like to get this nailed down and understand the concepts behind it.
[p2,S2] = polyfit(Data1,Data2(:,3),1);
slope_p2 = p2(1);
intercept_p2= p2(2);
Just stuck on what to do after this. I see suggestions for lscov, polyconf, fitlm, and the list goes on.
Any suggestions and teaching points would be very helpful. And I do have the statistics toolbox if that helps.
Thanks!

Réponse acceptée

Star Strider
Star Strider le 8 Sep 2014
Modifié(e) : Star Strider le 8 Sep 2014
If you want to do a linear regression and you have the Statistics Toolbox, my choice would be the regress function. If you ask it, you can get the regression coefficients and their confidence intervals, and the confidence intervals on the fit, as well as other statistics. All that information is in the documentation, so I won’t repeat it here.
If you want to stay with polyfit and polyval, asking polyval for ‘delta’ produces what appear from the documentation as standard errors of the estimate for various estimated values of y. You can calculate the 95% confidence intervals using the inverse t-statistic with n-2 degrees of freedom, n being the number of data pairs. Multiply each ‘delta’ by the same t-score.
If you want the 95% confidence limits on the parameter estimates calculated by polyfit, the File Exchange function polyparci can provide them.
  8 commentaires
Jesse
Jesse le 17 Sep 2014
Awesome - standing by!
Jesse
Jesse le 17 Sep 2014
Modifié(e) : Jesse le 17 Sep 2014
Ok Star Strider - response sent.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Descriptive Statistics dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by