| interp.loess {tgp} | R Documentation | 
Lowess 2-d interpolation onto a uniform grid
Description
Use the loess function to interpolate the
two-dimensional x, y, and z data onto a uniform grid.  The output
produced is an object directly usable by the plotting functions
persp, image,
and contour, etc.
This function is designed as an alternative to the
interp functions from the akima
library.
Usage
interp.loess(x, y, z, gridlen = c(40,40), span = 0.1, ...)
Arguments
| x |  Vector of  | 
| y |  Vector of  | 
| z |  Vector of  | 
| gridlen |  Size of the interpolated grid to be produced in x and y.
The default of  | 
| span |  Kernel span argument to the  | 
| ... |  Further arguments to be passed to the
 | 
Details
Uses expand.grid function to produce a uniform
grid of size gridlen with domain equal to the rectangle implied
by X and Y.  Then, a loess a smoother
is fit to the data Z = f(X,Y).  Finally,
predict.loess is used to  predict onto the grid.
Value
The output is a list compatible with the 2-d plotting functions
persp, image,
and contour, etc.
The list contains...
| x | Vector of with  | 
| y | Vector of with  | 
| z | 
 | 
Note
As mentioned above, the default span = 0.1 parameter is 
significantly smaller that the default loess setting.
This asserts a tacit assumption that
the input is densely packed and that the noise in z's is small.  
Such should be the case when the data are output from a tgp regression –
this function was designed specifically for this situation.
For data that is random or sparse, simply choose higher setting,
e.g., the default loess setting of span =
  0.75, or a more intermediate setting of span = 0.5 as in the example below
Author(s)
Robert B. Gramacy, rbg@vt.edu, and Matt Taddy, mataddy@amazon.com
References
https://bobby.gramacy.com/r_packages/tgp/
See Also
interp, loess,
persp, image, contour
Examples
# 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
persp(ed.g)