[Vegan-commits] r1468 - in branches/1.17: R inst man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Jan 20 18:29:53 CET 2011


Author: jarioksa
Date: 2011-01-20 18:29:52 +0100 (Thu, 20 Jan 2011)
New Revision: 1468

Modified:
   branches/1.17/R/anova.ccabyaxis.R
   branches/1.17/R/anova.ccabyterm.R
   branches/1.17/R/capscale.R
   branches/1.17/R/cca.formula.R
   branches/1.17/R/fitted.capscale.R
   branches/1.17/R/ordiParseFormula.R
   branches/1.17/R/plot.specaccum.R
   branches/1.17/R/predict.rda.R
   branches/1.17/R/rda.formula.R
   branches/1.17/R/simulate.rda.R
   branches/1.17/R/specaccum.R
   branches/1.17/inst/ChangeLog
   branches/1.17/man/anova.cca.Rd
   branches/1.17/man/capscale.Rd
   branches/1.17/man/cca.object.Rd
   branches/1.17/man/simulate.rda.Rd
   branches/1.17/man/specaccum.Rd
Log:
merged rev 1444 to 1467 to branches/1.17

Modified: branches/1.17/R/anova.ccabyaxis.R
===================================================================
--- branches/1.17/R/anova.ccabyaxis.R	2011-01-20 14:24:15 UTC (rev 1467)
+++ branches/1.17/R/anova.ccabyaxis.R	2011-01-20 17:29:52 UTC (rev 1468)
@@ -7,12 +7,23 @@
         stop("Needs a constrained ordination")
     if (is.null(object$terms)) 
         stop("Analysis is only possible for models fitted using formula")
-    lc <- object$CCA$u
     ## Handle missing values in scores, both "omit" and "exclude" to
     ## match dims with data.
     if (!is.null(object$na.action)) {
-        lc <- stats:::napredict.exclude(object$na.action, lc)
+        u <- stats:::napredict.exclude(object$na.action, object$CCA$u)
+    } else {
+        u <- object$CCA$u
     }
+    ## pad with NA rows if there is a subset
+    if (!is.null(object$subset)) {
+        lc <- matrix(NA, nrow=length(object$subset),
+                     ncol = ncol(u))
+        lc[object$subset,]  <- u
+        object$call$subset <- object$subset
+    } else {
+        lc <- u
+    }
+    lc <- as.data.frame(lc)
     axnam <- colnames(lc)
     df <- c(rep(1, rnk), object$CA$rank)
     chi <- c(object$CCA$eig, Residual = object$CA$tot.chi)
@@ -21,8 +32,10 @@
     Pval <- rep(NA, rnk+1)
     out <- data.frame(df, chi, Fval, nperm, Pval)
     environment(object$terms) <- environment()
-    fla <- update(formula(object), . ~ lc[,1] + Condition(lc[,-1]))
-    sol <- anova(update(object, fla),  ...)
+    fla <- paste(". ~ ", axnam[1], "+ Condition(",
+                 paste(axnam[-1], collapse="+"),")")
+    fla <- update(formula(object), fla)
+    sol <- anova(update(object, fla, data=lc),  ...)
     out[c(1, rnk + 1), ] <- sol
     seed <- attr(sol, "Random.seed")
     attr(out, "names") <- attr(sol, "names")
