# random data
ed <- exp2d.rand()
# higher span = 0.5 required because the data is sparse
# and was generated randomly
ed.g <- interp.loess(ed$X[,1], ed$X[,2], ed$Z, span=0.5)
# perspective plot, and plot of the input (X) locations
par(mfrow=c(1,2), bty="n")
persp(ed.g, main="loess surface", theta=-30, phi=20,
xlab="X[,1]", ylab="X[,2]", zlab="Z")
plot(ed$X, main="Randomly Subsampled Inputs")
Run the code above in your browser using DataLab