Cross Validated is a question and answer site for people interested in statistics, machine learning, data analysis, data mining, and data visualization. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am applying glm on a data in which most of the values are NAs or blank. For example, in the example data produced below (4 predictors and one response variable), the default glm command will remove 10 rows that contain 'NA' leaving just one row for analysis. This creates serious problem as some of my data that initially had 100000 rows (with ~50 features) cut down to 200 with (~15 features) or even less reducing the power significantly.

My question is: What options do I have in this scenario. I do not want to fill the NAs with average values or anything based on variance/measure of centrality as it might be possible that TSH test is ordered only for patients with history of thyroid disease. In that case any extrapolation will be disastrous, as the mean won't be the actual representatives of the normal values.

gender  TSH PH  HDLC_hole   response
m   2   NA  36  TRUE
f   1.8 4   32  TRUE
m   NA  NA  29  TRUE
f       NA  NA  33  TRUE
m   2.2 5   NA  TRUE
f   2.5 4   NA  TRUE
NA  1.8 4   34  FALSE
m   NA  4   35  FALSE
f   3   NA  36  FALSE
m   1.2 4   NA  FALSE
m   1   NA  28  TRUE


What I understood from a quick review of some of the papers on 'Multiple imputation' techniques is that they fill-in values based on mean/variance or similar statistics.

Should I change my method and explore others? For such cases what predictions algorithms may be appropriate.

share|improve this question

migrated from Jan 10 '13 at 19:37

This question came from our site for professional and enthusiast programmers.

This is really a statistical question and the specific answers may depend on what your unstated goals are. The quick answer is to use multiple imputation methods and the two ones I am aware of are those in the Hmisc (aregImpute) and Amelia packages. But I suspect there are others – DWin Jan 10 '13 at 18:32
Should go to Cross-Validated I think – Peter Ellis Jan 10 '13 at 18:44
@Dwin There's the mi package as well, which I've used in the past and has some sane choices underlying it. – Ari B. Friedman Jan 10 '13 at 18:57
Agree with PeterEllis and used one of my precious moderator flag allowances to make the request. – DWin Jan 10 '13 at 19:02
Multiple imputation is the usual answer, as has already been pointed out, but ask yourself: if you have this many missing values should you be using glms in the first place?? You might want to look at tree-based models (e.g. gbm) or others that handle missingness more naturally, especially if there is a possibility that missingness may actually have some meaning. But without knowing your problem.... – Allan Engelhardt Jan 11 '13 at 15:33

If you go down the multiple imputation route, the MICE package in R is useful, and there is a good tutorial for it here.

share|improve this answer
Thanks Dahly for reference – user1140126 Jan 14 '13 at 16:03

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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