@@ -33,8 +46,10 @@
     bigperm <- out$N.Perm[1]
     if (rnk > 1) {
         for (.ITRM in 2:rnk) {
-            fla <- update(formula(object),  .~ lc[, .ITRM] + Condition(lc[,-(.ITRM)]) )
-            sol <- update(object, fla)
+            fla <- paste(".~", axnam[.ITRM], "+Condition(",
+                         paste(axnam[-(.ITRM)], collapse="+"),")")
+            fla <- update(formula(object),  fla) 
+            sol <- update(object, fla, data = lc)
             assign(".Random.seed", seed, envir = .GlobalEnv)
             out[.ITRM, ] <- as.matrix(anova(sol, ...))[1, 
                 ]

Modified: branches/1.17/R/anova.ccabyterm.R
===================================================================
--- branches/1.17/R/anova.ccabyterm.R	2011-01-20 14:24:15 UTC (rev 1467)
+++ branches/1.17/R/anova.ccabyterm.R	2011-01-20 17:29:52 UTC (rev 1468)
@@ -25,14 +25,17 @@
     pchi[ntrm, ] <- sim$num
     df[ntrm:(ntrm + 1)] <- sim$df
     chi[ntrm:(ntrm + 1)] <- sim$chi
-    modelframe <- model.frame(object)
-    environment(object$terms) <- environment()
+    if (!is.null(object$call$data))
+        modelframe <- ordiGetData(object$call, NULL)
+    else
+        modelframe <- NULL
     for (.ITRM in ntrm:2) {
         if (ntrm < 2) 
             break
         assign(".Random.seed", sim$Random.seed, envir = .GlobalEnv)
         fla <- as.formula(paste(" . ~ . -", trmlab[.ITRM]))
-        object <- update(object, fla, data = modelframe)
+        object <- update(object, fla,
+                         if (!is.null(modelframe)) data = modelframe)
         ## Change in data set due to missing values?
         if (length(object$residuals) != n0)
             stop("number of rows has changed: remove missing values?")

Modified: branches/1.17/R/capscale.R
===================================================================
--- branches/1.17/R/capscale.R	2011-01-20 14:24:15 UTC (rev 1467)
+++ branches/1.17/R/capscale.R	2011-01-20 17:29:52 UTC (rev 1468)
@@ -1,7 +1,7 @@
 `capscale` <-
     function (formula, data, distance = "euclidean", sqrt.dist = FALSE,
               comm = NULL, add = FALSE, dfun = vegdist,
-              metaMDSdist = FALSE, na.action = na.fail, ...) 
+              metaMDSdist = FALSE, na.action = na.fail, subset = NULL, ...) 
 {
     EPS <- sqrt(.Machine$double.eps)
     if (!inherits(formula, "formula")) 
@@ -44,12 +44,18 @@
     ## deleted due to missing values)
     fla <- update(formula, X ~ .)
     environment(fla) <- environment()
-    d <- ordiParseFormula(fla, data, envdepth = 1, na.action = na.action)
+    d <- ordiParseFormula(fla,
+                          if(is.data.frame(data) && !is.null(comm)) cbind(data, comm)
+                          else data,
+                          envdepth = 1, na.action = na.action,
+                          subset = substitute(subset))
+    ## ordiParseFormula subsets rows of dissimilarities: do the same
+    ## for columns ('comm' is handled later)
+    if (!is.null(d$subset))
+        d$X <- d$X[, d$subset, drop = FALSE]
     ## Delete columns if rows were deleted due to missing values
     if (!is.null(d$na.action)) {
         d$X <- d$X[, -d$na.action, drop = FALSE]
-        if (!is.null(comm))
-            comm <- comm[-d$na.action,,drop=FALSE]
     }
     X <- as.dist(d$X)
     k <- attr(X, "Size") - 1
@@ -102,6 +108,12 @@
     if (!is.null(comm)) {
         comm <- scale(comm, center = TRUE, scale = FALSE)
         sol$colsum <- sd(comm)
+        ## take a 'subset' of the community after scale()
+        if (!is.null(d$subset))
+            comm <- comm[d$subset, , drop = FALSE]
+        ## NA action after 'subset'
+        if (!is.null(d$na.action))
+            comm <- comm[-d$na.action, , drop = FALSE]
         if (!is.null(sol$pCCA)) 
             comm <- qr.resid(sol$pCCA$QR, comm)
         if (!is.null(sol$CCA)) {
@@ -131,9 +143,13 @@
     sol$call$formula <- formula(d$terms, width.cutoff = 500)
     sol$call$formula[[2]] <- formula[[2]]
     sol$method <- "capscale"
+    if (add)
+        sol$ac <- X$ac
+    sol$adjust <- adjust
     sol$inertia <- inertia
     if (metaMDSdist)
         sol$metaMDSdist <- commname
+    sol$subset <- d$subset
     sol$na.action <- d$na.action
     class(sol) <- c("capscale", class(sol))
     if (!is.null(sol$na.action))

Modified: branches/1.17/R/cca.formula.R
===================================================================
--- branches/1.17/R/cca.formula.R	2011-01-20 14:24:15 UTC (rev 1467)
+++ branches/1.17/R/cca.formula.R	2011-01-20 17:29:52 UTC (rev 1468)
@@ -24,6 +24,7 @@
     }
     sol$terms <- d$terms
     sol$terminfo <- ordiTerminfo(d, d$modelframe)
+    sol$subset <- d$subset
     sol$na.action <- d$na.action
     sol$call <- match.call()
     sol$call[[1]] <- as.name("cca")

Modified: branches/1.17/R/fitted.capscale.R
===================================================================
--- branches/1.17/R/fitted.capscale.R	2011-01-20 14:24:15 UTC (rev 1467)
+++ branches/1.17/R/fitted.capscale.R	2011-01-20 17:29:52 UTC (rev 1468)
@@ -10,8 +10,11 @@
                 CA = object$CA$u.eig,
                 Imaginary = object$CA$imaginary.u.eig)
     ## Distances or working scores U
-    if (type == "response")
-        dist(U)
-    else
-        U
+    if (type == "response") {
+        U <- dist(U)
+        ## remove additive constant (if add = TRUE)
+        if (!is.null(object$ac))
+            U <- U - object$ac
+    }
+    U
 }

Modified: branches/1.17/R/ordiParseFormula.R
===================================================================
--- branches/1.17/R/ordiParseFormula.R	2011-01-20 14:24:15 UTC (rev 1467)
+++ branches/1.17/R/ordiParseFormula.R	2011-01-20 17:29:52 UTC (rev 1468)
@@ -48,8 +48,9 @@
     ## Select a subset of data and species
     if (!is.null(subset)) {
         subset <- eval(subset,
-                       if (inherits(data, "data.frame")) cbind(data, X) else X,
-                       parent.frame())
+                       if (inherits(data, "data.frame")) cbind(data, X)
+                       else as.data.frame(X),
+                       parent.frame(2))
         X <- X[subset, , drop = FALSE]
         if (NROW(mf) > 0)
             mf <- mf[subset, , drop = FALSE]
@@ -98,5 +99,5 @@
     }
     list(X = X, Y = Y, Z = Z, terms = terms(fla, width.cutoff = 500), 
          terms.expand = terms(flapart, width.cutoff = 500), modelframe = mf,
-         na.action = nas, excluded = excluded)
+         subset = subset, na.action = nas, excluded = excluded)
 }

