data(varespec)
data(varechem)
vare.dist <- vegdist(varespec)
vare.mds <- monoMDS(vare.dist)
with(varechem, ordisurf(vare.mds, Baresoil, bubble = 5))
## as above but without the extra penalties on smooth terms,
## and using GCV smoothness selection (old behaviour of `ordisurf()`):
with(varechem, ordisurf(vare.mds, Baresoil,col = "blue", add = TRUE,
select = FALSE, method = "GCV.Cp"))
## Cover of Cladina arbuscula
fit <- with(varespec, ordisurf(vare.mds, Cla.arb, family=quasipoisson))
## Get fitted values
calibrate(fit)
## Variable selection via additional shrinkage penalties
## This allows non-significant smooths to be selected out
## of the model not just to a linear surface. There are 2
## options available:
## - option 1: `select = TRUE` --- the *default*
with(varechem,
ordisurf(vare.mds, Baresoil, method = "REML", select = TRUE))
## - option 2: use a basis with shrinkage
with(varechem,
ordisurf(vare.mds, Baresoil, method = "REML", bs = "ts"))
## or bs = "cs" with `isotropic = FALSE`
## Plot method
plot(fit, what = "contour")
## Plotting the "gam" object
plot(fit, what = "gam") ## 'col' and 'cex' not passed on
## or via plot.gam directly
plot.gam(fit, cex = 2, pch = 1, col = "blue")
## 'col' effects all objects drawn...
### controlling the basis functions used
## Use Duchon splines
with(varechem, ordisurf(vare.mds, Baresoil, bs = "ds"))
## A fixed degrees of freedom smooth, must use 'select = FALSE'
with(varechem, ordisurf(vare.mds, Baresoil, knots = 4,
fx = TRUE, select = FALSE))
## An anisotropic smoother with cubic regression spline bases
with(varechem, ordisurf(vare.mds, Baresoil, isotropic = FALSE,
bs = "cr", knots = 4))
## An anisotropic smoother with cubic regression spline with
## shrinkage bases & different degrees of freedom in each dimension
with(varechem, ordisurf(vare.mds, Baresoil, isotropic = FALSE,
bs = "cs", knots = c(3,4), fx = TRUE,
select = FALSE))
Run the code above in your browser using DataLab