allregress(y,X,criteria)
% This function runs all possible regressions of y on X, and selects the best model by a means of selection criteria
%
% Inputs:
% y - dependent variable, column vector, n-by-1
% X - explanatory variable matrix, consisting of k columns, n-by-k
% criteria - model selection criteria, choose between 'AIC', 'BIC'(default), 'R2', 'MSE'
%
% Outputs:
% M - Statistics of the selected model
% Iset - indices of the selected explanatory variables, a logic row vector, 1-by-k
%
% Example:
% y = randn(100,1);
% X = randn(100,6);
% [M_BIC, I_BIC] = allregress(y,X);
% [M_MSE, I_MSE] = allregress(y,X,'MSE');
%
% Author: Shen Liu, Queensland University of Technology, Australia
% Date: 2 March 2015
Cite As
Shen Liu (2024). allregress(y,X,criteria) (https://www.mathworks.com/matlabcentral/fileexchange/49886-allregress-y-x-criteria), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxCategories
Tags
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.