Emmanuel Levy
2008-Mar-19 19:42 UTC
[R] Smoothing z-values according to their x, y positions
Dear All, I'm sure this is not the first time this question comes up but I couldn't find the keywords that would point me out to it - so apologies if this is a re-post. Basically I've got thousands of points, each depending on three variables: x, y, and z. if I do a plot(x,y, col=z), I get something very messy. So I would like to smooth the values of z according to the values of their neighbors (given by x and y). Could you please point me out to the function(s) I should look into for the smothing, and possibly for the plotting? Many thanks for your help, Emmanuel
Bert Gunter
2008-Mar-19 21:10 UTC
[R] Smoothing z-values according to their x, y positions
There are dozens of functions within R and contributed packages that do this. The spatial statistics packages (see the "spatial" task view on CRAN) is certainly where most are concentrated, but thin plate splines (in splines packages, I believe), tensor product splines (in mgcv package), local likelihood (in locfit package) etc. are also available for spatial smoothing. Perhaps the most basic place to look is the ?loess function in the base distribution, which will do exactly what you requested. Bert Gunter Genentech Nonclinical Statistics -----Original Message----- From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of Emmanuel Levy Sent: Wednesday, March 19, 2008 12:42 PM To: r-help at r-project.org Subject: [R] Smoothing z-values according to their x, y positions Dear All, I'm sure this is not the first time this question comes up but I couldn't find the keywords that would point me out to it - so apologies if this is a re-post. Basically I've got thousands of points, each depending on three variables: x, y, and z. if I do a plot(x,y, col=z), I get something very messy. So I would like to smooth the values of z according to the values of their neighbors (given by x and y). Could you please point me out to the function(s) I should look into for the smothing, and possibly for the plotting? Many thanks for your help, Emmanuel ______________________________________________ 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.
Seemingly Similar Threads
- Multivariate spline regression and predicted values
- How to choose a proper smoothing spline in GAM of mgcv package?
- how to use the basis matrix of "ns" in R? really confused by multi-dim spline filtering?
- gamm(): nested tensor product smooths
- mgcv: lowest estimated degrees of freedom