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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Sep 17 11:48:06 CEST 2010


Author: jarioksa
Date: 2010-09-17 11:48:06 +0200 (Fri, 17 Sep 2010)
New Revision: 1307

Modified:
   pkg/vegan/R/ordiR2step.R
   pkg/vegan/inst/ChangeLog
Log:
do not get R2 directly from the fitted rda() of scope

Modified: pkg/vegan/R/ordiR2step.R
===================================================================
--- pkg/vegan/R/ordiR2step.R	2010-09-17 09:40:41 UTC (rev 1306)
+++ pkg/vegan/R/ordiR2step.R	2010-09-17 09:48:06 UTC (rev 1307)
@@ -19,14 +19,11 @@
     else
         R2.0 <- RsquareAdj(object)$adj.r.squared
     ## Get R2 of the scope
-    if (inherits(scope, "rda")) {
-        R2.all <- RsquareAdj(scope)$adj.r.squared
-        scope <- formula(scope)
-    } else {
-        if (!inherits(scope, "formula"))
-            scope <- reformulate(scope)
-        R2.all <- RsquareAdj(update(object, scope))$adj.r.squared
-    }
+    if (inherits(scope, "rda")) 
+        scope <- delete.response(formula(scope))
+    if (!inherits(scope, "formula"))
+        scope <- reformulate(scope)
+    R2.all <- RsquareAdj(update(object, scope))$adj.r.squared
     ## Check that the full model can be evaluated
     if (is.na(R2.all))
         stop("the upper scope cannot be fitted (too many terms?)")

Modified: pkg/vegan/inst/ChangeLog
===================================================================
--- pkg/vegan/inst/ChangeLog	2010-09-17 09:40:41 UTC (rev 1306)
+++ pkg/vegan/inst/ChangeLog	2010-09-17 09:48:06 UTC (rev 1307)
@@ -6,7 +6,9 @@
 
 	* ordiR2step: gained argument 'direction = c("both", "response")',
 	and iwth "both" gives also adjusted R2 when dropping terms. I have
-	not yet seen a case where a terms is dropped.
+	not yet seen a case where a terms is dropped. Abandoned dangerous
+	practice of getting the R2.all directly from a fitted model of the
+	'scope' since this may have different lhs.
 	
 Version 1.18-11 (closed September 17, 2010)
 



More information about the Vegan-commits mailing list