Stepwisefit regression - additional outputs?

1 view (last 30 days)
Niall
Niall on 8 Feb 2011
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 Comment
Laurens Bakker
Laurens Bakker on 27 Feb 2012
Could you give us some more details on which functions you were using?

Sign in to comment.

Answers (1)

Tom Lane
Tom Lane on 27 Feb 2012
The fifth output from the function is a structure having a .intercept field that contains the intercept for the final model.

Community Treasure Hunt

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

Start Hunting!