How would one imputing missing values (without using the mode) for a discrete variable, e.g. a variable corresponding to a count.
Apart from the methods @Media mentioned, here are some more:
Imputing with info from other variables
This method is to create a (multi-class) model based on target variable. So that missing values would be predicted.
The steps are likely to be:
- Subset data without missing value in the variable you want to impute
- Machine learning on the data with predict model
- Predict on data with the missing value from model created
Whether missing values are mainly related to a combination of variables? Unsupervised methods may help here.
An example using randomForest: https://stats.stackexchange.com/questions/107530/using-cluster-information-in-multiple-imputation
If we known that the reason for missing value, we can assign the missing value to a proper level. For example, a survey data are collected from web where given choices are not applicable for some cases, hence leave blank. In this case, it would be better to leave as a separate value.
There are some R package can impute the data for you;
It depends, if you have the distribution of that feature, you can take the marginal distribution over that feature which its interpretation is to use the expected value of that feature. If you don't have the distribution you can take the mean of the sample in hand of those samples which have value for that feature and add the mean for those which don't have. Another solution is to separate the data of each class and find the mean of the feature of those data samples having the value and putting the mean for each entry of the corresponding class which does not have value in that entry.