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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Sep 1 20:29:26 CEST 2009


Author: jarioksa
Date: 2009-09-01 20:29:25 +0200 (Tue, 01 Sep 2009)
New Revision: 977

Modified:
   pkg/vegan/R/ordiNAexclude.R
   pkg/vegan/R/permutest.cca.R
   pkg/vegan/inst/ChangeLog
Log:
anova.cca works with na.action = na.exclude

Modified: pkg/vegan/R/ordiNAexclude.R
===================================================================
--- pkg/vegan/R/ordiNAexclude.R	2009-09-01 18:13:33 UTC (rev 976)
+++ pkg/vegan/R/ordiNAexclude.R	2009-09-01 18:29:25 UTC (rev 977)
@@ -17,15 +17,18 @@
     object$CA$u <- napredict(nas, object$CA$u)
     object$CA$u.eig <- napredict(nas, object$CA$u.eig)
     ## Estimate WA scores for NA cases with newdata of excluded
-    ## observations
-    wa <- predict(object, newdata = excluded, type = "wa", model = "CCA")
-    wa.eig <- sweep(wa, 2, sqrt(object$CCA$eig), "*")
-    object$CCA$wa[nas,] <- wa
-    object$CCA$wa.eig[nas,] <- wa.eig
-    wa <- predict(object, newdata = excluded, type = "wa", model = "CA")
-    wa.eig <- sweep(wa, 2, sqrt(object$CA$eig), "*")
-    object$CA$u[nas,] <- wa
-    object$CA$u.eig[nas,] <- wa.eig
+    ## observations. At the moment, WA scores are available only for
+    ## non-partial models.
+    if (is.null(object$pCCA)) {
+        wa <- predict(object, newdata = excluded, type = "wa", model = "CCA")
+        wa.eig <- sweep(wa, 2, sqrt(object$CCA$eig), "*")
+        object$CCA$wa[nas,] <- wa
+        object$CCA$wa.eig[nas,] <- wa.eig
+        wa <- predict(object, newdata = excluded, type = "wa", model = "CA")
+        wa.eig <- sweep(wa, 2, sqrt(object$CA$eig), "*")
+        object$CA$u[nas,] <- wa
+        object$CA$u.eig[nas,] <- wa.eig
+    }
     ## Use NA also for excluded species with this option
     nap <- if (!is.null(object$CCA))
         attr(object$CCA$v, "na.action")

Modified: pkg/vegan/R/permutest.cca.R
===================================================================
--- pkg/vegan/R/permutest.cca.R	2009-09-01 18:13:33 UTC (rev 976)
+++ pkg/vegan/R/permutest.cca.R	2009-09-01 18:29:25 UTC (rev 977)
@@ -35,6 +35,8 @@
     Q <- x$CCA$QR
     if (isCCA) {
         w <- weights(x, "sites")
+        ## remove possible missing values
+        w <- w[!is.na(w)]
         X <- qr.X(Q, ncol=length(Q$pivot))
         X <- sweep(X, 1, sqrt(w), "/")
     }

Modified: pkg/vegan/inst/ChangeLog
===================================================================
--- pkg/vegan/inst/ChangeLog	2009-09-01 18:13:33 UTC (rev 976)
+++ pkg/vegan/inst/ChangeLog	2009-09-01 18:29:25 UTC (rev 977)
@@ -4,6 +4,9 @@
 
 Version 1.16-27 (opened September 1, 2009)
 
+	* permutest.cca and all anova.cca(..., by=) cases work with
+	na.action = na.exclude.
+
 	* plot.cca: works with na.action = na.exclude.
 	
 Version 1.16-26 (closed September 1, 2009)



More information about the Vegan-commits mailing list