MATLAB: Is it possible for REGSTATS to regress models without constant terms in Statistics Toolbox 7.4 (R2010b)

constantregressregstatsstatisticsStatistics and Machine Learning Toolbox

I would like to know if REGSTATS can regress models without constant terms.

Best Answer

REGSTATS can be used to regress models without constant terms, using its MODEL argument.
Here is an example illustrating how to regress the first column of a matrix on the second column, third column, and product of those columns:
rand('twister', 1)
a = rand(10,3);
stats = regstats(a(:,1),a(:,2:end),[1 0;0 1;1 1]);
stats.beta
ans =
1.0103
0.7275
-1.3787
This agrees with the results found from left division:
[a(:,2:3) prod(a(:,2:3),2)]\a(:,1)
ans =
1.0103
0.7275
-1.3787
Note that this method is appropriate for older releases MATLAB, the earliest being R12.1.