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

David Winsemius dwinsemius at comcast.net
Thu Mar 20 14:15:49 CET 2008


"Emmanuel Levy" <emmanuel.levy at gmail.com> wrote in
news:e4654710803191929j554c211bla7088bc8bc69c445 at mail.gmail.com: 

> 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.

>> "Emmanuel Levy" <emmanuel.levy at 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. 

Your description of what is desired leads me to believe you were
misreading the "loess" documentation. For proof I suggest you visit
Deepayan Sarkar's webpage and in particular see Figure 6.8 where 3d
plots of loess fits for more complex data arrangements are
exemplified:
Choose Figure 6.8 (code on right side of window):  
<http://lmdvr.r-forge.r-project.org/figures/figures.html>

Code:
<http://dsarkar.fhcrc.org/lattice/book/Chapter06-Trivariate/all.R>

PNG image:
<http://dsarkar.fhcrc.org/lattice/book/images/Figure_06_08_stdClassic.png>

-- 
David Winsemius



More information about the R-help mailing list