version (1.73 KB) by Shen Liu
All possible regressions of y on X, selecting the best model by a means of selection criteria


Updated 2 Mar 2015

View License

% 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 (2022). allregress(y,X,criteria) (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2012a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!