I have a dataset where I have observations for three years (e.g., 2000, 2005, and 2010) and need to interpolate the values for the years in-between using R. I have attempted to use some type of spline to do this, however, the interpolated values are outside of the original range. In the case below they even become negative.
years <- c(2000, 2005, 2010)
outcome_values <- c(1, 10, 90)
plot(spline(years, outcome_values, xout = seq(min(years), max(years))))
points(years, outcome_values, pch = 16)
Someone described this situation and a solution in Python using a lower order spline (Smooth curved line between 3 points in plot and interpolate curve between three values), but I have not been able to figure out how to do this in R. Any pointers would be appreciated.