I read here and elsewhere that one technique for dealing with NA
s 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?
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 ofx
. $\endgroup$x * missing
means an interaction between the value ofx
and whether it was missing or not. You cannot estimate that without some imputation method forx
. $\endgroup$