# Replacing NODATA values with mean, median, or random values from current distribution

I am examining the use of underground pipe network information in the prediction of soil moisture in metropolitan areas; drinking water pipes leak water to the surrounding soil, storm sewer and wastewater pipes receive water from the surrounding soil. I am assuming certain leakage rates based on the size and age of the pipes - older pipes leak/receive more, larger pipes leak/receive more. I am missing information for certain pipes on their age and size.

Because this is a first pass at building a working model (set of mathematical equations predicting soil moisture), I don't need the model to be perfect - but I do need to replace my NODATA values with some estimate of age and size.

What is the best method for replacing my NODATA values? With the mean, median, or a random set of values that follow the distribution of the original data?

Total number of pipes: 10779, with 1034 = NODATA. Age range: 1858 - 1992.

• The choice of imputation procedure depends fundamentally on why these data are missing. It is plausible that the missing information will more often be for older pipes and these will tend to leak more. In such a case neither the mean, median, nor a random choice will be accurate. – whuber Oct 6 '15 at 3:38
• I understand that point, but at the same time, using no value in my mathematical model (which would be the same as saying a pipe wasn't present) for cells with a pipe age or size of NODATA will also be inaccurate. But, I guess there is no way to determine which leads to a greater inaccuracy. – traggatmot Oct 6 '15 at 4:02

If you are interested in relations between variables then I would not use the mean or the median. You can see what that does below: here I imputed $x$ with the mean (in this case 0). The median won't make it any better.
A random draw from the distribution of $x$ would be even worse. In my experience you have to spend a lot of time and effort in order to get an imputation right -- or you just remove the observations with missing values. "Quick fixes" typically make the situation much worse.