I've come across the problem of missing data when doing GLMs. I'm using GLMs to make predictions in R. My dependent variable is continuous and my independent variables are factors. The question arises, what to do with NA values in the factor variables.

What I've been doing in the past was making a separate factor level for NA and then combining it with another factor with a similar GLM coefficient. But as I've read, that can lead to biased results. Also what worries me is, what if the data with the NA values in some variable should all in reality be in the lowest or highest level? Then I discard additional information, and make predictions too high or too low, right?

A possibility a colleague suggested was discarding all the data with NA values. But that way I might lose way too much data.

What is the recommended way to deal with missing data in this case? I've read about imputation, but it seems to me as if that's going to lead to me making some variables significant when they are not (I'm already manually grouping similar ones together).


1 Answer 1


Much depends on the reasons why data are missing. There are 3 commonly cited missingness mechanisms, missing completely at random (MCAR), missing at random (MAR) and missing not at random (MNAR).

MCAR means that missing values occur randomly in that variable without any dependence on any other variable, observed or not.

MAR means that missing values occur randomly in that variable but the probability of being missing depends on values of one or more other observed variables (which might include your outcome variable).

If missingness depends on unobserved variables then the data are missing not at random (MNAR).

Deleting observations with missing data (known as complete-case analysis or listwise deletion), is a bad idea at the very least because it discards information which results in larger standard errors, wider confidence intervals and loss of power. Under MCAR the estimates will be unbiased, but under MAR they may be biased:

Complete Case analysis confines attention to cases where all variables are present. Advantages of this approach are .... . Disadvantages stem from the potential loss of information in discarding incomplete cases. This loss of information has two aspects: loss of precision, and bias when the missing-data mechanism is not MCAR, and the complete cases are not a random sample of all the cases".

From: Statistical Analysis with Missing Data, Second Edition, Roderick J.A. Little & Donald B Rubin, John Wiley and Sons, 2002. p41: http://dx.doi.org/10.1002/9781119013563

Creating a factor/indicator/dummy variable for missingness is also a biased method, for example see:

White IR, Carlin JB. Bias and efficiency of multiple imputation compared with complete-case analysis for missing covariate values. Stat Med 2010;29:2920-31. http://dx.doi.org/10.1002/sim.3944

Jones MP. Indicator and stratification methods for missing explanatory variables in multiple linear regression. J Am Stat Assoc 1996;91:222-30. http://dx.doi.org/10.1080/01621459.1996.10476680

If the data are plausibly MAR or MCAR then multiple imputation will yield unbiased estimates when applied correctly and standard errors will be smaller than with complete-case analysis. If missingness depends on unobserved variables then the data are missing not at random (MNAR) and this is much more difficult to handle.

Multiple imputation works by filling in missing values with plausible values from a model. This is done multiple times and each time the imputed values will differ to allow for uncertainty. The analysis model is run on each imputed dataset and the results are pooled. In essence, the method works because, on the one hand, while it is possible to estimate the most likely values for the missing data, the most likely values are in fact unlikely to be the correct values: there is inherent uncertainty. The variability in the values which are imputed between each completed dataset provides the uncertainty which is needed to reflect the uncertainty created by the missing values.

MICE is an excellent package for R which implements multiple imputation. https://www.jstatsoft.org/index.php/jss/article/view/v045i03/v45i03.pdf

Update: Examples on how to handle missing values in r using the imputation methods and MICEpackages: https://uvastatlab.github.io/2019/05/01/getting-started-with-multiple-imputation-in-r/

  • $\begingroup$ What exactely do you mean by "can yield"? That it usually yields unbiased results, or that it can sometimes yield unbiased results, but more often it doesn't? Also, is the method I am currently using bad, or is it a reasonable way to taclke this problem, just not as accurate as multiple imputation? $\endgroup$
    – gregorp
    Jun 10, 2016 at 6:24
  • $\begingroup$ @gregorp I have updated the answer to address your comment. $\endgroup$ Jun 10, 2016 at 7:40
  • 1
    $\begingroup$ @gregorp 50 imputations and 50 iterations should be more than enough - but did you actually check convergence ? Please post a reproducible example with data (simulated if you like) and code in another question so that we can look at this, since this is now beyond the scope of the current question. $\endgroup$ Jun 14, 2016 at 7:10
  • 1
    $\begingroup$ @gregorp yes, you simply run plot() on the object returned by the mice() function. At this point I'd also recommend reading some of the online tutorials such as this one $\endgroup$ Jun 14, 2016 at 8:40
  • 1
    $\begingroup$ @gregorp it depends on how you delete the data. It would really be better if you asked a new question and provided a reproducible example. $\endgroup$ Jun 14, 2016 at 8:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.