[R] Odp: connecting points into a smooth curve
Mike Marchywka
marchywka at hotmail.com
Mon Nov 1 13:02:46 CET 2010
----------------------------------------
> To: kaiyan at berkeley.edu
> From: petr.pikal at precheza.cz
> Date: Mon, 1 Nov 2010 11:50:17 +0100
> CC: r-help at r-project.org
> Subject: [R] Odp: connecting points into a smooth curve
>
> Hi
>
> r-help-bounces at r-project.org napsal dne 01.11.2010 07:18:47:
>
> >
> > If I have, say, five scatter points and want to connect them together
> into a
> > smooth curve.
>
> As you are not much specific about what you consider "smooth curve" here
> are some options
I think the OP said he had 5 points so that leaves a lot to the imagination.
Presumably smooth means something like, " a curve that goes through all 5 points
and has as many continuous derivatives as possible." So you write a general
fitting function, Taylor would be a good expansion I suppose, impose
the above conditions, and see if there
is an R package that provides the coefficients you want?
Someone else was asking a related question and there I offered sinc interpolation
and indeed this can be exact given a band limited signal and no time base errors etc.
Doing much of anything meaningful with 5 points would probably require a model as the other
poster suggested- your model would need to be solved depending on its particulars.
You sometimes see these kinds of wild interpolation issues with the drawing programs and free-form input "smoothing" where it tries to fit a smooth curve to your mouse moves.
>
> use some model ?lm and plot predicted values with line
> ??smooth will give you many functions for smoothing data e.g.
> ?loess
> ?supsmu
> ?spline
> and some others
>
> Regards
> Petr
>
> > I did plot(x,y,type="l"), but the graph is five segments connecting with
> > each other, but not a smooth curve.
[[elided Hotmail spam]]
> >
> >
> > --
> > View this message in context:
> http://r.789695.n4.nabble.com/connecting-points-
> > into-a-smooth-curve-tp3021796p3021796.html
> > Sent from the R help mailing list archive at Nabble.com.
> >
> > ______________________________________________
> > R-help at 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.
>
> ______________________________________________
> R-help at 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.
More information about the R-help
mailing list