Solved – Interpolating time series

interpolationpopulationtime series

what are best ways to interpolate time series? I have three data points(1980, 1990 and 2001) and I need to interpolate them. Using R na.approx doesn't seem to be what I need since the data I need to interpolate is population and it is very unlikely for it to move linearly.

Best Answer

As suggested by @forecaster, you can use spline interpolation. For example, in R:

set.seed(123)
y <- rnorm(3)
ylong <- spline(y = y, x = seq_along(y), xout = seq(1, 3, 0.5))$y
plot(y, type = "n")
lines(seq(1, 3, 0.5), ylong, col = "gray")
points(seq_along(y), y, pch = 16, col = "blue")
points(c(1.5, 2.5), ylong[c(2,4)], pch = 16, col = "red")
legend("topleft", legend = c("observed values", "imputed values"), 
  col = c("blue", "red"), pch = c(16, 16), bty = "n")

spline interpolation

See ?spline for details and the available types of splines.

Related Question