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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Nov 17 20:43:17 CET 2010


Author: jarioksa
Date: 2010-11-17 20:43:15 +0100 (Wed, 17 Nov 2010)
New Revision: 1375

Modified:
   pkg/vegan/R/vif.cca.R
   pkg/vegan/inst/ChangeLog
Log:
aliased terms must be dropped from VIF

Modified: pkg/vegan/R/vif.cca.R
===================================================================
--- pkg/vegan/R/vif.cca.R	2010-11-17 18:02:13 UTC (rev 1374)
+++ pkg/vegan/R/vif.cca.R	2010-11-17 19:43:15 UTC (rev 1375)
@@ -1,13 +1,16 @@
-"vif.cca" <-
-function (object) 
+`vif.cca` <-
+    function(object) 
 {
     Q <- object$CCA$QR
-    V <- chol2inv(Q$qr)
-    X <- qr.X(Q)
+    out <- rep(NA, NCOL(Q$qr))
+    names(out)[Q$pivot] <- colnames(Q$qr)
+    rank <- Q$rank
+    V <- chol2inv(Q$qr, size = rank)
+    X <- qr.X(Q)[, 1:rank,drop=FALSE]
     Vi <- crossprod(X)
-    nam <- colnames(Vi)
     v1 <- diag(V)
     v2 <- diag(Vi)
-    structure(v1 * v2, names = nam)
+    out[Q$pivot[1:rank]] <- v1 * v2
+    out
 }
 

Modified: pkg/vegan/inst/ChangeLog
===================================================================
--- pkg/vegan/inst/ChangeLog	2010-11-17 18:02:13 UTC (rev 1374)
+++ pkg/vegan/inst/ChangeLog	2010-11-17 19:43:15 UTC (rev 1375)
@@ -7,6 +7,11 @@
 	* alpha release version: preparing release (1.17-5) of
 	vegan. Mainly clean up and checking of functions intended for the
 	release. 
+
+	* vif.cca: aliased terms must be removed when calculating
+	VIFs. Test case vif.cca(cca(dune ~ Manure + Management, dune.env))
+	should give decent values all below <100 (used to give magnitude
+	10^31). VIF of aliased terms is NA. Pierre Legendre noticed this.
 	
 Version 1.18-16 (closed November 17, 2010)
 



More information about the Vegan-commits mailing list