Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

R: Two dimensional non-parametric regression

Tags:

r

statistics

What packages and functions in R can perform a two dimensional non-additive local regression/smooth. 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 functions could estimate this?

like image 868
Andrew Redd Avatar asked Oct 18 '10 20:10

Andrew Redd


1 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 ) )
like image 126
Greg Snow Avatar answered Sep 23 '22 02:09

Greg Snow