I’m using mord package in python to do ordinal logit regression (predict response to movie rating 1-5 stars).

One of my predictor variables is also ordinal but there are some missing values where the viewer skipped a question because it wasn’t applicable due to skip logic from a prior question or because they missed it. What’s the best way to indicate a value is “missing” and/or “not applicable” while also retaining the ordinal nature of this predictor variable for everyone else? I don’t think I should delete this viewer or try to impute the value.

I get an error if I leave the NaN. I thought about dummy coding so I have something like question5_never, question5_sometimes, question5_always, question5_na, question5_missing, but I not sure.

  • $\begingroup$ Better question for stats.stackexchange.com, I think $\endgroup$ – DHW Oct 28 '19 at 0:02
  • $\begingroup$ Why don't you want to impute? $\endgroup$ – DHW Oct 28 '19 at 0:02

This problem refers to different missing data mechanisms.

When it comes to missing data, there are three different types of missing data mechanism:

  • Missing completely at random
  • Missing at random
  • Missing not at random

For the cases you mentioned in your problem are:

(1) missing values where the viewer skipped a question because it wasn’t applicable due to skip logic from a prior question

This kind of missing values are missing due to the Missing not at random mechanism. For this kind of missing values, removing it can produce a bias in the model. Therefore, you should not delete it. You can try setting a value indicating the missing.

(2) missing values because the viewers missed it

This kind of missing values are missing due to the Missing completely at random mechanism. You can just delete this kind of missing values without influencing your model.

  • $\begingroup$ Are there downsides to dummy coding them in the way I described in my question? $\endgroup$ – Insu Q Oct 28 '19 at 2:19
  • $\begingroup$ Should be alright, though it will increase the number of your features $\endgroup$ – 1tan Oct 28 '19 at 3:16

Computationally, there is just no way to use the data with the values missing. You do still have a whole three options, though:

  1. Drop the rows. This is "listwise deletion." Like you said, you don't want to do that - and it can cause biased results, as the observations with missing values may be ones that speak against some theory, or (in more general terms) represent some consistent data-generating pattern.
  2. Drop the column. This will eliminate any bias due to the above, at the cost of inefficiency. It may also be a non-starter if the effect of this variable is what you're concerned with anyway.
  3. Impute. You can fill in the missing values with your best guesses (i.e. the maximum-likelihood point-predictions of an imputation model - or even just the "null model", i.e. the global column means) and treat them like real values, though this is bad practice because it doesn't reflect the inherent uncertainty about imputed vs. actually observed values. Standard practice is to ensure your imputation model produces a best-fit distribution for each observation, generate 5 versions of your dataset with 5 sets of random draws from those observation-specific distributions, fit the same model to each of those datasets, and average the results.

Note, though, that if the model is an arbitrarily complicated machine-learning algorithm (i.e. a universal approximator like a neural net), then you can just fill in the missing values in each column with any "free" value - one that's not actually present in the data, and won't be - and the model will learn to treat those values not just differently but appropriately. It will effectively do its own imputation, in fact. But still, you can't have the actual inputs as missing values.


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.