stepwise regression history.B and stats.B comparison of final vectors.

Hi, I'm using stepwisefit on a dataset. As per the results, Matlab takes 10 steps to reach a final solution. I checked the stats.B and the history.B outputs to dig into the details. I can verify that the stats.B has only one column of data and that matches the final result (displayed) on the Command Window. However, when I look at the history.B data, I find that some of the numbers in the final vector do not match the final output. I was expecting the final vector to match across - i.e. the entire vector in stats.B should match the coeff's displayed in the Command Window (which they do) and the coeff's displayed in the last iteration in history.B (which does not). Can anyone help? Please let me know if you need more information. Ty Chet

 Accepted Answer

Does this excerpt from the documentation answer your question?
==============
  • If a term is not in the final model, then the corresponding coefficient estimate in b results from adding only that term to the predictors in the final model.
  • If a term is in the final model, then the coefficient estimate in b for that term is a result of the final model, that is stepwise does not consider the terms it excluded from the model while computing these values.

4 Comments

Hello! Thanks for responding to my question so promptly. I'm afraid it doesn't answer my question yet. I understand what you're saying....my point was that final vector on the display page (command window), the stats.B file AND the history.B file should match. So the display page/command window results match the stats B file..but some elements of the final vector in the history.B file do not match. I'm not sure what's causing that yet....
Are you able to post a small example of code that illustrates the problem? It's difficult to speak in the abstract.
Is the issue that the history.B array inserts zeros for terms that are out of the model, while stats.B returns coefficients as in the first bullet that the cyclist quoted?
guys - apologies - I got completely sidetracked and never got to finish this project. Thanks again for the responses..if/when I get back to this project, I'll make sure to post the relevant code. Ty C

Sign in to comment.

More Answers (0)

Products

Asked:

on 6 Aug 2013

Commented:

on 19 Mar 2014

Community Treasure Hunt

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

Start Hunting!