# Goodness of fit: Generalized Linear Models with missing values in R

I am trying to compare two models and check which is the best fit of our data. The R script is below:

# Models
#Goodness of fit
anova(fit1, fit2, test="Chisq")


And we got the warning:

Error in anova.glmlist(c(list(object), dotargs), dispersion = dispersion,  :


models were not all fitted to the same size of dataset

I do understand anova() can only be used to check goodness of fit when two models have equal dataset. However, in my case, fit2 has more missing values than fit1.

How could I compare these two models and decide which is better?

3. Both the options above take away some information value from the data, because we no longer have the effect of 'missing' data in our model. In fact, this already is happening with your models since logistic regression just removes any row that has a NA value in one of its factors. So then, instead of trying to get rid of these missing values, you could replace them with a certain value such as $-9999$ if it is a numerical or simply just 'missing' if categorical. In terms of categorical, it will just become a new level so it works out great. But when it comes to numerical, you may have to look into binning your variable so that all missing values are in the same bin. This goes into WoE and information value, which I think this link would be useful for: http://ucanalytics.com/blogs/information-value-and-weight-of-evidencebanking-case/