[Vegan-commits] r1542 - in pkg/vegan: R inst man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Wed Mar 16 00:13:12 CET 2011
Author: gsimpson
Date: 2011-03-16 00:13:11 +0100 (Wed, 16 Mar 2011)
New Revision: 1542
Modified:
pkg/vegan/R/ordisurf.R
pkg/vegan/inst/ChangeLog
pkg/vegan/man/ordisurf.Rd
Log:
Add check for penalised surface and not draw contours if penalised out of model. Also adds note in the help page about the two new arguments and the new plotting behaviour.
Modified: pkg/vegan/R/ordisurf.R
===================================================================
--- pkg/vegan/R/ordisurf.R 2011-03-15 19:35:00 UTC (rev 1541)
+++ pkg/vegan/R/ordisurf.R 2011-03-15 23:13:11 UTC (rev 1542)
@@ -84,10 +84,11 @@
}
if (missing(levels))
levels <- pretty(range(fit, finite = TRUE), nlevels)
-
- contour(xn1, xn2, matrix(fit, nrow=GRID), col = col, add = TRUE,
- levels = levels, labcex = labcex,
- drawlabels = !is.null(labcex) && labcex > 0)
+ ## Only plot surface is select is FALSE or (TRUE and EDF is diff from 0)
+ if(!select || (select && !isTRUE(all.equal(as.numeric(summary(mod)$edf), 0))))
+ contour(xn1, xn2, matrix(fit, nrow=GRID), col = col, add = TRUE,
+ levels = levels, labcex = labcex,
+ drawlabels = !is.null(labcex) && labcex > 0)
mod$grid <- list(x = xn1, y = xn2, z = matrix(fit, nrow = GRID))
class(mod) <- c("ordisurf", class(mod))
mod
Modified: pkg/vegan/inst/ChangeLog
===================================================================
--- pkg/vegan/inst/ChangeLog 2011-03-15 19:35:00 UTC (rev 1541)
+++ pkg/vegan/inst/ChangeLog 2011-03-15 23:13:11 UTC (rev 1542)
@@ -11,6 +11,8 @@
Estimation of smoothing parameters can now be determined via
argument `method`. Both `select` and `method` have been set to
defaults that were implied in previous versions of the function.
+ If smooth is penalized to (effectively) 0, countour plotting is
+ suppressed.
* metaMDSrotate: can now rotate > 2-dim solutions so that the
first axis is parallel to a given vector and all others are
Modified: pkg/vegan/man/ordisurf.Rd
===================================================================
--- pkg/vegan/man/ordisurf.Rd 2011-03-15 19:35:00 UTC (rev 1541)
+++ pkg/vegan/man/ordisurf.Rd 2011-03-15 23:13:11 UTC (rev 1542)
@@ -81,13 +81,27 @@
\details{
Function \code{ordisurf} fits a smooth surface using thinplate splines
in \code{\link[mgcv]{gam}}, and uses \code{\link[mgcv]{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
- \code{\link{scores}} to extract ordination scores, and \code{x} can be
- any result object known by that function.
+ 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 \code{select} to \code{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 \code{select ==
+ TRUE} and the smooth is effectively penalised out of the model, no
+ contours will be plotted.
+ \code{\link[mgcv]{gam}} determines the degree of smoothness for the
+ fitted response surface during model fitting. Argument \code{method}
+ controls how \code{\link[mgcv]{gam}} performs this smoothness
+ selection. See \code{\link[mgcv]{gam}} for details of the available
+ options. Using \code{"REML"} or \code{"ML"} yields p-values for
+ smooths with the best coverage properties if such things matter to
+ you.
+
+ The function uses \code{\link{scores}} to extract ordination scores,
+ and \code{x} can be any result object known by that function.
+
User can supply a vector of prior weights \code{w}. If the ordination
object has weights, these will be used. In practise this means that
the row totals are used as weights with
More information about the Vegan-commits
mailing list