[Vegan-commits] r734 - in branches/1.15: R inst man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Mar 9 14:21:55 CET 2009


Author: jarioksa
Date: 2009-03-09 14:21:54 +0100 (Mon, 09 Mar 2009)
New Revision: 734

Modified:
   branches/1.15/R/anova.ccabyaxis.R
   branches/1.15/inst/ChangeLog
   branches/1.15/man/anova.cca.Rd
   branches/1.15/man/oecosimu.Rd
Log:
merges to 1.15-2: r683 & r690 (anova.ccabymargin got cutoff), r728 (oecosimu.Rd knows about 'statistic')

Modified: branches/1.15/R/anova.ccabyaxis.R
===================================================================
--- branches/1.15/R/anova.ccabyaxis.R	2009-03-09 12:52:18 UTC (rev 733)
+++ branches/1.15/R/anova.ccabyaxis.R	2009-03-09 13:21:54 UTC (rev 734)
@@ -1,6 +1,7 @@
 "anova.ccabyaxis" <-
-function (object, ...) 
+function (object, cutoff = 1,  ...) 
 {
+    cutoff <- cutoff + sqrt(.Machine$double.eps)
     rnk <- object$CCA$rank
     if (!max(rnk, 0)) 
         stop("Needs a constrained ordination")
@@ -11,9 +12,9 @@
     axnam <- colnames(lc)
     df <- c(rep(1, rnk), object$CA$rank)
     chi <- c(object$CCA$eig, Residual = object$CA$tot.chi)
-    Fval <- c(numeric(rnk), NA)
+    Fval <- c(chi[1:rnk]/df[1:rnk]/chi[rnk+1]*df[rnk+1], NA)
     nperm <- c(numeric(rnk), NA)
-    Pval <- c(numeric(rnk), NA)
+    Pval <- rep(NA, rnk+1)
     out <- data.frame(df, chi, Fval, nperm, Pval)
     sol <- anova(object, first = TRUE, ...)
     out[c(1, rnk + 1), ] <- sol
@@ -38,6 +39,8 @@
                 bigseed <- get(".Random.seed", envir = .GlobalEnv, 
                   inherits = FALSE)
             }
+            if (out[i, "Pr(>F)"] > cutoff)
+                break
         }
     }
     assign(".Random.seed", bigseed, envir = .GlobalEnv)

Modified: branches/1.15/inst/ChangeLog
===================================================================
--- branches/1.15/inst/ChangeLog	2009-03-09 12:52:18 UTC (rev 733)
+++ branches/1.15/inst/ChangeLog	2009-03-09 13:21:54 UTC (rev 734)
@@ -5,6 +5,11 @@
 
 Version 1.15-2 (opened January 14, 2009)
 
+	* merged r728: oecosimu.Rd example knows "statistic" argument.
+	
+	* merged r683 & r690: anova.cca(..., by = "margin") gained
+	argument "cutoff = 1", and doc expanded.
+
 	* merged r686: rad.null failed with families gaussian and Gamma.
 
 	* merged r678: anovacca.bymargin was not setting RNG properly for

Modified: branches/1.15/man/anova.cca.Rd
===================================================================
--- branches/1.15/man/anova.cca.Rd	2009-03-09 12:52:18 UTC (rev 733)
+++ branches/1.15/man/anova.cca.Rd	2009-03-09 13:21:54 UTC (rev 734)
@@ -40,7 +40,11 @@
     setting \code{by = "margin"} will assess the marginal effects of the
     terms (each marginal term analysed in a model with all other
     variables).}
-    \item{\dots}{Parameters to \code{permutest.cca}. }
+  \item{\dots}{Parameters passed to other functions. 
+    \code{anova.cca} passes all arguments to
+    \code{permutest.cca}. In \code{anova} with \code{by = "axis"} you
+    can use argument \code{cutoff} (defaults \code{1}) which stops
+    permutations after exceeding the given level. }
   \item{permutations}{Number of permutations for assessing significance
     of constraints.}
   \item{model}{Permutation model (partial match).}
@@ -99,29 +103,33 @@
   Setting \code{first = TRUE} will perform a test for the first
   constrained eigenvalue.  Argument \code{first} can be set either in
   \code{anova.cca} or in \code{permutest.cca}.  It is also possible to