Modified: branches/1.17/R/plot.specaccum.R
===================================================================
--- branches/1.17/R/plot.specaccum.R	2011-01-20 14:24:15 UTC (rev 1467)
+++ branches/1.17/R/plot.specaccum.R	2011-01-20 17:29:52 UTC (rev 1468)
@@ -1,25 +1,30 @@
-"plot.specaccum" <-
+`plot.specaccum` <-
     function(x, add = FALSE, ci = 2, ci.type = c("bar","line","polygon"), 
-             col = par("fg"), ci.col = col, ci.lty = 1, xlab = "Sites",
-             ylab = x$method, ylim, ...)
+             col = par("fg"), ci.col = col, ci.lty = 1, xlab,
+             ylab = x$method, ylim, xvar = c("sites", "individuals"), ...)
 {
+    xvar <- match.arg(xvar)
+    xaxvar <- x[[xvar]]
+    if (missing(xlab))
+        xlab <- paste(toupper(substring(xvar, 1, 1)),
+                              substring(xvar, 2), sep="")
     ci.type <- match.arg(ci.type)
     if (!add) {
         if (missing(ylim))
-            ylim<- c(1, max(x$richness, x$richness + ci*x$sd))
-        plot(x$sites, x$richness, xlab=xlab, ylab=ylab, ylim=ylim,
+            ylim <- c(1, max(x$richness, x$richness + ci*x$sd))
+        plot(xaxvar, x$richness, xlab=xlab, ylab=ylab, ylim=ylim,
              type="n", ...)
     }
     if (!is.null(x$sd) && ci)
         switch(ci.type,
-               bar = segments(x$sites, x$richness - ci*x$sd, x$sites,
+               bar = segments(xaxvar, x$richness - ci*x$sd, xaxvar,
                   x$richness + ci*x$sd, col=ci.col, lty=ci.lty, ...),
-               line = matlines(x$sites, x$richness + t(rbind(-ci,ci) %*% x$sd),
+               line = matlines(xaxvar, x$richness + t(rbind(-ci,ci) %*% x$sd),
                  col=ci.col, lty=ci.lty, ...),
-               polygon = polygon(c(x$sites, rev(x$sites)),
+               polygon = polygon(c(xaxvar, rev(xaxvar)),
                  c(x$richness - ci*x$sd, rev(x$richness + ci*x$sd)), col=ci.col,
                  lty=ci.lty,  ...)
                )
-    lines(x$sites, x$richness,col=col, ...)
+    lines(xaxvar, x$richness,col=col, ...)
     invisible()
 }

Modified: branches/1.17/R/predict.rda.R
===================================================================
--- branches/1.17/R/predict.rda.R	2011-01-20 14:24:15 UTC (rev 1467)
+++ branches/1.17/R/predict.rda.R	2011-01-20 17:29:52 UTC (rev 1468)
@@ -30,8 +30,14 @@
                          newdata = newdata, rank = take)
         }
         if (inherits(object, "capscale")) {
-            if (take > 0)
-                out <- dist(u %*% slam/sqrt(nr))
+            if (take > 0) {
+                out <- u %*% slam/sqrt(nr)
+                if (type == "response") {
+                    out <- dist(out)
+                    if (!is.null(object$ac))
+                        out <- out - object$ac
+                }
+            }
         } else {
             if (take > 0) 
                 out <- u %*% slam %*% t(v)

Modified: branches/1.17/R/rda.formula.R
===================================================================
--- branches/1.17/R/rda.formula.R	2011-01-20 14:24:15 UTC (rev 1467)
+++ branches/1.17/R/rda.formula.R	2011-01-20 17:29:52 UTC (rev 1468)
@@ -23,6 +23,7 @@
     }
     sol$terms <- d$terms
     sol$terminfo <- ordiTerminfo(d, d$modelframe)
+    sol$subset <- d$subset
     sol$na.action <- d$na.action
     sol$call <- match.call()
     sol$call[[1]] <- as.name("rda")

Modified: branches/1.17/R/simulate.rda.R
===================================================================
--- branches/1.17/R/simulate.rda.R	2011-01-20 14:24:15 UTC (rev 1467)
+++ branches/1.17/R/simulate.rda.R	2011-01-20 17:29:52 UTC (rev 1468)
@@ -83,8 +83,63 @@
     ans
 }
 
+
+### capscale method: copies simulate.rda as much as possible. Function
+### works with the internal metric scaling mapping of fit and error,
+### but returns Euclidean distances adjusted to the original scaling
+### of input dissimilarities. Only the real components are used, and
+### capscale() of simulated dissimilarities have no Imaginary
+### component.
+
 `simulate.capscale` <-
-    function(object, nsim = 1, seed = NULL, ...)
+    function(object, nsim = 1, seed = NULL, indx = NULL, rank = "full", ...) 
 {
-    .NotYetImplemented()
+    ## Handle RNG: code directly from stats::simulate.lm
+    if (!exists(".Random.seed", envir = .GlobalEnv, inherits = FALSE)) 
+        runif(1)
+    if (is.null(seed)) 
+        RNGstate <- get(".Random.seed", envir = .GlobalEnv)
+    else {
+        R.seed <- get(".Random.seed", envir = .GlobalEnv)
+        set.seed(seed)
+        RNGstate <- structure(seed, kind = as.list(RNGkind()))
+        on.exit(assign(".Random.seed", R.seed, envir = .GlobalEnv))
+    }
+    if (nsim > 1)
+        .NotYetUsed("nsim")
+    ## predict.capscale cannot be used because it returns either
+    ## dissimilarities ("response") or scores with the rank of the
+    ## constrained solution, and we need rank of the data (not of
+    ## constraints).
+    if (rank > 0) {
+        ftd <- qr.fitted(object$CCA$QR, object$CCA$Xbar)
+        ## redo analysis when rank < full
+        if (rank < object$CCA$rank) {
+            x <- svd(ftd, nu = rank, nv = rank)
+            ftd <- x$u %*% diag(x$d[1:rank], nrow=rank) %*% t(x$v)
+        }
+    } else {
+        ftd <- matrix(0, nrow=nrow(object$CA$Xbar),
+                      ncol = ncol(object$CA$Xbar))
+    }
+    ## add partial Fit to the constrained
+    if (!is.null(object$pCCA))
+        ftd <- ftd + object$pCCA$Fit
+    if (is.null(indx))
+        ans <- as.data.frame(ftd + matrix(rnorm(length(ftd), 
+               sd = outer(rep(1,nrow(ftd)), sd(object$CA$Xbar))), 
+               nrow = nrow(ftd)))
+    else
+        ans <- ftd + object$CA$Xbar[indx,]
+    ## return Euclidean distances
+    ans <- dist(ans)
+    ## remove adjustment done in capscale and put dissimilarities to
+    ## (approximately) original scale
+    ans <- ans/object$adjust
+    if (is.null(indx))
+        attr(ans, "seed") <- RNGstate
+    else
+        attr(ans, "seed") <- indx
+    ans
 }
+

Modified: branches/1.17/R/specaccum.R
===================================================================
--- branches/1.17/R/specaccum.R	2011-01-20 14:24:15 UTC (rev 1467)
+++ branches/1.17/R/specaccum.R	2011-01-20 17:29:52 UTC (rev 1468)
@@ -88,7 +88,7 @@
     out <- list(call = match.call(), method = method, sites = sites,
                 richness = specaccum, sd = sdaccum, perm = perm)
     if (method == "rarefaction")
-        out$invidividuals <- ind
+        out$individuals <- ind
     class(out) <- "specaccum"
     out
 }

