Re: [R] Smoothing z-values according to their x, y positions

From: Emmanuel Levy <emmanuel.levy_at_gmail.com>
Date: Thu, 20 Mar 2008 02:29:22 +0000

Dear David,

Thanks a lot for pointing out kde2d, just tried it out but the problem is that it indeed takes the density of points into account, which I dont want.

For example, if in an region of surface S I've got 10,000 points, and that their average height is 0.5, and in an other region I've got only ten points and their average value if also 0.5, I'd like all these points to be transformed to the same
0.5 value. At the moment, it seems that it's not the case.

For example, the range of the values I give is: 0.2 - 3.7, but the range of the values
that are outputed is 0 - 0.17.

I haven't looked yet at the locfit package as it is not installed, but I will check it out!

Thanks for helping!

Emmanuel

On 20/03/2008, David Winsemius <dwinsemius_at_comcast.net> wrote:
> "Emmanuel Levy" <emmanuel.levy@gmail.com> wrote in
> news:e4654710803191554k4dfc2728g70bde35f41627754_at_mail.gmail.com:
>
>
> > Dear Bert,
> >
> > Thanks for your reply - I indeed saw a lot of functions using:
> > help.search("smooth")
> >
> > The problem is that most seem to not be very appropriate to what I'd
> > like, or they seem extremely complicated (e.g. gma). I am probably
> > missing something as I don't
> > see how to use Loess. From my poor understanding, it seems to be for
> > 2D data. Here I want to smooth the third "z" component.
> >
> > In the meantime I adapted a function from Greg Warnes, which sort of
> > does the job (although the smoothing is not very nice).
> > So I'd be very happy to learn how do do something similar with
> > loess!
> >
>
>
> You could consider at combining the kde2d() function in the MASS package
> within the VR bundle in combination with contour(). The example I
> followed came from MASS 2ed in chapter 5's section on density estimation.
> It is probably easiest to just copy the help example:
>
> library(MASS)
> attach(geyser)
> f1 <- kde2d(duration[-272], duration[-1],
> h = rep(1.5, 2), n = 50, lims = c(0.5, 6, 0.5, 6))
> contour(f1, xlab = "previous duration",
> ylab = "duration", levels = c(0.05, 0.1, 0.2, 0.4) )
>
> I have also had success with Loader's locfit package.
>
> --
>
> David Winsemius
>
>
> ______________________________________________
> 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. Received on Thu 20 Mar 2008 - 03:48:51 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 20 Mar 2008 - 13:30:23 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive