Stepwisefit regression - additional outputs?
1 次查看(过去 30 天)
显示 更早的评论
Hello,
I am trying to code a series of regression analyses that uses a 'moving window', for example, 100 data points, where a stepwise regression is performed, then it moves on one step and repeats. For instance regression 1 would use data points 1:100, regression 2 uses 2:101 and so on. I think I can get this to work fine.
However, the output I get from each regression is the coefficient for each input variable (which is great) BUT I would also ideally get an output for what the intercept would be in each case too.
I have looked through the help but have not been able to find an option to request additional output data using stepwisefit (and I have way too much data to do each one manually with the stepwise function).
*****As always, once you ask a question you find new potential answers... Would a better method be to use a series of "betahat = regress" commands as (I think!) this gives you the intercept as well as all the coeff for the variable...?
Any advice would be greatly appreciated.
Best wishes Niall
1 个评论
回答(1 个)
Tom Lane
2012-2-27
The fifth output from the function is a structure having a .intercept field that contains the intercept for the final model.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Linear Regression 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!