Getting this error "attempting model selection on an essentially perfect fit is nonsense"



I’m building a regression model in R, where all the features are continuous. What does that warning message mean?


What is your code. Paste it here. This error is not error in R for Lm function but looks more like an error because of how you are using the function.

Example if lm function is say lm(y~x, data=abc) try a correlation of abc$x, abc$y. Probably its already 1 meaning you can hardly improve the model by adding another variable. Potentially you are looking at statistical junk due to the way you are using the regression or due to data you are having in hand.


Please share the code and what you are trying to achieve to help you in better way.


Actually i’m getting this warning while performing forward selection for feature selection using lm. One more thing is i have only 10 observations for 16 independent and 1 dependent variable. and while applying lm only 6 variables are getting estimate values and for remaining it’s showing NA, even Adj-R-Squared is NaN. Is it due to less data or due to co-linearity between variables?