This function adds a regression surface, defined by a matrix of heights
at a regular grid of values of two covariates, to an rgl
plot.
Missing values can be accommodated.
1 2 3  sm.surface3d(eval.points, surf, scaling,
col = "green", col.mesh = "black",
alpha = 0.7, alpha.mesh = 1, lit = TRUE, ...)

eval.points 
if this is a twocolumn matrix then each column defines the marginal grids of covariate values. Alternatively, a list with two components can also be used to handle cases where the grids are of different size. 
surf 
a matrix of heights corresponding to the grid of covariate values. NAs are allowed. 
scaling 
a function to define the scaling for the 
col 
the colour of the surface. If 
col.mesh 
the colour of the surface mesh. If 
alpha 
the transparency of the filled triangles defining the surface. Setting
this to 
alpha.mesh 
the transparency of the lines drawn across the regular grid of covariate
values. Setting this to 
lit 
a logical variable which controls whether the 
... 
other optional parameters which are passed to 
the principal motivation for this function is that is can handle missing
data in regression surfaces. In particular, it can be used to plot the
results of applying sm.regression
. In addition, the function can
be used to build up more complex plots by adding successive surfaces.
a vector of length 2 containing the ids of the filled surface and lines
aded to the rgl
plot.
a surface is added to the rgl
plot.
sm.regression
1 2 3 4 5 6 7 8 9  with(trawl, {
Zone93 < (Year == 1 & Zone == 1)
Position < cbind(Longitude  143, Latitude)
model1 < sm.regression(Position[Zone93,], Score1[Zone93],
h= c(0.1, 0.1), display = "rgl", xlab="Longitude  143")
model2 < sm.regression(Position[Zone93,], Score1[Zone93],
h= c(0.2, 0.2), display = "none")
sm.surface3d(model2$eval.points, model2$est, model1$scaling, col = "red")
})

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
All documentation is copyright its authors; we didn't write any of that.