Stepwiseglm: What is happening when 'Warning: Iteration Limit Reached'?

12 views (last 30 days)
Stepwiseglm: What is happening when 'Warning: Iteration Limit Reached'?
Seems to have to do with not enough examples of variation within a parameter across successes and non-successes in my logit model...that is, parameters populated mostly with one specific value and only a few cases of any other variable, but would like to learn more....didn't find much direct elaboration in documentation or question history. Thanks!
  2 Comments
Bruno Pop-Stefanov
Bruno Pop-Stefanov on 9 Oct 2014
The message means that the glmfit solver was not able to find a linear regression model that satisfies the termination criterion before reaching the maximum number of iterations (which is hard-coded as 100).
The corresponding loop is at lines 314-366 of glmfit.m. For your input parameters, the stopping condition is never satisfied and the loop is exited because the maximum number of iterations is reached.
Looking at line 365, the stopping condition is whether the relative difference between the new vector of coefficient estimates and the old vector -- (new-old)/old -- is greater than 1e-6.
I am not sure how to interpret that with respect to your data, but the warning message is there to inform you that you might want to take a close look at the generated model because it might not be exact.
I don't understand why the max number of iterations is hard-coded as 100 instead of being a parameter of the algorithm, but that's something we can ask MathWorks to change.

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!