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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Apr 6 11:13:30 CEST 2009


Author: jarioksa
Date: 2009-04-06 11:13:24 +0200 (Mon, 06 Apr 2009)
New Revision: 796

Modified:
   pkg/vegan/R/ordisurf.R
   pkg/vegan/inst/ChangeLog
   pkg/vegan/man/ordisurf.Rd
Log:
ordisurf fits a linear trend surface if knots = 0

Modified: pkg/vegan/R/ordisurf.R
===================================================================
--- pkg/vegan/R/ordisurf.R	2009-04-05 14:56:28 UTC (rev 795)
+++ pkg/vegan/R/ordisurf.R	2009-04-06 09:13:24 UTC (rev 796)
@@ -14,7 +14,9 @@
     X <- scores(x, choices = choices, display = display, ...)
     x1 <- X[, 1]
     x2 <- X[, 2]
-    if (thinplate) 
+    if (knots <= 0)
+        mod <- gam(y ~ x1 + x2, family = family, weights = w)
+    else if (thinplate) 
         mod <- gam(y ~ s(x1, x2, k = knots), family = family, 
                    weights = w)
     else mod <- gam(y ~ s(x1, k = knots) + s(x2, k = knots), 

Modified: pkg/vegan/inst/ChangeLog
===================================================================
--- pkg/vegan/inst/ChangeLog	2009-04-05 14:56:28 UTC (rev 795)
+++ pkg/vegan/inst/ChangeLog	2009-04-06 09:13:24 UTC (rev 796)
@@ -26,6 +26,8 @@
 	stressplot(metaMDS(x, dist="gower", trymax=40)), which failed
 	because metaMDSdist/vegdist were passing 'trymax' to decostand()
 	while evaluating "gower" dissimilarity.
+
+	* ordisurf: will fit a linear trend surface if knots = 0.
 	
 Version 1.16-16 (closed April 2, 2009)
 

Modified: pkg/vegan/man/ordisurf.Rd
===================================================================
--- pkg/vegan/man/ordisurf.Rd	2009-04-05 14:56:28 UTC (rev 795)
+++ pkg/vegan/man/ordisurf.Rd	2009-04-06 09:13:24 UTC (rev 796)
@@ -19,7 +19,8 @@
   \item{y}{ Variable to be plotted. }
   \item{choices}{Ordination axes. }
   \item{knots}{Number of initial knots in \code{\link[mgcv]{gam}} (one
-    more than degrees of freedom). }
+    more than degrees of freedom). If \code{knots = 0}, the function
+    will fit a linear trend surface instead of a smooth surface. }
   \item{family}{ Error distribution in  \code{\link[mgcv]{gam}}. }
   \item{col}{ Colour of contours. }
   \item{thinplate}{Use thinplate splines in \code{\link[mgcv]{gam}}.}



More information about the Vegan-commits mailing list