# Should we always do interpolation polynomially or fill the gaps with the average value?

I have a series which takes values as 1,2 and 3. It also has some NA values. The following is a sample from the series.

series1 <- c(1, 1, 2, 1, 1, 1, 1, 2, 2, 2, NA, NA, NA, 3, 2, 2, 1, 1, 1,1)


My question is how should I go about doing the interpolation for the NAs. I can just do a linear interpolation and get the result as:

c(1, 1, 2, 1, 1, 1, 1, 2, 2, 2, 2.25, 2.5, 2.75, 3, 2, 2, 1, 1, 1, 1)


But what is the justification of doing that instead of filling the gap with the average of the extreme values of the NAs (2 and 3 in this case).

c(1, 1, 2, 1, 1, 1, 1, 2, 2, 2, 2.5, 2.5, 2.5, 3, 2, 2, 1, 1, 1, 1)


I thought of fitting a time series but that does not seem okay to me since there is not considerable variance in data.

EDIT

The data were basically vehicle counts per minutes obtained from road sensors. It had few negative values because of error. We need to remove the negative values from the database. So, I converted the negative values to NA and wanted to replace them with non-negative values that make sense. At this point of time, we are not doing any further analysis on the data. We need to interpolate with reasonable values.

• What is the purpose of interpolating the values? – whuber Feb 27 '13 at 19:18
• Actually they were negative due to instrument error. I changes the negatives to NA. Now, I need to replace the NAs – Stat-R Feb 27 '13 at 19:38
• But why do you need to impute the missing values? What will you be doing with them? – whuber Feb 27 '13 at 20:51
• Please see my edits – Stat-R Feb 27 '13 at 21:43
• Because interpolated values have a very different status than original data--they are derived; they are interdependent; they are arbitrary (being dependent on the interpolation method)--it is usually a really bad idea to include interpolated values in your database. Interpolation is a method to display data and interpolation as imputation depends on how the imputed values will be used in an analysis; in both cases the procedure is best left for the analysis itself and not memorialized as values in the database. – whuber Feb 27 '13 at 23:59