R: Two-dimensional nonparametric regression

What packages and functions in R can perform two-dimensional non-additive local regression / smoothness. For example, consider

b<-seq(-6*pi,6*pi,length=100) xy<-expand.grid(b,b) x=xy[[1]] y=xy[[2]] z= sin(x)+cos(y) + 2*sin(x)*cos(y) contour(b,b,matrix(z,100,100)) 

alt text

What features can appreciate this?

+4
source share
2 answers

you can do this with loess:

 fit <- loess( z ~ x+ y, span=0.01 ) dev.new() contour( b, b, matrix( predict(fit), 100, 100 ) ) 
+3
source

mgcv has many options for 2-D splines.

+1
source

All Articles