[Vegan-commits] r1629 - in pkg/vegan: R inst man tests/Examples

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Jun 12 21:44:41 CEST 2011


Author: jarioksa
Date: 2011-06-12 21:44:40 +0200 (Sun, 12 Jun 2011)
New Revision: 1629

Added:
   pkg/vegan/R/anova.prc.R
Modified:
   pkg/vegan/inst/ChangeLog
   pkg/vegan/man/anova.cca.Rd
   pkg/vegan/tests/Examples/vegan-Ex.Rout.save
Log:
add anova.prc to allow by = 'axis' for prc

Added: pkg/vegan/R/anova.prc.R
===================================================================
--- pkg/vegan/R/anova.prc.R	                        (rev 0)
+++ pkg/vegan/R/anova.prc.R	2011-06-12 19:44:40 UTC (rev 1629)
@@ -0,0 +1,12 @@
+`anova.prc` <-
+    function(object, ...)
+{
+    ## Refit prc() as an rda() for anova.cca()
+    Z <- qr.X(object$pCCA$QR)
+    X <- qr.X(object$CCA$QR)
+    ## Get the name of the original response variable
+    fla <- as.character(object$call$response)
+    fla <- as.formula(paste(fla, "~ X + Condition(Z)"))
+    mod <- rda(fla)
+    anova(mod, ...)
+}

Modified: pkg/vegan/inst/ChangeLog
===================================================================
--- pkg/vegan/inst/ChangeLog	2011-06-12 19:43:42 UTC (rev 1628)
+++ pkg/vegan/inst/ChangeLog	2011-06-12 19:44:40 UTC (rev 1629)
@@ -4,6 +4,15 @@
 
 Version 1.18-32 (opened May 30, 2011)
 
+	* anova.prc: new function that casts prc() result to a
+	corresponding rda() and submits this to anova.cca(). With this is
+	it is possible to analyse anova(..., by = "axis"). Other cases are
+	possible as well, but not very useful as "margin" and "term" only
+	analyse all constraints as a single matrix. Now some functions
+	that were made refuse prc() results in 1.18-30 work again, and
+	anova.ccabyaxis() even makes sense. This fixes a problem Jae
+	Pasari raised in his email.
+
 	* vegdist docs: Brian Inouye informed us that we are not
 	calculating the Raup-Crick index like originally suggested: we use
 	equal probabilities for all species, but the species probabilities

Modified: pkg/vegan/man/anova.cca.Rd
===================================================================
--- pkg/vegan/man/anova.cca.Rd	2011-06-12 19:43:42 UTC (rev 1628)
+++ pkg/vegan/man/anova.cca.Rd	2011-06-12 19:44:40 UTC (rev 1629)
@@ -4,6 +4,7 @@
 \alias{anova.ccabyaxis}
 \alias{anova.ccabyterm}
 \alias{anova.ccabymargin}
+\alias{anova.prc}
 \alias{permutest}
 \alias{permutest.default}
 \alias{permutest.cca}

Modified: pkg/vegan/tests/Examples/vegan-Ex.Rout.save
===================================================================
--- pkg/vegan/tests/Examples/vegan-Ex.Rout.save	2011-06-12 19:43:42 UTC (rev 1628)
+++ pkg/vegan/tests/Examples/vegan-Ex.Rout.save	2011-06-12 19:44:40 UTC (rev 1629)
@@ -741,7 +741,7 @@
 > ### Title: Permutation Test for Constrained Correspondence Analysis,
 > ###   Redundancy Analysis and Constrained Analysis of Principal Coordinates
 > ### Aliases: anova.cca anova.ccanull anova.ccabyaxis anova.ccabyterm
-> ###   anova.ccabymargin permutest permutest.default permutest.cca
+> ###   anova.ccabymargin anova.prc permutest permutest.default permutest.cca
 > ###   print.permutest.cca
 > ### Keywords: multivariate htest
 > 
@@ -4624,7 +4624,7 @@
 
 Formula:
 y ~ s(x1, x2, k = knots)
-<environment: 0x103145468>
+<environment: 0x103676520>
 
 Estimated degrees of freedom:
 6.2955  total = 7.295494 
@@ -4640,7 +4640,7 @@
 
 Formula:
 y ~ s(x1, x2, k = knots)
-<environment: 0x1063106e0>
+<environment: 0x105814510>
 
 Estimated degrees of freedom:
 4.9207  total = 5.920718 
@@ -4796,7 +4796,7 @@
 
 Formula:
 y ~ s(x1, x2, k = knots)
-<environment: 0x106d80540>
+<environment: 0x1073cc078>
 
 Estimated degrees of freedom:
 8.9275  total = 9.927492 
@@ -4809,7 +4809,7 @@
 
 Formula:
 y ~ s(x1, x2, k = knots)
-<environment: 0x1063f4df0>
+<environment: 0x103301c30>
 
 Estimated degrees of freedom:
 7.7529  total = 8.75294 
@@ -4822,7 +4822,7 @@
 
 Formula:
 y ~ s(x1, x2, k = knots)
-<environment: 0x10706ab18>
+<environment: 0x10461d078>
 
 Estimated degrees of freedom:
 8.8962  total = 9.89616 
@@ -5875,7 +5875,7 @@
 Permutation test for rda under reduced model
 Permutations stratified within 'week'
 
-Model: prc(response = pyrifos, treatment = dose, time = week)
+Model: rda(formula = pyrifos ~ X + Condition(Z))
          Df     Var      F N.Perm Pr(>F)   
 RDA1      1  25.282 15.096     99   0.01 **
 Residual 77 128.959                        
@@ -7520,7 +7520,7 @@
 
 Formula:
 y ~ s(x1, x2, k = knots)
-<environment: 0x108058578>
+<environment: 0x107afa640>
 
 Estimated degrees of freedom:
 2  total = 3 
@@ -7997,7 +7997,7 @@
 > ### * <FOOTER>
 > ###
 > cat("Time elapsed: ", proc.time() - get("ptime", pos = 'CheckExEnv'),"\n")
-Time elapsed:  116.809 1.693 128.077 0 0 
+Time elapsed:  103.176 1.152 106.333 0 0 
 > grDevices::dev.off()
 null device 
           1 



More information about the Vegan-commits mailing list