In the figure attached "test", I would like to interpolate the empty - "NA" 
section to connect the two curves.

1/ I tried using "na.approx" and "na.spline", without success.

na.approx(test,na.rm=FALSE)
na.spline(test,na.rm=FALSE)

In the first case it just draws a straight line between the end and beginning 
points of each curve, respectively, which doesn't look smooth. In the second 
case the cubic spline interpolation results overshoot above 1.0 which I would 
like to avoid (see attached test.na) .

2/ I have also used  splinefun for a monotonic increasing spline, which is the 
best result so far
Yfun <- splinefun(X,test,method="monoH.FC")
test.spline <- Yfun(X)

however the resulting curve displays a "kink" at the limit of the interpolation 
zone (see attached figure test.splinefun).

is there a way to constrain the spline in na.spline in 1/, for example, to 
force it to be monotonic strictly increasing?
Alternatively can we alter the smoothing performed by splinefun somehow to 
avoid this "kink"?

Any other suggestions welcome!
Thank you
IC


________________________________
This message and any attachments contain information that may be RMS Inc. 
confidential and/or privileged. If you are not the intended recipient (or 
authorized to receive for the intended recipient), and have received this 
message in error, any use, disclosure or distribution is strictly prohibited. 
If you have received this message in error, please notify the sender 
immediately by replying to the e-mail and permanently deleting the message from 
your computer and/or storage system.


______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to