Linear Regression plot with Confidence Intervals in MATLAB
In this article, we will discuss a simple code to plot a Linear Regression (LR) curve. The code is written in MATLAB and can be downloaded from my MATLAB repository. You can write to me (abhilash.singh@ieee.org) if you have any question or visit my web page for more updates.
In LR, our main objective is to find the best fitting straight line through the observed values. The best fitting line is called the regression line. The formula for LR is
y = m *x + c
where y is the predicted value, m is the slope of the line, and c is the intercept.
In MATLAB, we have used the regression command given by
were, b is a vector containing the coefficient estimates (only for Multiple LR) and bint is a matrix containing 95% confidence intervals for the coefficient estimates (only for Multiple LR).
You can refer to the publication from where the code is originated.