Skip to content

smooth curves

4 messages · guerreau, Martin Maechler, Michael A. Miller +1 more

#
guerreau> I would like to draw smooth curves instead of
    guerreau> polygons.  I could not find any spline function to
    guerreau> do that : given an x and a y vectors, they all
    guerreau> take the x in increasing order.  Is there a
    guerreau> function to draw a smooth curve through a set of
    guerreau> points in any order ?

I've always wanted to try the following.
Your e-mail prompted me to.

I attach an R source file that shows one solution,
using interpolating spline(s), 
one through (t, x(t))
the other   (t, y(t))

Repeatedly sourcing this file also shows you the limitation of
splines for this situation.
The functions are for your convenience to do more experiments.

Martin Maechler <maechler at stat.math.ethz.ch>	http://stat.ethz.ch/~maechler/
Seminar fuer Statistik, ETH-Zentrum  LEO C16	Leonhardstr. 27
ETH (Federal Inst. Technology)	8092 Zurich	SWITZERLAND
phone: x-41-1-632-3408		fax: ...-1228			<><

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: spline-non-function-curve.R
Url: https://stat.ethz.ch/pipermail/r-help/attachments/20021206/b5cdb74c/spline-non-function-curve.pl
#
> I would like to draw smooth curves instead of polygons.  I
    > could not find any spline function to do that : given an x
    > and a y vectors, they all take the x in increasing order.
    > Is there a function to draw a smooth curve through a set of
    > points in any order ?

The locfit package local regression, likelihood and density
estimation) can be used to that:

library(locfit)
data(ethanol)
fit <- locfit(NOx~E,data=ethanol)
plot(NOx~E,data=ethanol)
lines(fit)


Mike
#
On 6 Dec 2002, Michael A. Miller wrote:

            
1) That package is in CRAN/Devel because it does not work (fully) with
current R.

2) Your example is of a *smoothed* fit, not of a smooth interpolating
curve.