[Vegan-commits] r2364 - pkg/vegan/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Jan 13 12:36:48 CET 2013


Author: jarioksa
Date: 2013-01-13 12:36:48 +0100 (Sun, 13 Jan 2013)
New Revision: 2364

Modified:
   pkg/vegan/R/stressplot.wcmdscale.R
Log:
implement stressplot for pRDA

Modified: pkg/vegan/R/stressplot.wcmdscale.R
===================================================================
--- pkg/vegan/R/stressplot.wcmdscale.R	2013-01-12 06:51:40 UTC (rev 2363)
+++ pkg/vegan/R/stressplot.wcmdscale.R	2013-01-13 11:36:48 UTC (rev 2364)
@@ -43,18 +43,16 @@
 `stressplot.rda` <-
     function(object, k = 2, pch, p.col = "blue", l.col = "red", lwd = 2, ...)
 {
-    ## Not yet done for pRDA
-    if (!is.null(object$pCCA))
-        stop("not implemented yet for partial RDA")
     ## Normalized scores to reconstruct data
     u <- cbind(object$CCA$u, object$CA$u)
     ev <- c(object$CCA$eig, object$CA$eig)
     ## normalizing constant
     nr <- NROW(u)
     const <- sqrt(ev * (nr-1))
+    u <- u %*% diag(const)
     ## Distances
-    dis <- dist(u %*% diag(const))
-    odis <- dist(u[,1:k, drop=FALSE] %*% diag(const[1:k], nrow = k))
+    dis <- dist(cbind(u, object$pCCA$Fit))
+    odis <- dist(cbind(u[,seq_len(k), drop=FALSE], object$pCCA$Fit))
     ## plot like above
         ## Plot
     if (missing(pch))



More information about the Vegan-commits mailing list