Modified: branches/1.17/inst/ChangeLog
===================================================================
--- branches/1.17/inst/ChangeLog	2011-01-20 14:24:15 UTC (rev 1467)
+++ branches/1.17/inst/ChangeLog	2011-01-20 17:29:52 UTC (rev 1468)
@@ -4,6 +4,23 @@
 
 Version 1.17-7 (opened January 10, 2011)
 
+	* merged revs 1444 to 1467:
+
+	* fixes in anova.cca scope, subset and NA handling:
+	anova.ccabyaxis, anova.ccabyterm, ordiParseFormula, rda.formula
+	cca.formula, capscale.
+
+	* implemented subset in capscale.
+
+	* implemented simulate.capscale. 
+
+	* removed additive constant 'ac' in predict.rda() for capscale and
+	fitted.capscale().
+
+	* fixed typo in specaccum() result.
+
+	* added choice of 'individuals' or 'sites' in plot.specaccum()
+
 Version 1.17-6 (released January 10, 2011)
 
 	* merged revs 1427:1441 (versions 1.18-19 and 1.18-20) or

Modified: branches/1.17/man/anova.cca.Rd
===================================================================
--- branches/1.17/man/anova.cca.Rd	2011-01-20 14:24:15 UTC (rev 1467)
+++ branches/1.17/man/anova.cca.Rd	2011-01-20 17:29:52 UTC (rev 1468)
@@ -137,6 +137,10 @@
   \code{\link{anova}} table and uses \code{\link{print.anova}} for printing.
 }
 \note{
+  Some cases of \code{anova} need access to the original data on
+  constraints (at least \code{by = "term"} and \code{by = "margin"}),
+  and they may fail if data are unavailable.
+ 
   The default permutation \code{model} changed from \code{"direct"} to
   \code{"reduced"} in \pkg{vegan} version 1.14-11 (release version
   1.15-0), and you must explicitly set \code{model = "direct"} for

Modified: branches/1.17/man/capscale.Rd
===================================================================
--- branches/1.17/man/capscale.Rd	2011-01-20 14:24:15 UTC (rev 1467)
+++ branches/1.17/man/capscale.Rd	2011-01-20 17:29:52 UTC (rev 1468)
@@ -21,7 +21,7 @@
 \usage{
 capscale(formula, data, distance = "euclidean", sqrt.dist = FALSE,
     comm = NULL, add = FALSE,  dfun = vegdist, metaMDSdist = FALSE,
-    na.action = na.fail, ...)
+    na.action = na.fail, subset = NULL, ...)
 }
 
 \arguments{
@@ -79,6 +79,11 @@
      \code{NA} for scores of missing observations. Unlike in
      \code{\link{rda}}, no WA scores are available for missing
      constraints or conditions.}
