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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Sep 2 16:46:19 CEST 2009


Author: jarioksa
Date: 2009-09-02 16:46:18 +0200 (Wed, 02 Sep 2009)
New Revision: 983

Modified:
   pkg/vegan/R/as.mlm.cca.R
   pkg/vegan/R/as.mlm.rda.R
   pkg/vegan/R/coef.cca.R
   pkg/vegan/R/coef.rda.R
   pkg/vegan/R/ordiNAexclude.R
   pkg/vegan/R/permutest.cca.R
   pkg/vegan/inst/ChangeLog
Log:
Reverted revision 977 to 980: need to rethink the NA treatment in cca and rda

Modified: pkg/vegan/R/as.mlm.cca.R
===================================================================
--- pkg/vegan/R/as.mlm.cca.R	2009-09-01 19:52:04 UTC (rev 982)
+++ pkg/vegan/R/as.mlm.cca.R	2009-09-02 14:46:18 UTC (rev 983)
@@ -2,9 +2,7 @@
     function (x) 
 {
     w <- weights(x)
-    k <- !is.na(w)
-    w <- w[k]
-    wa <- x$CCA$wa[k,]
+    wa <- x$CCA$wa
     wa <- sweep(wa, 1, sqrt(w), "*")
     X <- qr.X(x$CCA$QR)
     colnames(X) <- colnames(X)[x$CCA$QR$pivot]

Modified: pkg/vegan/R/as.mlm.rda.R
===================================================================
--- pkg/vegan/R/as.mlm.rda.R	2009-09-01 19:52:04 UTC (rev 982)
+++ pkg/vegan/R/as.mlm.rda.R	2009-09-02 14:46:18 UTC (rev 983)
@@ -3,8 +3,6 @@
 {
     X <- qr.X(x$CCA$QR)
     colnames(X) <- colnames(X)[x$CCA$QR$pivot]
-    if (!is.null(x$na.action) && inherits(x$na.action, "exclude"))
-        x$CCA$wa <- x$CCA$wa[-x$na.action,]
     lm(x$CCA$wa ~ . - 1, data = as.data.frame(X))
 }
 

Modified: pkg/vegan/R/coef.cca.R
===================================================================
--- pkg/vegan/R/coef.cca.R	2009-09-01 19:52:04 UTC (rev 982)
+++ pkg/vegan/R/coef.cca.R	2009-09-02 14:46:18 UTC (rev 983)
@@ -1,10 +1,9 @@
 "coef.cca" <-
 function (object, ...) 
 {
-    k <- !is.na(object$rowsum)
-    Q <- object$CCA$QR
-    u <- object$CCA$u[k,]
-    u <- sweep(u, 1, sqrt(object$rowsum[k]), "*")
-    qr.coef(Q, u)
+	Q <- object$CCA$QR
+	u <- object$CCA$u
+	u <- sweep(u, 1, sqrt(object$rowsum), "*")
+	qr.coef(Q, u)
 }
 

Modified: pkg/vegan/R/coef.rda.R
===================================================================
--- pkg/vegan/R/coef.rda.R	2009-09-01 19:52:04 UTC (rev 982)
+++ pkg/vegan/R/coef.rda.R	2009-09-02 14:46:18 UTC (rev 983)
@@ -1,7 +1,7 @@
 "coef.rda" <-
 function (object, ...) 
 {
-    Q <- object$CCA$QR
-    qr.coef(Q, object$CCA$u[complete.cases(object$CCA$u),])
+	Q <- object$CCA$QR
+	qr.coef(Q, object$CCA$u)
 }
 

Modified: pkg/vegan/R/ordiNAexclude.R
===================================================================
--- pkg/vegan/R/ordiNAexclude.R	2009-09-01 19:52:04 UTC (rev 982)
+++ pkg/vegan/R/ordiNAexclude.R	2009-09-02 14:46:18 UTC (rev 983)
@@ -17,18 +17,15 @@
     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. 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
-    }
+    ## 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
     ## 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 19:52:04 UTC (rev 982)
+++ pkg/vegan/R/permutest.cca.R	2009-09-02 14:46:18 UTC (rev 983)
@@ -35,8 +35,6 @@
     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 19:52:04 UTC (rev 982)
+++ pkg/vegan/inst/ChangeLog	2009-09-02 14:46:18 UTC (rev 983)
@@ -4,14 +4,7 @@
 
 Version 1.16-27 (opened September 1, 2009)
 
-	* coef.cca and coef.rda work with na.action = na.exclude.
-
-	* as.mlm.cca and as.mlm.rda work with na.action = na.exclude.
-
-	* permutest.cca and all anova.cca(..., by=) cases work with
-	na.action = na.exclude.
-
-	* plot.cca: works with na.action = na.exclude.
+	* plot.cca: works with when there are NA values in scores.
 	
 Version 1.16-26 (closed September 1, 2009)
 



More information about the Vegan-commits mailing list