I would like to obtain the actual values of the smoothed curve. Precisely, values lying on the smoothed curve so that corresponding values of x and y are known given the point on the curve.
I have discrete data and I fit smoothed curve via xyplot(....,type="spline",...)
The smoothed curve looks like this:
I have tried to fit polynomial so that y~x+x^2+x^3...+x^15
so that if x is given, we obtain the "precise" value of y. However, I'm not happy fitting the polynomial etc. What other way would be to obtain the y-axis and x-axis values by moving only on the curve?
The documentation, ?xyplot
, points you to panel.xyplot
and then to panel.spline
, which returns the model used.
r <- panel.spline(x,y)
predict(r, 3)$y