Learn R Programming

vegan (version 1.17-8)

ordisurf: Fit and Plot Smooth Surfaces of Variables on Ordination.

Description

Function ordisurf fits a smooth surface for given variable and plots the result on ordination diagram.

Usage

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, ...)
## S3 method for class 'ordisurf':
calibrate(object, newdata, ...)

Arguments

x
Ordination configuration, either a matrix or a result known by scores.
y
Variable to be plotted.
choices
Ordination axes.
knots
Number of initial knots in 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
family
Error distribution in gam.
col
Colour of contours.
thinplate
Use thinplate splines in gam.
add
Add contours on an existing diagram or draw a new plot.
display
Type of scores known by scores: typically "sites" for ordinary site scores or "lc" for linear combination scores.
w
Prior weights on the data. Concerns mainly cca and decorana results which have nonconstant weights.
main
The main title for the plot, or as default the name of plotted variable in a new plot.
nlevels, levels
Either a vector of levels for which contours are drawn, or suggested number of contours in nlevels if levels are not supplied.
labcex
Label size in contours. Setting this zero will suppress labels.
bubble
Use bubble plot for points, or vary the point diameter by the value of the plotted variable. If bubble is numeric, its value is used for the maximum symbol size (as in cex), or if bubble = TRUE<
cex
Character expansion of plotting symbols.
object
An ordisurf result object.
newdata
Coordinates in two-dimensional ordination for new points.
...
Other graphical parameters.

Value

  • Function is usually called for its side effect of drawing the contour plot. The function returns the result object of class "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).

Details

Function ordisurf fits a smooth surface using thinplate splines in gam, and uses predict.gam to find fitted values in a regular grid. Function plots the fitted contours with convex hull of data points either over an existing ordination diagram or draws a new plot 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.

See Also

For basic routines gam, and scores. Function envfit provides a more traditional and compact alternative.

Examples

Run this code
data(varespec)
data(varechem)
library(MASS)
vare.dist <- vegdist(varespec)
vare.mds <- isoMDS(vare.dist)
with(varechem, ordisurf(vare.mds, Baresoil, bubble = 5))
## Cover of Cladina arbuscula
fit <- with(varespec, ordisurf(vare.mds, Cla.arb, family=quasipoisson)) 
## Get fitted values
calibrate(fit)

Run the code above in your browser using DataLab