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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Aug 24 09:48:02 CEST 2010


Author: jarioksa
Date: 2010-08-24 09:48:01 +0200 (Tue, 24 Aug 2010)
New Revision: 1276

Modified:
   pkg/vegan/R/anova.ccalist.R
   pkg/vegan/inst/ChangeLog
Log:
anova.ccalist works with Null model y ~ 1

Modified: pkg/vegan/R/anova.ccalist.R
===================================================================
--- pkg/vegan/R/anova.ccalist.R	2010-08-23 16:33:40 UTC (rev 1275)
+++ pkg/vegan/R/anova.ccalist.R	2010-08-24 07:48:01 UTC (rev 1276)
@@ -28,9 +28,21 @@
     mods <- list()
     for(i in 1:nmodels) {
         if (i > 1)
-            assign(".Random.seed", mods[[1]]$Random.seed,
-                   envir = .GlobalEnv)
-        mods[[i]] <- permutest(objects[[i]])
+            ## juggling for Null model y ~ 1
+            if (!is.null(mods[[i-1]]$Random.seed))
+                assign(".Random.seed", mods[[i-1]]$Random.seed,
+                       envir = .GlobalEnv)
+        if (!is.null(objects[[i]]$CCA) && !is.null(objects[[i]]$CA))
+            mods[[i]] <- permutest(objects[[i]])
+        else {
+            if (is.null(objects[[i]]$CCA)) {
+                mods[[i]] <- list(num = 0,
+                                 den = objects[[i]]$CA$tot.chi/(N-1))
+            } else {
+                mods[[i]] <- list(num = objects[[i]]$CCA$tot.chi/moddf[i],
+                                  den = 0)
+            }
+        }
     }
     ## Differences of permutations. In permutation F values, numerator
     ## is taken from each model, but all use the same denominator from

Modified: pkg/vegan/inst/ChangeLog
===================================================================
--- pkg/vegan/inst/ChangeLog	2010-08-23 16:33:40 UTC (rev 1275)
+++ pkg/vegan/inst/ChangeLog	2010-08-24 07:48:01 UTC (rev 1276)
@@ -8,30 +8,31 @@
 	20, 2010.
 
 	* permutest.cca: defaults to 99 permutations instead of 100 (to
-	be consistent). Item 'call' no stores the call to permutest()
+	be consistent). Item 'call' now stores the call to permutest()
 	instead of the call of the ordination which is now saved in
 	'testcall'.  This means that update() works now.
 
 	* anova.ccalist: Started to work on the concept of permutation
-	test comparison of several cca/ rda/ capscale models. The first
-	stage of the function was added to the R-Forge (undocumented!).
-	My first idea is to run permutest.cca with the same RNG seed and
-	collect the permutations from the differences of these models. I
-	know now that this won't work because permuted residuals differ
+	test comparison of several cca/ rda/ capscale models. The basic
+	function was added to the R-Forge (undocumented!).  First idea is
+	to run permutest.cca with the same RNG seed and collect the
+	permutations from the differences of these models.  This won't be
+	consistent with other anova.cca* because permuted residuals differ
 	from the corresponding partial model (except with model =
 	"direct").  Another option that I have on my mind is that I use
 	model.matrix.cca to reconstruct a matrix of RHS of each model, and
 	then run a series partial model ANOVAs. Here the problem is that
 	the statistics will be sequential, i.e., the residual of each
-	model is from the next model and not from the final
-	model (bigmodel). Naturally, we have to figure out how the
-	permutation should be done. Probably a note to R-Devel to open up
-	discussion on the issue. NOTE: there is no automatic delegation to
-	this function. If you try this, you must explcititly write
-	"anova.ccalist(model1, model2, model3). NOTE2: There are no tests
-	of the sanity of the input: be careful. NOTE3: Does not yet work
-	with Null model (y ~ 1) since permutest.cca won't work with them
-	(anova.ccanull would work).
+	model is from the next model and not from the final model, and the
+	models must be in increasing order or ordered programmatically;
+	the current test will study differences of any sequence.
+	Naturally, we have to figure out how the permutation should be
+	done. Probably a note to R-Devel to open up discussion on the
+	issue. NOTE: there is no automatic delegation to this function. If
+	you try this, you must explcititly write "anova.ccalist(model1,
+	model2, model3). NOTE2: There are no tests of the sanity of the
+	input: be careful. NOTE3: Does not work with saturated model with
+	null residual variance.
 	
 Version 1.18-9 (closed August 20, 2010)
 



More information about the Vegan-commits mailing list