0
$\begingroup$

I read here and elsewhere that one technique for dealing with NAs in a database is to create a dummy variable that is 1 if an observation (row) has no missing data in it and a 0 otherwise. However I do not understand how to test if this "missingness" is significant for predicting some numerical response variable (call it $Y$) when there are other numerical predictors. For example, if I have a numerical predictor x and my dummy factor variable (call it missing), I cannot do something like

lm(Y ~ x * missing)

because lm() automatically removes rows with missing data, so it then thinks missing only has one factor level (0) and throws an error. I could just call

lm(Y ~ missing)

but that seems like I am ignoring information from the numerical predictor x. What should one do in this case?

$\endgroup$
3
  • 1
    $\begingroup$ Have you considered multiple imputation? The package mice not only has a variety of imputation methods, but also allows you to inspect the quality of imputation: cran.r-project.org/web/packages/mice/mice.pdf You can then pool the models obtained from each individual imputation to obtain an estimate of x. $\endgroup$ Jun 9, 2019 at 23:36
  • $\begingroup$ The method you're using is only useful if missingness correlates sufficiently with the response. x * missing means an interaction between the value of x and whether it was missing or not. You cannot estimate that without some imputation method for x. $\endgroup$ Jun 9, 2019 at 23:39
  • $\begingroup$ Set missing = 0 if x is not missing, otherwise missing =1. Then set x = 0 if x is missing. Fit a model $ y \sim x + missing$. $\endgroup$
    – user158565
    Jun 10, 2019 at 3:02

0

Your Answer

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