+   \item{subset}{Subset of data rows. This can be a logical vector
+     which is \code{TRUE} for kept observations, or a logical
+     expression which can contain variables in the working
+     environment, \code{data} or species names of the community data
+     (if given in the formula or as \code{comm} argument).}
    \item{\dots}{Other parameters passed to \code{\link{rda}} or to
      \code{\link{metaMDSdist}}.  }
 }

Modified: branches/1.17/man/cca.object.Rd
===================================================================
--- branches/1.17/man/cca.object.Rd	2011-01-20 14:24:15 UTC (rev 1467)
+++ branches/1.17/man/cca.object.Rd	2011-01-20 17:29:52 UTC (rev 1468)
@@ -126,15 +126,19 @@
   }
 }
 
-\section{NA Action}{
-  If the constraints had missing values, and \code{\link{na.action}}
+\section{NA Action and Subset}{
+  If the constraints had missing values or subsets, and \code{\link{na.action}}
   was set to  \code{\link{na.exclude}} or \code{\link{na.omit}}, the
   result will have some extra items:
   \describe{
+    \item{\code{subset}}{subset evaluated as a logical vector
+      (\code{TRUE} for included cases).}
     \item{\code{na.action}}{The object returned by
-    \code{\link{na.action}} which is a named vector of indices of
-    removed items. The class of the vector is either \code{"omit"} or
-    \code{"exclude"} as set by \code{\link{na.action}}.}
+      \code{\link{na.action}} which is a named vector of indices of
+      removed items. The class of the vector is either \code{"omit"} or
+      \code{"exclude"} as set by \code{\link{na.action}}. The \code{na.action}
+      is applied after \code{subset} so that the indices refer to the subset
+      data.}
   \item{\code{residuals.zombie}}{A zombie vector of the length of
     number of rows in the residual ordination. Some standard \R
     functions find the number of valid observations from this vector,
@@ -151,6 +155,17 @@
     ordination with identical conditions as above.}
   }
 }
