1

I am using stepAIC in the MASS package for model selection and receive an error: “AIC is -infinity for this model, so 'step' cannot proceed” when including all candidate predictor variables.

I am able to successfully execute stepAIC when specifying a subset of predictors. However, including some additional predictors results in the error. There doesn't seem to be anything particularly unique about the values of the predictor variables that cause the error when they are included.

Any thoughts on why this may be occurring?

viridius
  • 477
  • 5
  • 17
  • 1
    I'd expect that if you had a perfect fit - no errors. Make sure you don't have a copy of your dependent variable in with your predictors. If you need more help, you'll probably need to post a reproducible example. – Gregor Thomas Apr 27 '18 at 18:57
  • 1
    The dependent variable is not in the list of predictors. I tested incrementally adding variables with successful model fits, then got a variable that forced the error. Like I mentioned, nothing unique about the values of this variable that seemed to have caused the error. – viridius Apr 27 '18 at 19:01
  • I'll try to work on a reproducible example – viridius Apr 27 '18 at 19:01
  • how big is your data, how many predictors. Make sure they are the expected class ie a variable you expect to be numeric is not a factor – user20650 Apr 27 '18 at 19:11
  • Its a small data set, only 25 observations but am testing 15 different predictors. I am only looking for 1 to 3 predictor variables in the end, but wanted to run stepAIC to look for the best combinations. Maybe its better to use "best subsets" regression? – viridius Apr 27 '18 at 19:17
  • 1
    Use the Lasso, in the `glmnet` package. – Gregor Thomas Apr 27 '18 at 19:27
  • 1
    https://stats.stackexchange.com/questions/241422/aic-is-infinity-for-this-model-so-stepaic-cannot-proceed – ngm Apr 27 '18 at 19:33
  • @Gregor I will try Lasso, thanks for the suggestion. – viridius Apr 30 '18 at 15:31
  • @ngm that link seems to confirm the "too many predictors per number of observation" theory, not sure why that post did not come up in my initial searches prior to posting! Thanks all – viridius Apr 30 '18 at 15:31

0 Answers0