How can i develop a Regression line with a confidence level bracket around this line?
4 ビュー (過去 30 日間)
古いコメントを表示
I have a data set of temperature and energy use.
Temp Energy
I wanted to draw a scatter plot (which i could),and find a confidence level regression line over this scatter plot - any help? I want to see the shaded bracket around the regression line. I have just started with matlab, any help would be golden.
0 件のコメント
採用された回答
Star Strider
2016 年 9 月 29 日
I would use the polyfit and polyval functions for the regression, and the File Exchange contribution polypredci for the confidence intervals on the regression.
When you download polypredci, put it in your MATLAB user directory. That will allow you to use it as you would use any other function. On Windows computers, this is:
C:\Users\YourUserName\Documents\MATLAB\
4 件のコメント
Star Strider
2016 年 10 月 1 日
That is the accepted way to draw confidence intervals on the regression, because the uncertainty in the prediction increases with increasing distance from the mean of the x and y values. The built-in MATLAB routines in the Statistics and Machine Learning Toolbox and all the other statistics packages do the same. More data will make them straighter. (The ‘delta’ values calculated by polyval do the same, although I’ve never been able to figure out exactly what those are.)
How do you want to calculate the confidence intervals? One way might be to take ±1.96 times the standard error (standard deviation divided by the square root of the number of data points) of the y-data and draw lines parallel to the slope at those distances. This was the standard way to draw them back before computers made the precise computation of the confidence intervals easy.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Descriptive Statistics についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!