문제

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:

enter image description here

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
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top