Stepwisefit regression - additional outputs?

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 commentaire

Laurens Bakker
Laurens Bakker le 27 Fév 2012
Could you give us some more details on which functions you were using?

Connectez-vous pour commenter.

Réponses (1)

Tom Lane
Tom Lane le 27 Fév 2012

0 votes

The fifth output from the function is a structure having a .intercept field that contains the intercept for the final model.

Question posée :

le 8 Fév 2011

Community Treasure Hunt

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

Start Hunting!

Translated by