[Vegan-commits] r1538 - in pkg/vegan: R inst man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sat Mar 12 16:53:40 CET 2011


Author: gsimpson
Date: 2011-03-12 16:53:39 +0100 (Sat, 12 Mar 2011)
New Revision: 1538

Modified:
   pkg/vegan/R/ordisurf.R
   pkg/vegan/inst/ChangeLog
   pkg/vegan/man/ordisurf.Rd
Log:
add  argument to ordisurf

Modified: pkg/vegan/R/ordisurf.R
===================================================================
--- pkg/vegan/R/ordisurf.R	2011-03-10 18:35:29 UTC (rev 1537)
+++ pkg/vegan/R/ordisurf.R	2011-03-12 15:53:39 UTC (rev 1538)
@@ -19,7 +19,7 @@
     function (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, ...) 
+              bubble = FALSE, cex = 1, select = FALSE, ...) 
 {
     weights.default <- function(object, ...) NULL
     GRID = 31
@@ -49,9 +49,9 @@
                    family = family, weights = w)
     else if (thinplate) 
         mod <- gam(y ~ s(x1, x2, k = knots), family = family, 
-                   weights = w)
+                   weights = w, select = select)
     else mod <- gam(y ~ s(x1, k = knots) + s(x2, k = knots), 
-                    family = family, weights = w)
+                    family = family, weights = w, select = select)
     xn1 <- seq(min(x1), max(x1), len=GRID)
     xn2 <- seq(min(x2), max(x2), len=GRID)
     newd <- expand.grid(x1 = xn1, x2 = xn2)

Modified: pkg/vegan/inst/ChangeLog
===================================================================
--- pkg/vegan/inst/ChangeLog	2011-03-10 18:35:29 UTC (rev 1537)
+++ pkg/vegan/inst/ChangeLog	2011-03-12 15:53:39 UTC (rev 1538)
@@ -5,7 +5,9 @@
 Version 1.18-25 (opened March 10, 2011)
 
 	* ordisurf: got a formula interface as an alternative to define
-	the model.
+	the model. Also now accepts `gam()` argument `select` to add an
+	extra penalty to smooths so they can be penalized to zero (i.e.
+	removed from the model). This is a form of model selection.
 
 	* metaMDSrotate: can now rotate > 2-dim solutions so that the
 	first axis is parallel to a given vector and all others are
@@ -21,7 +23,7 @@
 	It would be possible to have this with recursive metaMDSrotate for
 	1..N for first 'vec', then 2..N for the second 'vec', but the
 	later 'vec's could be correlated with previous axes.
-	
+
 Version 1.18-24 (closed March 10, 2011)
 
 	* cca: will return NULL item for CCA only if constraints were not

Modified: pkg/vegan/man/ordisurf.Rd
===================================================================
--- pkg/vegan/man/ordisurf.Rd	2011-03-10 18:35:29 UTC (rev 1537)
+++ pkg/vegan/man/ordisurf.Rd	2011-03-12 15:53:39 UTC (rev 1538)
@@ -13,7 +13,7 @@
 \method{ordisurf}{default}(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, ...)
+     bubble = FALSE, cex = 1, select = FALSE, ...)
 \method{ordisurf}{formula}(formula, data, ...)
 \method{calibrate}{ordisurf}(object, newdata, ...)
 }
@@ -50,6 +50,13 @@
     the maximum. The minimum size will always be \code{cex = 0.4}.  The
     option only has an effect if \code{add = FALSE}.}
   \item{cex}{Character expansion of plotting symbols.}
+  \item{select}{Logical; specify \code{\link[mgcv]{gam}} argument
+    \code{"select"}. If this is \code{TRUE} then \code{\link[mgcv]{gam}} can
+    add an extra  penalty to each term so that it can be penalized to
+    zero. This means that the smoothing parameter estimation that is part
+    of fitting can completely remove terms from the model. If the
+    corresponding smoothing parameter is estimated as zero then the extra
+    penalty has no effect.}
   \item{formula, data}{Alternative definition of the fitted model as
     \code{x ~ y}, or left-hand side is the ordination \code{x} and
     right-hand side the single fitted continuous variable
@@ -122,6 +129,11 @@
 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



More information about the Vegan-commits mailing list