Least Square Regression in MATLAB Programming
MATLAB Curve Fitting Toolbox™ software makes use of the method of least squares
when fitting data. Fitting requires a parametric model that makes relationship of the response
data to the predictor data with one or more coefficients. The result of the fitting process is
an approximate of the model coefficients. To obtain the coefficient estimates, the least-squares
method reduces the summed square of residuals. The residual for the ith data point ri is
described as the difference between the observed response value yi and the fitted response value
ŷi, and is shown as the error associated with the data.
The summed square of residuals is given by
where n is the number of data points contained in the fit and S is the sum of squares error
estimate. The supported types of least-squares fitting include:
Linear least squares
Weighted linear least squares
Robust least squares
Nonlinear least squares
Linear Least Squares
MATLAB Curve Fitting Toolbox software makes use of the linear least-squares method to fit a
linear model to data. A linear model is described as an equation that is linear in the
coefficients. For example, polynomials are linear but Gaussians are not linear. To show the
linear least-squares fitting process, suppose user have n data points that can be modeled by a
first-degree polynomial.
Weighted Least Squares
It is generally assumed that the response data is of equal quality and, therefore, has constant
variance. If this assumption is violated. Weighted least-squares regression reduces the error
estimate.
Robust Least Squares
It is generally assumed that the response errors follow a normal distribution, and that extreme
values are rare. Still, extreme values called outliers do occur.
Nonlinear Least Squares
MATLAB Curve Fitting Toolbox software uses the nonlinear least-squares formation to fit a
nonlinear model to data. A nonlinear model is described as an equation that is nonlinear in the
coefficients, or a combination of linear and nonlinear in the coefficients. For example,
Gaussians, polynomials ratios, and power functions are all nonlinear.