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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Apr 15 21:02:17 CEST 2010


Author: jarioksa
Date: 2010-04-15 21:02:16 +0200 (Thu, 15 Apr 2010)
New Revision: 1180

Modified:
   pkg/vegan/R/predict.cca.R
   pkg/vegan/R/predict.rda.R
   pkg/vegan/inst/ChangeLog
Log:
implemented newdata for predict.cca/rda

Modified: pkg/vegan/R/predict.cca.R
===================================================================
--- pkg/vegan/R/predict.cca.R	2010-04-15 13:27:15 UTC (rev 1179)
+++ pkg/vegan/R/predict.cca.R	2010-04-15 19:02:16 UTC (rev 1180)
@@ -20,6 +20,9 @@
     slam <- diag(sqrt(object[[model]]$eig[1:take]), nrow = take)
     if (type %in%  c("response", "working")) {
         Xbar <- 0
+        if (!missing(newdata))
+            u <- predict(object, type = if(model == "CCA") "lc" else "wa",
+                         newdata = newdata, rank = take)
         if (take > 0) 
             Xbar <- u %*% slam %*% t(v)
         if (!is.null(object$pCCA)) 

Modified: pkg/vegan/R/predict.rda.R
===================================================================
--- pkg/vegan/R/predict.rda.R	2010-04-15 13:27:15 UTC (rev 1179)
+++ pkg/vegan/R/predict.rda.R	2010-04-15 19:02:16 UTC (rev 1180)
@@ -25,6 +25,10 @@
     if (type %in% c("response", "working")) {
         if (!is.null(object$pCCA)) 
             warning("Conditional ('partial') component ignored")
+        if (!missing(newdata)) {
+            u <- predict(object, type = if(model == "CCA") "lc" else "wa",
+                         newdata = newdata, rank = take)
+        }
         if (inherits(object, "capscale")) {
             if (take > 0)
                 out <- dist(u %*% slam/sqrt(nr))

Modified: pkg/vegan/inst/ChangeLog
===================================================================
--- pkg/vegan/inst/ChangeLog	2010-04-15 13:27:15 UTC (rev 1179)
+++ pkg/vegan/inst/ChangeLog	2010-04-15 19:02:16 UTC (rev 1180)
@@ -6,6 +6,11 @@
 
 	* adonis: implemented tie handling in permutations. 
 
+	* predict.cca/rda: implemented 'newdata' for type =
+	"response". For CCA, 'newdata' must be constraints (environmental
+	data), and for CA they must be community data. Test version, not
+	yet documented (except here).
+
 Version 1.18-3 (closed April 15, 2010)
 
 	* new version opened with the release of vegan 1.17-2 (March 8,



More information about the Vegan-commits mailing list