I'm working on a real world data set containing missing information. I understand imputing missing values before data partitioning can lead to leakage of information. I'm using this R package MissMech to test if my data is MCAR and impute missing values. Since, both the train set and test set are assumed to have a similar underlying distribution and the imputation mechanism used in this package is based on nonparametric estimate of the underlying distribution, is it correct to impute the missing values using this package before partitioning ?



No, it's not.

If you had access to the whole underlying distribution, using it for imputation would be okay. But if you had the whole distribution, then you would need no test set at all, because you would not be afraid to overfit to your train data.

The idea of train-test partitioning is to see whether your assumptions about data are correct. You fit a model to one finite sample and estimate it on another. And the less you look at the test set when you build your model, the more honest your result will be.


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.