Equation selection using subset regression: regsubsets
Regression takes a matrix of data columns A (independent variables) and using a linear combination of these columns predicts a vector b of dependent values. Each row of A can be test measurement values and the corresponding element of b the result from the test. So the regression equations predicts the result of the test from the measurement values. A column of ones in A provides a constant term in the regression equation.
Formally we calculate x so that the sum of square errors Ax-b is minimised. A small sum of squares means Ax is a good predictor of b.
The back slash operator \ (as x=A\b) or the function linfit ([x,xse]=linfit(A,b)) provides the solution in simple cases. Often many different dependent variables are recorded and it is not known which provide the best regression predictions. Choosing the best prediction equations is not easy and various methods have been proposed (e.g. Subset Selection in Regression, A J Miller, Model Selection, H Linhart & W Zucchini). The functions demonstrated here investigate all possible subsets of the independent variable up to a given size. From these subset equations the best equations, of which there may be several, are selected. An initial investigation can be used to determine which columns of A are important for further analysis.
Cite As
Bill Whiten (2025). Equation selection using subset regression: regsubsets (https://www.mathworks.com/matlabcentral/fileexchange/64570-equation-selection-using-subset-regression-regsubsets), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxCategories
Tags
Acknowledgements
Inspired by: Optional function arguments
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
RegressionSubsets/
Version | Published | Release Notes | |
---|---|---|---|
1.0.0.0 |