[R] Fitting a curve to to an oscillating scatter . .

Prof Brian D Ripley ripley at stats.ox.ac.uk
Mon Aug 14 08:21:32 CEST 2000

```On Sun, 13 Aug 2000, reza shahidzadeh mahani wrote:

> You can  get the lower frequency component nonparametrically by
> increasing the bandwidth (in kernel smoothing with ksmooth in S) or
> increasing penalty coefficient (in spline smoothing with smooth.spline in
> S).
> I don't know the corresponding function in R unfrotunately.

The same. But that is not what he asked for, and I was trying to answer the
actual question.

In scatter.smooth one uses `span' to set the amount of smoothing.

>
> method) On Sun, 13 Aug 2000, Prof Brian D Ripley wrote:
>
> > On Sun, 13 Aug 2000, Phil Rhoades wrote:
> >
> > > I have just got going with R and think it is really nice however, as far as
> > > I can see, it can't do what I got it for:
> >
> > Sure it can.  It is a fully fledging computing language.
> >
> > > I have some output from a computer simulation of mutating genes represented
> > > by a biological statistic - so the graph looks roughly like the top of:
> > >
> > > 	x = y^2
> > >
> > > - with oscillations around the general curve.
> > >
> > > If I use scatter.smooth() I get a nice curve representing the oscillations
> > > but what the curve I want to fit is the more basic curve ie the top arm of
> > > the x = y^2.
> > >
> > > Any suggestions?
> >
> > plot(x, y)
> > fit <- lm(y ~ I(x^0.5)) # or y ~ sqrt(x)
> > lines(predict(fit), sort(x))
> >
> > if indeed the response is y to stimulus x.
> >
> >
> > --
> > Brian D. Ripley,                  ripley at stats.ox.ac.uk
> > Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
> > University of Oxford,             Tel:  +44 1865 272861 (self)
> > 1 South Parks Road,                     +44 1865 272860 (secr)
> > Oxford OX1 3TG, UK                Fax:  +44 1865 272595
> >
> > -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> > r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
> > Send "info", "help", or "[un]subscribe"
> > (in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
> > _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
> >
>
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
> Send "info", "help", or "[un]subscribe"
> (in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
>

--
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._

```