+
+\section{capscale}{
+  Function \code{capscale} may add some items depending on its arguments:
+  \describe{
+    \item{\code{metaMDSdist}}{The data set name if 
+       \code{metaMDSdist = TRUE}.} 
+    \item{\code{ac}}{Additive constant used if \code{add = TRUE}.}
+    \item{\code{adjust}}{Adjustment of dissimilarities: see
+      \code{\link{capscale}}, section \dQuote{Notes}.}
+  }
+}
   
 \seealso{The description here provides a hacker's interface.  For more
   user friendly access to the \code{cca} object see

Modified: branches/1.17/man/simulate.rda.Rd
===================================================================
--- branches/1.17/man/simulate.rda.Rd	2011-01-20 14:24:15 UTC (rev 1467)
+++ branches/1.17/man/simulate.rda.Rd	2011-01-20 17:29:52 UTC (rev 1468)
@@ -2,13 +2,14 @@
 \alias{simulate.rda}
 \alias{simulate.cca}
 \alias{simulate.capscale}
-\title{ Simulate Responses with Gaussian Error for Redundancy Analysis }
+\title{ Simulate Responses with Gaussian Error or Permuted Residulas for Constrained Ordination }
 
 \description{ Function simulates a response data frame so that it adds
  Gaussian error to the fitted responses of Redundancy Analysis
- (\code{\link{rda}}). The function is a special case of generic
- \code{\link{simulate}}, and works similarly as \code{simulate.lm}. 
-}
+ (\code{\link{rda}}), Constrained Correspondence Analysis
+ (\code{\link{cca}}) or distance-based RDA (\code{\link{capscale}}).
+ The function is a special case of generic \code{\link{simulate}}, and
+ works similarly as \code{simulate.lm}.  }
 
 \usage{
 \method{simulate}{rda}(object, nsim = 1, seed = NULL, indx = NULL, rank = "full", ...)
@@ -33,10 +34,19 @@
 
 \details{ The implementation follows \code{"lm"} method of
   \code{\link{simulate}}, and adds Gaussian (Normal) error to the
-  fitted values (\code{\link{fitted.rda}} using function
+  fitted values (\code{\link{fitted.rda}}) using function
   \code{\link{rnorm}}. The standard deviations are estimated
   independently for each species (column) from the residuals after
-  fitting the constraints.
+  fitting the constraints. Alternatively, the function can take a
+  permutation index that is used to add permuted residuals
+  (unconstrained component) to the fitted values. Raw data are used in
+  \code{\link{rda}}. Internal Chi-square transformed data in
+  \code{\link{cca}} within the function, but the returned data frame is 
+  similar to the original input data. The simulation is performed on
+  internal metric scaling data in \code{\link{capscale}}, but the
+  function returns the Euclidean distances calculated from the simulated
+  data.  The simulation uses only the real components, and the imaginary
+  dimensions are ignored.
 }
 
 \value{ Returns a data frame with similar additional arguments on
@@ -44,13 +54,11 @@
 
 \author{Jari Oksanen}
 
-\note{ The function is not implemented for \code{\link{cca}} or
-  \code{\link{capscale}} objects, but only for \code{\link{rda}}.  
-}
 
 \seealso{ \code{\link{simulate}} for the generic case and for
-  \code{\link{lm}} objects. Function \code{\link{fitted.rda}} returns
-  fitted values without the error component. 
+  \code{\link{lm}} objects. Functions \code{\link{fitted.rda}} and
+  \code{\link{fitted.cca}} return fitted values without the error
+  component.  
 }
 
 \examples{

Modified: branches/1.17/man/specaccum.Rd
===================================================================
--- branches/1.17/man/specaccum.Rd	2011-01-20 14:24:15 UTC (rev 1467)
+++ branches/1.17/man/specaccum.Rd	2011-01-20 17:29:52 UTC (rev 1468)
@@ -15,8 +15,8 @@
 specaccum(comm, method = "exact", permutations = 100,
           conditioned =TRUE, gamma = "jack1",  ...)
 \method{plot}{specaccum}(x, add = FALSE, ci = 2, ci.type = c("bar", "line", "polygon"), 
-    col = par("fg"), ci.col = col, ci.lty = 1, xlab = "Sites", 
-    ylab = x$method, ylim, ...)
+    col = par("fg"), ci.col = col, ci.lty = 1, xlab, 
+    ylab = x$method, ylim, xvar = c("sites", "individuals"), ...)
 \method{boxplot}{specaccum}(x, add = FALSE, ...)
 }
 
@@ -49,8 +49,12 @@
     \code{"polygon"}.}
   \item{ci.lty}{Line type for confidence intervals or border of the
     \code{"polygon"}.}
-  \item{xlab,ylab}{Labels for \code{x} and \code{y} axis.}
+  \item{xlab,ylab}{Labels for \code{x} (defaults \code{xvar}) and
+    \code{y} axis.}
   \item{ylim}{the y limits of the plot.}
+  \item{xvar}{Variable used for the horizontal axis:
+    \code{"individuals"} can be used only with
+    \code{method = "rarefaction"}. }
   \item{...}{Other parameters to functions.}
 }
 \details{



More information about the Vegan-commits mailing list