[R] Maxima/minima of loess line?
Jari Oksanen
jarioksa at sun3.oulu.fi
Tue Aug 24 15:38:57 CEST 2004
On Tue, 2004-08-24 at 15:23, Liaw, Andy wrote:
> Just take range() of the fitted loess values.
>
Or if you really want to investigate the *line* instead of some random
*points*, you may need something like:
> optimize(function(x, mod) predict(mod, data.frame(speed=x)), c(0,20),
maximum=TRUE, mod=cars.lo)
$maximum
[1] 19.99995
$objective
[1] 56.44498
This elaborates the ?loess example with the result object cars.lo (and,
of course is a bad example since the fit is monotone and solutions is
forced to the margin). Use maximum=FALSE for *a* minimum.
If you have several predictors, you either need to supply constant
values for those in optimize, or for simultaneous search in all use
optim or nlm.
cheers, jari oksanen
>
> > From: Fredrik Karlsson
> >
> > Dear list,
> >
> > I've produced a loess line that I would like to investigate
> > in terms of
> > local/global maxima and minima. How would you do this?
> >
> > Thank you in advance.
> >
> > /Fredrik Karlsson
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
--
Jari Oksanen <jarioksa at sun3.oulu.fi>
More information about the R-help
mailing list