I'm not sure what i'm missing here, but i'm basically trying to compute interpolated values for a time series; when I directly plot the series, constraining the interpolation points with "interpolation.date.vector", the plot is correct:
plot(date.vector,fact.vector,ylab='Quantity')
lines(spline(date.vector,fact.vector,xout=interpolation.date.vector))
When I compute the interpolation, store it in an intermediate variable, and then plot the results; I get a radically incorrect result:
intepolated.values <- spline(date.vector,fact.vector,xout=interpolation.date.vector)
plot(intepolated.values$x,intepolated.values$y)
lines(intepolated.values$x,intepolated.values$y)
Doesn't the lines() function have to execute the spline() function to retrieve the interpolated points in the same way i'm doing it?
plot(intepolated.values$x,intepolated.values$y)
instead ofplot(date.vector,fact.vector,ylab='Quantity')
the second time, because the results look fine to me. – Anikolines(spline(date.vector,fact.vector,xout=interpolation.date.vector))
should be the same aslines(intepolated.values)
– hatmatrix