-  perform significance tests for each axis or for each term (constraining
-  variable) using argument \code{by} in \code{anova.cca}. 
-  Setting \code{by = "axis"} will perform separate significance tests
-  for each constrained axis.  All previous constrained axes will be used
-  as conditions (\dQuote{partialled out}) and a test for the first
-  constrained eigenvalues is performed. Setting \code{by = "terms"} will
+  perform significance tests for each axis or for each term
+  (constraining variable) using argument \code{by} in
+  \code{anova.cca}.  Setting \code{by = "axis"} will perform separate
+  significance tests for each constrained axis.  All previous
+  constrained axes will be used as conditions (\dQuote{partialled
+  out}) and a test for the first constrained eigenvalues is
+  performed. You can stop permutation tests after exceeding a given
+  signficance level with argument \code{cutoff} to speed up
+  calculations in large models. Setting \code{by = "terms"} will
   perform separate significance test for each term (constraining
-  variable). The terms are assessed sequentially from first to last, and
-  the order of the terms will influence their significances. Setting
-  \code{by = "margin"} will perform separate significance test for each
-  marginal term in a model with all other terms. The marginal test
-  also accepts a \code{scope} argument for the
-  \code{\link{drop.scope}} which can be a character vector
-  of term labels that are analysed, or a fitted model of lower scope. 
-  The marginal effects are also known as
-  \dQuote{Type III} effects, but the current function only evaluates
-  marginal terms. It will, for instance, ignore main effects that are
-  included in interaction terms. In calculating pseudo-\eqn{F}, all
-  terms are compared to the same residual of the full
-  model. Permutations for all axes or terms will start from the same
-  \code{\link{.Random.seed}}, and the seed will be advanced to the value
-  after the longest permutation at the exit from the function.
+  variable). The terms are assessed sequentially from first to last,
+  and the order of the terms will influence their
+  significances. Setting \code{by = "margin"} will perform separate
+  significance test for each marginal term in a model with all other
+  terms. The marginal test also accepts a \code{scope} argument for
+  the \code{\link{drop.scope}} which can be a character vector of term
+  labels that are analysed, or a fitted model of lower scope.  The
+  marginal effects are also known as \dQuote{Type III} effects, but
+  the current function only evaluates marginal terms. It will, for
+  instance, ignore main effects that are included in interaction
+  terms. In calculating pseudo-\eqn{F}, all terms are compared to the
+  same residual of the full model. Permutations for all axes or terms
+  will start from the same \code{\link{.Random.seed}}, and the seed
+  will be advanced to the value after the longest permutation at the
+  exit from the function.  
 }
+
 \value{
   Function \code{permutest.cca} returns an object of class
   \code{"permutest.cca"}, which has its own \code{print} method.  The
@@ -133,6 +141,9 @@
   \code{"reduced"} in \pkg{vegan} version 1.14-11 (release version
   1.15-0), and you must explicitly set \code{model = "direct"} for
   compatibility with the old version.
+
+  Tests \code{by = "terms"} and \code{by = "margin"} are consistent
+  only when \code{model = "direct"}.  
 }
 \references{
   Legendre, P. and Legendre, L. (1998). \emph{Numerical Ecology}. 2nd English
@@ -144,7 +155,7 @@
   \code{anova.cca} with \code{by = "margin"}, and
   \code{\link{add1.cca}} an analysis for single terms additions, which
   can be used in automatic or semiautomatic model building (see
-  \code{\link{deviance.cca}}. }
+  \code{\link{deviance.cca}}). }
 
 \examples{
 data(varespec)

Modified: branches/1.15/man/oecosimu.Rd
===================================================================
--- branches/1.15/man/oecosimu.Rd	2009-03-09 12:52:18 UTC (rev 733)
+++ branches/1.15/man/oecosimu.Rd	2009-03-09 13:21:54 UTC (rev 734)
@@ -190,8 +190,7 @@
 ## Use the first eigenvalue of correspondence analysis as an index
 ## of structure: a model for making your own functions.
 data(sipoo)
-caeval <- function(x) decorana(x, ira=1)$evals
-out <- oecosimu(sipoo, caeval, "swap", burnin=100, thin=10)
+out <- oecosimu(sipoo, decorana, "swap", burnin=100, thin=10, statistic="evals")
 out
 ## Inspect the swap sequence
 matplot(t(out$oecosimu$simulated), type="l")



More information about the Vegan-commits mailing list