ordisurf
fits a smooth surface for given variable and
plots the result on ordination diagram.## S3 method for class 'default':
ordisurf(x, y, choices=c(1, 2), knots=10, family="gaussian", col="red",
thinplate = TRUE, add = FALSE, display = "sites",
w = weights(x), main, nlevels = 10, levels, labcex = 0.6,
bubble = FALSE, cex = 1, select = FALSE, method = "GCV.Cp",
gamma = 1, plot = TRUE, ...)## S3 method for class 'formula':
ordisurf(formula, data, ...)
## S3 method for class 'ordisurf':
calibrate(object, newdata, ...)
## S3 method for class 'ordisurf':
plot(x, what = c("contour","persp","gam"),
add = FALSE, bubble = FALSE, col = "red", cex = 1,
nlevels = 10, levels, labcex = 0.6, ...)
ordisurf
an ordination configuration, either a
matrix or a result known by scores
. For
plot.ordisurf
and object of class "ordisurf"
as
returned by gam
(one
more than degrees of freedom). If knots = 0
or
knots = 1
the function will fit a linear trend surface, and
if knots = 2
gam
.gam
.scores
: typically
"sites" for ordinary site scores or "lc" for linear combination scores.levels
for which contours
are drawn, or suggested number of contours in
nlevels
if levels
are not supplied.bubble
is
numeric, its value is used for the maximum symbol size (as in
cex
), or if bubble = TRUE<
"GCV.Cp"
uses GCV for models with
unknown scale parameter and Mallows' Cp/UBRE/AIC for models with
known scale; "GACV.Cp"
as for "GCV.Cp
gamma = 1.4
.ordisurf
? Useful if all you want is the fitted response
surface model.x ~ y
, or left-hand side is the ordination x
and
right-hand side the single fitted continuous variable
y
. The variable y
must be in the working eordisurf
result object."contour"
produces a contour plot of the response surface, see
contour
for details. "persp"
produces a
perspective plot of the gam
, or
to the graphical functions. See Note below for exceptions."ordisurf"
that inherits from gam
used
internally to fit the surface, but adds an item grid
that
contains the data for the grid surface. The item grid
has
elements x
and y
which are vectors of axis coordinates,
and element z
that is a matrix of fitted values for
contour
. The values outside the convex hull of observed
points are NA
in z
. The gam
component of the result can be used for further analysis like
predicting new values (see predict.gam
).ordisurf
fits a smooth surface using thinplate splines
in gam
, and uses predict.gam
to find fitted values in a regular grid. The smooth surface can be
fitted with an extra penalty that allows the entire smoother to be
penalized back to 0 degrees of freedom, effectively removing the term
from the model. The addition of this extra penalty is invoked by
setting argument select
to TRUE
. The function plots the
fitted contours with convex hull of data points either over an
existing ordination diagram or draws a new plot. If select ==
TRUE
and the smooth is effectively penalised out of the model, no
contours will be plotted. gam
determines the degree of smoothness for the
fitted response surface during model fitting. Argument method
controls how gam
performs this smoothness
selection. See gam
for details of the available
options. Using "REML"
or "ML"
yields p-values for
smooths with the best coverage properties if such things matter to
you.
The function uses scores
to extract ordination scores,
and x
can be any result object known by that function.
User can supply a vector of prior weights w
. If the ordination
object has weights, these will be used. In practise this means that
the row totals are used as weights with
cca
or
decorana
results. If you do not like this, but want to give
equal weights to all sites, you should set w = NULL
. The
behaviour is consistent with envfit
. For complete
accordance with constrained cca
, you should set
display = "lc"
(and possibly scaling = 2
).
Function calibrate
returns the fitted values of the response
variable. The newdata
must be coordinates of points for which
the fitted values are desired. The function is based on
predict.gam
and will pass extra arguments to
that function.
gam
,
and scores
. Function
envfit
provides a more traditional and compact
alternative.data(varespec)
data(varechem)
library(MASS)
vare.dist <- vegdist(varespec)
vare.mds <- isoMDS(vare.dist)
with(varechem, ordisurf(vare.mds, Baresoil, bubble = 5))
## as above but with extra penalties on smooth terms:
with(varechem, ordisurf(vare.mds, Baresoil, bubble = 5, col = "blue",
add = TRUE, select = TRUE))
## Cover of Cladina arbuscula
fit <- with(varespec, ordisurf(vare.mds, Cla.arb, family=quasipoisson))
## Get fitted values
calibrate(fit)
## 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...
Run the code above in your browser using DataLab