How do I get the constant term when performing multiple linear regression using STEPWISEFIT?
2 views (last 30 days)
Show older comments
I'm using STEPWISEFIT to perform multiple linear regression of the response values in the n-by-1 vector y on the predictive terms in the n-by-p matrix X as follows:
[b,SE,PVAL,INMODEL,STATS,NEXTSTEP,HISTORY] = stepwisefit(X,y);
However, the size of b contains only p-1 coefficients i.e., the constant term is not included.
Accepted Answer
MathWorks Support Team
on 28 Jan 2011
The constant term of the model corresponds to the "intercept" field of the output structure STATS and can be obtained as follows:
b0 = STATS.intercept
0 Comments
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!