6
$\begingroup$

I am trying to build a binary classification model which predicts whether a patient would me infected with a certain disease at the the end of his hospital stay or not. The features that I have are results of different standard medical tests. But the issue is almost all of these results have around 60% - 80% missing values as not all the tests are relevant for all the patients. So how do I deal with the missing values as dropping them is not an option here. Also since the medical test results lie on scale ranging from low to high, should i converted them to categorical variable with High, Low, Medium, Null (for missing data), based on the standard medical test ranges? Or would it helpful to replace with any of the central tendencies?

$\endgroup$
5
$\begingroup$

Because NA values are informative for your dataset, you don't want to drop NAs or impute values. If a patient doesn't get an X-ray, they probably didn't break a bone.

So you want to learn from NA values. A common approach is to add an indicator column for NA values.

$\endgroup$
  • $\begingroup$ OK but how do I replace the NA values in the original column? $\endgroup$ – Krantikari Aug 6 at 20:53
  • 1
    $\begingroup$ You don't want to use values in the range of possible test results. I'm guessing -999 will work, but this is data-dependent. $\endgroup$ – damerdji Aug 6 at 21:17
  • 2
    $\begingroup$ I should add that if you make that change, only nonlinear models will learn effectively. $\endgroup$ – damerdji Aug 6 at 21:26
  • $\begingroup$ Tree based models should work fine right? $\endgroup$ – Krantikari Aug 6 at 21:34
  • $\begingroup$ Yup! Tree-based models are nonlinear. $\endgroup$ – damerdji Aug 6 at 21:45
3
$\begingroup$

A linear mixed effects model would allow you to have individuals with missing data and not need to convert everything over to categories. If ever you have a continuous variable, use it as a continuum if at all possible. Here is a link to a paper that explains more about why. It is not just for psychologists, the same applies because the arguments are based on math, not opinion. https://www.researchgate.net/publication/282351876_The_problem_with_categorical_thinking_by_psychologists

If you have data on a bunch of known cases you can use to build the model, use a logistic generalized linear mixed-effects model aka logistic GLMM. In R it is in the lme4 library and uses GLMER for its call (Generalized Linear Mixed Effects Regression). You may also want to look into signal detection theory as it may help you out here. With a logistic GLMM you can use an individual patient's information in the model and it will give you the odds of them having/not having the outcome. Just be careful to add only relevant variables to your model. If there are too many predictors your model will not generalize well to new patients that were not used to fit the model. To remedy this, if you have enough data, split it at random into two data sets, fit the model on one data set and then see how well it predicts another data set by comparing the Akaike Information Criterion and Bayesian Information Criterion. Bootstrapping may also help with this.

GLMMs and LMMs in general deal very well with missing data. Unlike a traditional logistic regression, LMMs do not have the assumption of equal cell sizes. Don't be fooled if someone says that ANOVA/regression is robust to violations of its assumptions, especially if the cell sizes are unequal. They haven't done their homework and are just parroting what they heard in grad school. The math on that is clear.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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