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

1 view (last 30 days)

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 10 Feb 2011
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.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!