From noreply at r-forge.r-project.org Sat Feb 2 08:31:04 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sat, 2 Feb 2013 08:31:04 +0100 (CET) Subject: [Vegan-commits] r2400 - in pkg/vegan: . R inst man Message-ID: <20130202073104.17ED9183D8C@r-forge.r-project.org> Author: jarioksa Date: 2013-02-02 08:31:03 +0100 (Sat, 02 Feb 2013) New Revision: 2400 Modified: pkg/vegan/DESCRIPTION pkg/vegan/R/oecosimu.R pkg/vegan/R/print.oecosimu.R pkg/vegan/inst/ChangeLog pkg/vegan/man/oecosimu.Rd Log: oecosimu: better fix than r2394 -- changes the structure of the result object Modified: pkg/vegan/DESCRIPTION =================================================================== --- pkg/vegan/DESCRIPTION 2013-01-31 13:48:28 UTC (rev 2399) +++ pkg/vegan/DESCRIPTION 2013-02-02 07:31:03 UTC (rev 2400) @@ -1,7 +1,7 @@ Package: vegan Title: Community Ecology Package -Version: 2.1-24 -Date: January 25, 2013 +Version: 2.1-25 +Date: February 2, 2013 Author: Jari Oksanen, F. Guillaume Blanchet, Roeland Kindt, Pierre Legendre, Peter R. Minchin, R. B. O'Hara, Gavin L. Simpson, Peter Solymos, M. Henry H. Stevens, Helene Wagner Modified: pkg/vegan/R/oecosimu.R =================================================================== --- pkg/vegan/R/oecosimu.R 2013-01-31 13:48:28 UTC (rev 2399) +++ pkg/vegan/R/oecosimu.R 2013-02-02 07:31:03 UTC (rev 2400) @@ -123,17 +123,12 @@ if (is.null(names(indstat)) && length(indstat) == 1) names(indstat) <- statistic - ## $oecosimu cannot be added to a data frame, but this gives - ## either an error or a mess - if (is.data.frame(ind)) - ind <- as.list(ind) - if (!is.list(ind)) - ind <- list(statistic = ind) - ind$oecosimu <- list(z = z, means = means, pval = p, simulated=simind, - method=method, statistic = indstat, - alternative = alternative, isSeq = attr(x, "isSeq")) - attr(ind, "call") <- match.call() - class(ind) <- c("oecosimu", class(ind)) - ind + oecosimu <- list(z = z, means = means, pval = p, simulated=simind, + method=method, statistic = indstat, + alternative = alternative, isSeq = attr(x, "isSeq")) + out <- list(statistic = ind, oecosimu = oecosimu) + attr(out, "call") <- match.call() + class(out) <- "oecosimu" + out } Modified: pkg/vegan/R/print.oecosimu.R =================================================================== --- pkg/vegan/R/print.oecosimu.R 2013-01-31 13:48:28 UTC (rev 2399) +++ pkg/vegan/R/print.oecosimu.R 2013-02-02 07:31:03 UTC (rev 2400) @@ -20,10 +20,10 @@ ## dim attribute is always there, but print all others cat("\n\n") - cl <- class(x) - if ((length(cl) > 1 && cl[2] != "list" ) && - !any(cl %in% c("adipart", "hiersimu", "multipart"))) { - NextMethod("print", x) + + if (!inherits(x, c("adipart", "hiersimu", "multipart")) && + !inherits(x$statistic, c("numeric", "list"))) { + print(x$statistic) cat("\n") } probs <- switch(x$oecosimu$alternative, Modified: pkg/vegan/inst/ChangeLog =================================================================== --- pkg/vegan/inst/ChangeLog 2013-01-31 13:48:28 UTC (rev 2399) +++ pkg/vegan/inst/ChangeLog 2013-02-02 07:31:03 UTC (rev 2400) @@ -2,8 +2,21 @@ VEGAN DEVEL VERSIONS at http://r-forge.r-project.org/ -Version 2.1-24 (opened January 25, 2013) +Version 2.1-25 (opened February 2, 2013) + * oecosimu: changed the structure of the oecosimu() result + object. It now returns a list of two items: "statistic" is the + observed statistic, and "oecosimu" which contains the simulation + records. In previous version the function returned the statistic + and added item "oecosimu" there. Previously, the result object was + of type c("oecosimu", class(statistic)) as the original + "statistic" object was returned amended with an "oecosimu" item, + but now it is only of type "oecosimu" with the original + "statistic" as a separate item. So "statistic" is now one level + deeper instead of being the main object. + +Version 2.1-24 (closed February 2, 2013) + * simulate.nullmodel: output array inherits dimnames after the input data matrix, this is often required by oecosimu. Dimension names are now only stored once for all nsim @@ -20,9 +33,8 @@ (like would be the case if the 'statistic' was extracted from a data frame). It is now checked that only one 'statistic' is given and a comprehensible error message is issued instead of the - current confusing one. The changes were trickered in an attempt to - use picante::pd(), but this still fails because picante::pd() - needs column names that are not generated in nullmodel(). + current confusing one. The changes were trickered when testing + picante::pd(). * protest: huge speed-up. Instead of calling procrustes() in every permutation step, we only calculate the goodness of fit statistic Modified: pkg/vegan/man/oecosimu.Rd =================================================================== --- pkg/vegan/man/oecosimu.Rd 2013-01-31 13:48:28 UTC (rev 2399) +++ pkg/vegan/man/oecosimu.Rd 2013-02-02 07:31:03 UTC (rev 2400) @@ -164,13 +164,22 @@ } \value{ - Function \code{oecosimu} returns the result of \code{nestfun} added - with a component called \code{oecosimu}. The \code{oecosimu} - component contains the simulated values of the statistic (item - \code{simulated}), the name of the \code{method}, \eqn{P} value - (with given \code{alternative}), \eqn{z}-value of the statistic - based on simulation (also known as standardized effect size), and - the mean of simulations. + + Function \code{oecosimu} returns an object of class + \code{"oecosimu"}. The result object has items \code{statistic} and + \code{oecosimu}. The \code{statistic} contains the complete object + returned by \code{nestedfun} for the original data. The + \code{oecosimu} component contains the following items: + \item{statistic}{Observed values of the statistic.} + \item{simulated}{Simulated values of the statistic.} + \item{means}{Mean values of the statistic from simulations.} + \item{z}{\eqn{z}-values or the standardized effect sizes of the observed + statistic based on simulations.} + \item{pval}{The \eqn{P}-values of the statistic based on simulations.} + \item{alternative}{The type of testing as given in argument \code{alternative}.} + \item{method}{The \code{method} used in \code{\link{nullmodel}}.} + \item{isSeq}{\code{TRUE} if \code{method} was sequential.} + } \references{ From noreply at r-forge.r-project.org Sat Feb 2 17:43:42 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sat, 2 Feb 2013 17:43:42 +0100 (CET) Subject: [Vegan-commits] r2401 - in pkg/vegan: R inst Message-ID: <20130202164342.D8263183DDF@r-forge.r-project.org> Author: jarioksa Date: 2013-02-02 17:43:42 +0100 (Sat, 02 Feb 2013) New Revision: 2401 Modified: pkg/vegan/R/simulate.rda.R pkg/vegan/inst/ChangeLog Log: simulate for rda & cca also return dimnames (like does simulate.nullmodel since r2396) Modified: pkg/vegan/R/simulate.rda.R =================================================================== --- pkg/vegan/R/simulate.rda.R 2013-02-02 07:31:03 UTC (rev 2400) +++ pkg/vegan/R/simulate.rda.R 2013-02-02 16:43:42 UTC (rev 2401) @@ -53,6 +53,8 @@ ans <- ans[,,1] attributes(ans) <- attributes(ftd) } else { + dimnames(ans) <- list(rownames(ftd), colnames(ftd), + paste("sim", seq_len(nsim), sep = "_")) attr(ans, "data") <- round(ftd + object$CA$Xbar, 12) attr(ans, "method") <- paste("simulate", ifelse(is.null(indx), "parametric", "index")) @@ -131,6 +133,8 @@ ans <- ans[,,1] attributes(ans) <- attributes(ftd) } else { + dimnames(ans) <- list(rownames(ftd), colnames(ftd), + paste("sim", seq_len(nsim), sep = "_")) obsdata <- ftd + object$CA$Xbar obsdata <- (obsdata * sqrt(rc) + rc) * object$grand.total attr(ans, "data") <- round(obsdata, 12) Modified: pkg/vegan/inst/ChangeLog =================================================================== --- pkg/vegan/inst/ChangeLog 2013-02-02 07:31:03 UTC (rev 2400) +++ pkg/vegan/inst/ChangeLog 2013-02-02 16:43:42 UTC (rev 2401) @@ -14,6 +14,11 @@ but now it is only of type "oecosimu" with the original "statistic" as a separate item. So "statistic" is now one level deeper instead of being the main object. + + * simulate: the simulate functions for "rda" and "cca" return + objects with original row and column names. Function capscale() + already did so, and simulate.nullmodel() was changed so in vegan + 2.1-24 (r2396). Version 2.1-24 (closed February 2, 2013) From noreply at r-forge.r-project.org Sun Feb 3 08:28:53 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sun, 3 Feb 2013 08:28:53 +0100 (CET) Subject: [Vegan-commits] r2402 - branches/2.0/inst Message-ID: <20130203072853.7025418121E@r-forge.r-project.org> Author: jarioksa Date: 2013-02-03 08:28:53 +0100 (Sun, 03 Feb 2013) New Revision: 2402 Modified: branches/2.0/inst/NEWS.Rd Log: skeleton of NEWS: prepare for a February release of vegan 2.0-6 Modified: branches/2.0/inst/NEWS.Rd =================================================================== --- branches/2.0/inst/NEWS.Rd 2013-02-02 16:43:42 UTC (rev 2401) +++ branches/2.0/inst/NEWS.Rd 2013-02-03 07:28:53 UTC (rev 2402) @@ -2,6 +2,54 @@ \title{vegan News} \encoding{UTF-8} +\section{Changes in version 2.0-6}{ + + \subsection{BUG FIXES}{ + + \itemize{ + + \item \code{capscale} scaled species scores wrongly when other + dissimilarties than Euclidean distances were used. + + \item \code{clamtest} + + \item \code{envfit} handles unused factor levels. + + \item \code{multipart} printed wrong information about the + analysis type (but did analysis correctly). + + \item \code{procrustes} + + \item \code{treedive} and \code{treedist} name matching. + + } + + } % bug fixes + + \subsection{NEW FEATURES}{ + + \itemize{ + + \item \code{dispindmorisita} gains \eqn{P}-value. + + \item \code{metaMDS} and \code{monoMDS} have new default + convergence criteria. + + \item \code{ordiR2step} gained new argument \code{R2scope} and + handles partial redundancy analysis (pRDA). + + \item \code{orditorp} gained argument \code{select} + + \item \code{protest} prints both \eqn{m_{12}^2}{squared m12} and + \eqn{R^2}{R2}. + + } + + } % new features + + +} % end 2.0-6 + \section{Changes in version 2.0-5}{ \subsection{BUG FIXES}{ From noreply at r-forge.r-project.org Sun Feb 3 16:50:31 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sun, 3 Feb 2013 16:50:31 +0100 (CET) Subject: [Vegan-commits] r2403 - branches/2.0/inst www Message-ID: <20130203155031.D986B1849A0@r-forge.r-project.org> Author: jarioksa Date: 2013-02-03 16:50:31 +0100 (Sun, 03 Feb 2013) New Revision: 2403 Modified: branches/2.0/inst/NEWS.Rd www/NEWS.html Log: NEWS about release 2.0-6 Modified: branches/2.0/inst/NEWS.Rd =================================================================== --- branches/2.0/inst/NEWS.Rd 2013-02-03 07:28:53 UTC (rev 2402) +++ branches/2.0/inst/NEWS.Rd 2013-02-03 15:50:31 UTC (rev 2403) @@ -8,20 +8,41 @@ \itemize{ - \item \code{capscale} scaled species scores wrongly when other - dissimilarties than Euclidean distances were used. + \item The species scores were scaled correctly in + \code{capscale()} only when Euclidean distances were used. Most + graphics will change and should be redone. The function also + now displays the value of the additive constant when argument + \code{add = TRUE} was used. - \item \code{clamtest} + \item Function \code{clamtest()} failed to set the minimum + abundance threshold in some cases. The output was wrong when + some of the possible species groups were missing. The problems + were reported by Richard Telford (Bergen, Norway). - \item \code{envfit} handles unused factor levels. + \item Plotting an object fitted by \code{envfit()} would fail if + \code{p.max} was used and there were unused levels for one or + more factors. The unused levels could result from deletion of + observations with missing values or simply the result of + supplying a subset of a larger data set to \code{envfit()}. - \item \code{multipart} printed wrong information about the - analysis type (but did analysis correctly). + \item \code{multipart()} printed wrong information about the + analysis type (but did analysis correctly). Reported by Valerie + Coudrain. - \item \code{procrustes} + \item \code{oecosimu()} failed if its \code{nestedfun} returned + a data frame. A more fundamental fix will be in \pkg{vegan} + 2.2-0. - \item \code{treedive} and \code{treedist} name matching. + \item The plot of two-dimensional \code{procrustes()} solutions + often draw original axes in a wrong angle. The problem was + reported by Elizabeth Ottesen (MIT). + \item Function \code{treedive()} for functional diversity did + not correctly match the species names in the community data and + classification tree when the tree containted species that did + not occur in the data. Related function \code{treedist()} for + phylogenetic distances did not try to match the names at all. + } } % bug fixes @@ -30,19 +51,48 @@ \itemize{ - \item \code{dispindmorisita} gains \eqn{P}-value. + \item \code{dispindmorisita()} output gained a new column for + Chi-squared based probabilities that the null hypothesis (random + distribution) is true. - \item \code{metaMDS} and \code{monoMDS} have new default - convergence criteria. + \item \code{metaMDS()} and \code{monoMDS()} have new default + convergence criteria. Most importantly, scale factor of the + gradient (\code{sfgrmin}) is stricter. The former limit was too + slack with large data sets and iterations stopped early without + getting close to the solution. In addition, \code{scores()} + ignore now requests to dimensions beyond those calculated + instead of failing, and \code{scores()} for \code{metaMDS()} + results do not drop dimensions. - \item \code{ordiR2step} gained new argument \code{R2scope} and - handles partial redundancy analysis (pRDA). + \item \code{msoplot()} gained \code{legend} argument for + positioning the legend. - \item \code{orditorp} gained argument \code{select} + \item Nestedness function \code{nestednodf()} gained a \code{plot} + method. - \item \code{protest} prints both \eqn{m_{12}^2}{squared m12} and - \eqn{R^2}{R2}. + \item \code{ordiR2step()} gained new argument \code{R2scope} + (defaults \code{TRUE}) which can be used to turn off the + criterion of stopping when the adjusted \eqn{R^2}{R2} of the + current model exceeds that of the scope. This option allows + model building when the \code{scope} would be overdetermined + (number of predictors higher than number of observations). + \code{ordiR2step()} now handles partial redundancy analysis + (pRDA). + + \item \code{orditorp()} gained argument \code{select} to select + the rows or columns of the results to display. + + \item \code{protest()} prints the standardized residual sum of + squared \eqn{m_{12}^2}{squared m12} in addition to the squared + Procrustes correlation \eqn{R^2}{R2}. Both were calculated, but + only the latter was displayed. + + \item \code{wcmdscale()} gained methods for \code{print}, + \code{plot} etc. of the results. These methods are only used if + the full \code{wcmdscale} result is returned with, e.g., + argument \code{eig = TRUE}. + } } % new features Modified: www/NEWS.html =================================================================== --- www/NEWS.html 2013-02-03 07:28:53 UTC (rev 2402) +++ www/NEWS.html 2013-02-03 15:50:31 UTC (rev 2403) @@ -8,6 +8,121 @@
The species scores were scaled correctly in
+capscale()
only when Euclidean distances were used. Most
+graphics will change and should be redone. The function also
+now displays the value of the additive constant when argument
+add = TRUE
was used.
+
Function clamtest()
failed to set the minimum
+abundance threshold in some cases. The output was wrong when
+some of the possible species groups were missing. The problems
+were reported by Richard Telford (Bergen, Norway).
+
Plotting an object fitted by envfit()
would fail if
+p.max
was used and there were unused levels for one or
+more factors. The unused levels could result from deletion of
+observations with missing values or simply the result of
+supplying a subset of a larger data set to envfit()
.
+
multipart()
printed wrong information about the
+analysis type (but did analysis correctly). Reported by Valerie
+Coudrain.
+
oecosimu()
failed if its nestedfun
returned
+a data frame. A more fundamental fix will be in vegan
+2.2-0.
+
The plot of two-dimensional procrustes()
solutions
+often draw original axes in a wrong angle. The problem was
+reported by Elizabeth Ottesen (MIT).
+
Function treedive()
for functional diversity did
+not correctly match the species names in the community data and
+classification tree when the tree containted species that did
+not occur in the data. Related function treedist()
for
+phylogenetic distances did not try to match the names at all.
+
dispindmorisita()
output gained a new column for
+Chi-squared based probabilities that the null hypothesis (random
+distribution) is true.
+
metaMDS()
and monoMDS()
have new default
+convergence criteria. Most importantly, scale factor of the
+gradient (sfgrmin
) is stricter. The former limit was too
+slack with large data sets and iterations stopped early without
+getting close to the solution. In addition, scores()
+ignore now requests to dimensions beyond those calculated
+instead of failing, and scores()
for metaMDS()
+results do not drop dimensions.
+
msoplot()
gained legend
argument for
+positioning the legend.
+
Nestedness function nestednodf()
gained a plot
+method.
+
ordiR2step()
gained new argument R2scope
+(defaults TRUE
) which can be used to turn off the
+criterion of stopping when the adjusted R2 of the
+current model exceeds that of the scope. This option allows
+model building when the scope
would be overdetermined
+(number of predictors higher than number of observations).
+
ordiR2step()
now handles partial redundancy analysis
+(pRDA).
+
orditorp()
gained argument select
to select
+the rows or columns of the results to display.
+
protest()
prints the standardized residual sum of
+squared squared m12 in addition to the squared
+Procrustes correlation R2. Both were calculated, but
+only the latter was displayed.
+
wcmdscale()
gained methods for print
,
+plot
etc. of the results. These methods are only used if
+the full wcmdscale
result is returned with, e.g.,
+argument eig = TRUE
.
+
Function treedive()
for functional diversity did
not correctly match the species names in the community data and
-classification tree when the tree containted species that did
+classification tree when the tree contained species that did
not occur in the data. Related function treedist()
for
phylogenetic distances did not try to match the names at all.
protest()
prints the standardized residual sum of
-squared squared m12 in addition to the squared
+
protest()
prints the standardized residual
+statistic squared m12 in addition to the squared
Procrustes correlation R2. Both were calculated, but
only the latter was displayed.
Permutation tests are much faster in protest()
. Instead
+of calling repeatedly procrustes()
, the goodness of fit
+statistic is evaluated within then function.
+
wcmdscale()
gained methods for print
,
plot
etc. of the results. These methods are only used if
From noreply at r-forge.r-project.org Tue Feb 5 09:53:23 2013
From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org)
Date: Tue, 5 Feb 2013 09:53:23 +0100 (CET)
Subject: [Vegan-commits] r2408 - pkg/vegan/inst/doc
Message-ID: <20130205085323.A4A1118083B@r-forge.r-project.org>
Author: jarioksa
Date: 2013-02-05 09:53:23 +0100 (Tue, 05 Feb 2013)
New Revision: 2408
Modified:
pkg/vegan/inst/doc/FAQ-vegan.texi
Log:
FAQ on random effects in cca, rda, capscale & adonis
Modified: pkg/vegan/inst/doc/FAQ-vegan.texi
===================================================================
--- pkg/vegan/inst/doc/FAQ-vegan.texi 2013-02-04 18:05:25 UTC (rev 2407)
+++ pkg/vegan/inst/doc/FAQ-vegan.texi 2013-02-05 08:53:23 UTC (rev 2408)
@@ -8,7 +8,7 @@
@setfilename FAQ- at pkg{vegan}.info
@settitle @pkg{vegan} FAQ
@setchapternewpage on
- at set FAQ_YEAR 2012
+ at set FAQ_YEAR 2013
@afourpaper
@c %**end of header
@@ -26,7 +26,7 @@
Creative Commons, 543 Howard Street, 5th Floor, San Francisco,
California, 94105, USA.
-Copyright @copyright{} 2008-2012 Jari Oksanen
+Copyright @copyright{} 2008-2013 Jari Oksanen
@end quotation
@end copying
@@ -324,7 +324,7 @@
@chapter Ordination
@menu
-* I have only numeric and positive data but @pkg{vegan} still complaints::
+* I have only numeric and positive data but @pkg{vegan} still complains::
* Can I analyse binary or cover class data?::
* Why dissimilarities in @pkg{vegan} differ from other sources?::
* Why NMDS stress is sometimes 0.1 and sometimes 10?::
@@ -335,6 +335,7 @@
* How the RDA results are scaled?::
* cca fails with ``data.frame expected'' or ``"site.env" missing''::
* Variance explained by ordination axes::
+* Can I have random effects in constrained ordination or in @code{adonis}?::
* Is it possible to have passive points in ordination?::
* Class variables and dummies::
* How are environmental arrows scaled?::
@@ -348,9 +349,9 @@
* Can I zoom into an ordination plot?::
@end menu
- at node I have only numeric and positive data but @pkg{vegan} still complaints, Can I analyse binary or cover class data?, Ordination, Ordination
+ at node I have only numeric and positive data but @pkg{vegan} still complains, Can I analyse binary or cover class data?, Ordination, Ordination
@comment node-name, next, previous, up
- at section I have only numeric and positive data but @pkg{vegan} still complaints
+ at section I have only numeric and positive data but @pkg{vegan} still complains
You are wrong! Computers are painfully pedantic, and if they find
non-numeric or negative data entries, you really have them. Check your
@@ -361,7 +362,7 @@
the data). Another common reason is that you had empty cells in your
input data, and these were interpreted as missing values.
- at node Can I analyse binary or cover class data?, Why dissimilarities in @pkg{vegan} differ from other sources?, I have only numeric and positive data but @pkg{vegan} still complaints, Ordination
+ at node Can I analyse binary or cover class data?, Why dissimilarities in @pkg{vegan} differ from other sources?, I have only numeric and positive data but @pkg{vegan} still complains, Ordination
@section Can I analyse binary or cover class data?
Yes. Most @pkg{vegan} methods can handle binary data or cover abundance data.
@@ -488,7 +489,7 @@
you do not need package @pkg{ade4}, you can detach it with command
@code{detach(package:ade4)}.
- at node Variance explained by ordination axes, Is it possible to have passive points in ordination?, cca fails with ``data.frame expected'' or ``"site.env" missing'', Ordination
+ at node Variance explained by ordination axes, Can I have random effects in constrained ordination or in @code{adonis}?, cca fails with ``data.frame expected'' or ``"site.env" missing'', Ordination
@section Variance explained by ordination axes.
In general, @pkg{vegan} does not directly give any statistics on the
@@ -547,7 +548,46 @@
@end itemize
- at node Is it possible to have passive points in ordination?, Class variables and dummies, Variance explained by ordination axes, Ordination
+ at node Can I have random effects in constrained ordination or in @code{adonis}?, Is it possible to have passive points in ordination?, Variance explained by ordination axes, Ordination
+ at section Can I have random effects in constrained ordination or in @code{adonis}?
+
+No. Strictly speaking, this is impossible. However, you can define
+models that respond to similar goals as random effects models, although
+they strictly speaking use only fixed effects.
+
+Constrained ordination functions @code{cca}, @code{rda} and
+ at code{capscale} can have @code{Condition()} terms in their formula. The
+ at code{Condition()} define partial terms that are fitted before other
+constraints and can be used to remove the effects of background
+variables, and their contribution to decomposing inertia (variance) is
+reported separately. These partial terms are often regarded as similar
+to random effects, but they are still fitted in the same way as other
+terms and strictly speaking they are fixed terms.
+
+Function @code{adonis} evaluates terms sequentially. In a model with
+right-hand-side @code{~ A + B} the effects of @code{A} are evaluated
+first, and the effects of @code{B} after removing the effects of
+ at code{A}. Sequential tests are also available in @code{anova} function
+for constrained ordination results by setting argument @code{by = "term"}.
+In this way, the first terms can serve in a similar role as
+random effects, although they are fitted in the same way as all other
+terms, and strictly speaking they are fixed terms.
+
+The permutation tests can usually have a @code{strata} argument which
+restricts the permutations within levels of a factor given in the
+argument. This can be used to restrict the permutations within levels of
+factor regarded as a random term. More structured permutations are
+available with the @pkg{permute} package.
+
+A major reason why real random effects models are impossible in most
+ at pkg{vegan} functions is that their tests are based on the permutation
+of the data. The data are given, that is fixed, and therefore
+permutation tests are basically tests of fixed terms on fixed data.
+Random effect terms would require permutations of data with a random
+component instead of the given, fixed data, and such tests are not
+available in @pkg{vegan}.
+
+ at node Is it possible to have passive points in ordination?, Class variables and dummies, Can I have random effects in constrained ordination or in @code{adonis}?, Ordination
@section Is it possible to have passive points in ordination?
@pkg{Vegan} does not have a concept of passive points, or a point that should
From noreply at r-forge.r-project.org Tue Feb 5 09:54:13 2013
From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org)
Date: Tue, 5 Feb 2013 09:54:13 +0100 (CET)
Subject: [Vegan-commits] r2409 - www
Message-ID: <20130205085413.31E3118083B@r-forge.r-project.org>
Author: jarioksa
Date: 2013-02-05 09:54:12 +0100 (Tue, 05 Feb 2013)
New Revision: 2409
Modified:
www/FAQ-vegan.html
Log:
update HTML version of the FAQ
Modified: www/FAQ-vegan.html
===================================================================
--- www/FAQ-vegan.html 2013-02-05 08:53:23 UTC (rev 2408)
+++ www/FAQ-vegan.html 2013-02-05 08:54:12 UTC (rev 2409)
@@ -1,41 +1,40 @@
-
-
-
+
[Top] | +|||
[Top] | [Contents] | [Index] | [ ? ] |
This document contains answers to some of the most frequently asked questions about R package vegan. -This is version of $Date: 2013-01-07 12:58:43 +0200 (Mon, 07 Jan 2013) $. - -
-This work is licensed under the Creative Commons Attribution 3.0 +This is version of $Date: 2013-01-22 19:55:06 +0200 (Tue, 22 Jan 2013) $. +
+-This work is licensed under the Creative Commons Attribution 3.0 License. To view a copy of this license, visit http://creativecommons.org/licenses/by/3.0/ or send a letter to Creative Commons, 543 Howard Street, 5th Floor, San Francisco, California, 94105, USA. - -
Copyright © 2008-2012 Jari Oksanen +
+Copyright © 2008-2013 Jari Oksanen
-
1. Introduction + - 1. Introduction 2. Ordination + - 2. Ordination 3. Other analysis methods + 3. Other analysis methods
- - +-
-[ < ] -[ > ] +[ < ] +[ > ] - [ << ] -[ Up ] -[ >> ] +[ << ] +[ Up ] +[ >> ] - [Top] +[Top] [Contents] [Index] [ ? ] 1. Introduction
+ +1. Introduction
- - +-
-[ < ] -[ > ] +[ < ] +[ > ] - [ << ] -[ Up ] -[ >> ] +[ << ] +[ Up ] +[ >> ] - [Top] +[Top] [Contents] [Index] [ ? ] 1.1 What is vegan?
+ +1.1 What is vegan?
Vegan is an R package for community ecologists. It contains the most popular methods of multivariate analysis needed in analysing ecological @@ -171,96 +170,96 @@ R statistical environment, and it also depends on many other R packages. Vegan is free software and distributed under GPL2 license. - -
- - + +
+-
-[ < ] -[ > ] +[ < ] +[ > ] - [ << ] -[ Up ] -[ >> ] +[ << ] +[ Up ] +[ >> ] - [Top] +[Top] [Contents] [Index] [ ? ] 1.2 What is R?
+ +1.2 What is R?
R is a system for statistical computation and graphics. It consists of a language plus a run-time environment with graphics, a debugger, access to certain system functions, and the ability to run programs stored in script files. - -
R has a home page at http://www.R-project.org/. It is +
+R has a home page at http://www.R-project.org/. It is free software -distributed under a GNU-style +distributed under a GNU-style copyleft, and an -official part of the GNU project -("GNU S"). - -
- - +official part of the GNU project +(“GNU S”). + +
+-
-[ < ] -[ > ] +[ < ] +[ > ] - [ << ] -[ Up ] -[ >> ] +[ << ] +[ Up ] +[ >> ] - [Top] +[Top] [Contents] [Index] [ ? ] 1.3 How to obtain vegan and R?
+ +1.3 How to obtain vegan and R?
Both R and latest release version of vegan can be obtained through CRAN. Unstable development version of vegan can be obtained through R-Forge. -
+
- - +-
-[ < ] -[ > ] +[ < ] +[ > ] - [ << ] -[ Up ] -[ >> ] +[ << ] +[ Up ] +[ >> ] - [Top] +[Top] [Contents] [Index] [ ? ] 1.4 What R packages vegan depends on?
+ +1.4 What R packages vegan depends on?
Vegan depends on the permute package which will provide advanced and flexible permutation routines for vegan (but currently only a small part of functions use permute). The permute package is developed together with vegan in R-Forge. - -
Some individual vegan functions depend on packages MASS, +
+Some individual vegan functions depend on packages MASS, mgcv, cluster, lattice and tcltk. These all are base or recommended R packages that should be available in every R installation. In addition, some vegan functions
require
@@ -268,62 +267,62 @@ suggested ones, and you can install vegan and use most of its functions without these packages. The non-standard packages needed by some vegan functions are: --
Package scatterplot3d +
+
+- Package scatterplot3d is needed by
ordiplot3d
-Package rgl +
- Package rgl is needed by
ordirgl
andrgl.isomap
-
- - +-
-[ < ] -[ > ] +[ < ] +[ > ] - [ << ] -[ Up ] -[ >> ] +[ << ] +[ Up ] +[ >> ] - [Top] +[Top] [Contents] [Index] [ ? ] 1.5 What other packages are available for ecologists?
+ +1.5 What other packages are available for ecologists?
-CRAN Task Views include entries like
Environmetrics
,Multivariate
+CRAN Task Views include entries like
Environmetrics
,Multivariate
andSpatial
that describe several useful packages and functions. If you install R package ctv, you can inspect Task Views from your R session, and automatically install sets of most important packages. - -
- - + +
+-
-[ < ] -[ > ] +[ < ] +[ > ] - [ << ] -[ Up ] -[ >> ] +[ << ] +[ Up ] +[ >> ] - [Top] +[Top] [Contents] [Index] [ ? ] 1.6 What other documentation is available for vegan?
+ +1.6 What other documentation is available for vegan?
Vegan is a fully documented R package with standard help pages. These are the most authoritative sources of documentation (and as a last @@ -331,56 +330,56 @@ source). Vegan package ships with other documents which can be read with
vegandocs
command (documented in the vegan help). The documents included in the vegan package are -+
+
- -
Vegan
NEWS
-- -
Vegan
ChangeLog
. -- -
This document (
FAQ-vegan.pdf
). -- -
Short introduction to basic ordination methods in vegan +Vegan
NEWS
+- +Vegan
ChangeLog
. +- +This document (
FAQ-vegan.pdf
). +- +Short introduction to basic ordination methods in vegan (
intro-vegan.pdf
). -- -
Introduction to diversity methods in vegan (
diversity-vegan.pdf
). -- -
Discussion on design decisions in vegan (
decision-vegan.pdf
). -- -
Description of variance partition procedures in function +
- +Introduction to diversity methods in vegan (
diversity-vegan.pdf
). +- +Discussion on design decisions in vegan (
decision-vegan.pdf
). +- +Description of variance partition procedures in function
varpart
(partitioning.pdf
). -
Web documents outside the package include: -
http://vegan.r-forge.r-project.org/: vegan homepage. -
http://cc.oulu.fi/~jarioksa/opetus/metodi/vegantutor.pdf: vegan +http://vegan.r-forge.r-project.org/: vegan homepage. +
[ < ] | -[ > ] | +|||||||||
[ < ] | +[ > ] | - | [ << ] | -[ Up ] | -[ >> ] | +[ << ] | +[ Up ] | +[ >> ] | [TRUNCATED] To get the complete diff run: svnlook diff /svnroot/vegan -r 2409 From noreply at r-forge.r-project.org Tue Feb 5 09:57:36 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Tue, 5 Feb 2013 09:57:36 +0100 (CET) Subject: [Vegan-commits] r2410 - pkg/vegan/inst Message-ID: <20130205085736.888E218083B@r-forge.r-project.org> Author: jarioksa Date: 2013-02-05 09:57:36 +0100 (Tue, 05 Feb 2013) New Revision: 2410 Modified: pkg/vegan/inst/ChangeLog Log: add ChangeLog entry on random effect FAQ Modified: pkg/vegan/inst/ChangeLog =================================================================== --- pkg/vegan/inst/ChangeLog 2013-02-05 08:54:12 UTC (rev 2409) +++ pkg/vegan/inst/ChangeLog 2013-02-05 08:57:36 UTC (rev 2410) @@ -4,6 +4,10 @@ Version 2.1-25 (opened February 2, 2013) + * FAQ: new entry on impossibility of using random effects in cca, + rda, capscale & adonis, and telling how to do this + approximately. Please comment and correct. + * oecosimu: changed the structure of the oecosimu() result object. It now returns a list of two items: "statistic" is the observed statistic, and "oecosimu" which contains the simulation From noreply at r-forge.r-project.org Tue Feb 5 11:58:58 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Tue, 5 Feb 2013 11:58:58 +0100 (CET) Subject: [Vegan-commits] r2411 - pkg/vegan/man Message-ID: <20130205105858.E3699184649@r-forge.r-project.org> Author: jarioksa Date: 2013-02-05 11:58:58 +0100 (Tue, 05 Feb 2013) New Revision: 2411 Modified: pkg/vegan/man/cca.Rd Log: Warning: vegan/man/cca.Rd:70: unknown macro '\pgk' Modified: pkg/vegan/man/cca.Rd =================================================================== --- pkg/vegan/man/cca.Rd 2013-02-05 08:57:36 UTC (rev 2410) +++ pkg/vegan/man/cca.Rd 2013-02-05 10:58:58 UTC (rev 2411) @@ -67,7 +67,7 @@ decomposition (\code{\link{svd}}). Function \code{rda} is similar, but uses ordinary, unweighted linear regression and unweighted SVD. Legendre & Legendre (2012), Table 11.5 (p. 650) give a skeleton of the RDA - algorithm of \pgk{vegan}. The algorithm of CCA is similar, but + algorithm of \pkg{vegan}. The algorithm of CCA is similar, but involves standardization by row and column weights. The functions can be called either with matrix-like entries for community From noreply at r-forge.r-project.org Tue Feb 5 12:38:37 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Tue, 5 Feb 2013 12:38:37 +0100 (CET) Subject: [Vegan-commits] r2412 - in pkg/vegan: R inst man Message-ID: <20130205113837.CC8BE1847F4@r-forge.r-project.org> Author: jarioksa Date: 2013-02-05 12:38:37 +0100 (Tue, 05 Feb 2013) New Revision: 2412 Modified: pkg/vegan/R/predict.cca.R pkg/vegan/R/predict.rda.R pkg/vegan/R/simulate.rda.R pkg/vegan/inst/ChangeLog pkg/vegan/man/predict.cca.Rd Log: predict.cca(..., type='work') & predict.rda(..., type='resp') handle partial models Modified: pkg/vegan/R/predict.cca.R =================================================================== --- pkg/vegan/R/predict.cca.R 2013-02-05 10:58:58 UTC (rev 2411) +++ pkg/vegan/R/predict.cca.R 2013-02-05 11:38:37 UTC (rev 2412) @@ -31,13 +31,16 @@ } if (take > 0) Xbar <- u %*% slam %*% t(v) - if (!is.null(object$pCCA)) - warning("Conditional ('partial') component ignored") rc <- outer(rs, cs) - if (type == "response") + if (type == "response") { + if (!is.null(object$pCCA)) + warning("Conditional ('partial') component ignored") out <- (Xbar + 1) * rc * gtot - else # type == "working" + } else { # type == "working" out <- Xbar * sqrt(rc) + if (!is.null(object$pCCA)) + out <- out + object$pCCA$Fit + } } else if (type == "lc") { if (model == "CA") Modified: pkg/vegan/R/predict.rda.R =================================================================== --- pkg/vegan/R/predict.rda.R 2013-02-05 10:58:58 UTC (rev 2411) +++ pkg/vegan/R/predict.rda.R 2013-02-05 11:38:37 UTC (rev 2412) @@ -25,8 +25,6 @@ w <- u slam <- diag(sqrt(object[[model]]$eig[1:take] * nr), nrow = take) if (type %in% c("response", "working")) { - if (!is.null(object$pCCA)) - warning("Conditional ('partial') component ignored") if (!missing(newdata)) { u <- predict(object, type = if(model == "CCA") "lc" else "wa", newdata = newdata, rank = take) @@ -52,7 +50,11 @@ if (!is.null(scal)) out <- sweep(out, 2, scal, "*") out <- sweep(out, 2, cent, "+") + if (!is.null(object$pCCA)) + out <- out + object$pCCA$Fit } else { + if (!is.null(object$pCCA)) + warning("Conditional ('partial') component ignored") out <- out/sqrt(nrow(out) - 1) } } Modified: pkg/vegan/R/simulate.rda.R =================================================================== --- pkg/vegan/R/simulate.rda.R 2013-02-05 10:58:58 UTC (rev 2411) +++ pkg/vegan/R/simulate.rda.R 2013-02-05 11:38:37 UTC (rev 2412) @@ -30,9 +30,6 @@ ## an array of response matrices ftd <- predict(object, type = "response", rank = rank) - ## pRDA: add partial Fit to the constrained - if (!is.null(object$pCCA)) - ftd <- ftd + object$pCCA$Fit ## Generate an array ans <- array(0, c(dim(ftd), nsim)) for (i in seq_len(nsim)) { @@ -102,9 +99,6 @@ sq.r <- sqrt(object$rowsum) ## Fitted value ftd <- predict(object, type = "working", rank = rank) - ## pCCA: add partial Fit to the constrained - if (!is.null(object$pCCA)) - ftd <- ftd + object$pCCA$Fit ## Residual Xbar need weighting and back-weighting Xbar <- sweep(object$CA$Xbar, 1, sq.r, "*") ## Simulation Modified: pkg/vegan/inst/ChangeLog =================================================================== --- pkg/vegan/inst/ChangeLog 2013-02-05 10:58:58 UTC (rev 2411) +++ pkg/vegan/inst/ChangeLog 2013-02-05 11:38:37 UTC (rev 2412) @@ -8,6 +8,12 @@ rda, capscale & adonis, and telling how to do this approximately. Please comment and correct. + * predict.rda, predict.cca: The partial term is handled in + predict.rda(..., type = "response") and in predict.cca(..., type = + "working"). The partial term was earlier handled only in + corresponding simulate.rda(), simulate.cca() functions, but it was + now moved to these more basic functions. + * oecosimu: changed the structure of the oecosimu() result object. It now returns a list of two items: "statistic" is the observed statistic, and "oecosimu" which contains the simulation Modified: pkg/vegan/man/predict.cca.Rd =================================================================== --- pkg/vegan/man/predict.cca.Rd 2013-02-05 10:58:58 UTC (rev 2411) +++ pkg/vegan/man/predict.cca.Rd 2013-02-05 11:38:37 UTC (rev 2412) @@ -136,13 +136,14 @@ \code{\link{rda}} and \code{\link{capscale}}. This is often known as calibration, bioindication or environmental reconstruction. Basically, the method is similar to projecting site scores onto biplot - arrows, but it uses regression coefficients. The function can be called - with \code{newdata} so that cross-validation is possible. The + arrows, but it uses regression coefficients. The function can be + called with \code{newdata} so that cross-validation is possible. The \code{newdata} may contain new sites, but species must match in the - original and new data The function - does not work with \sQuote{partial} models with \code{Condition} term, - and it cannot be used with \code{newdata} for \code{\link{capscale}} - results. The results may only be interpretable for continuous variables. + original and new data. The function may not work with + \sQuote{partial} models with \code{Condition} term, or the partial + term may be ignored with a warning. The function cannot be used with + \code{newdata} for \code{\link{capscale}} results. The results may + only be interpretable for continuous variables. Function \code{coef} will give the regression coefficients from centred environmental variables (constraints and conditions) to linear From noreply at r-forge.r-project.org Tue Feb 5 16:20:39 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Tue, 5 Feb 2013 16:20:39 +0100 (CET) Subject: [Vegan-commits] r2413 - in pkg/vegan: R inst Message-ID: <20130205152039.35B87184BAE@r-forge.r-project.org> Author: jarioksa Date: 2013-02-05 16:20:38 +0100 (Tue, 05 Feb 2013) New Revision: 2413 Modified: pkg/vegan/R/predict.cca.R pkg/vegan/R/predict.rda.R pkg/vegan/inst/ChangeLog Log: pCCA component handled both in type='resp' and type='work' in cca() and rda() results Modified: pkg/vegan/R/predict.cca.R =================================================================== --- pkg/vegan/R/predict.cca.R 2013-02-05 11:38:37 UTC (rev 2412) +++ pkg/vegan/R/predict.cca.R 2013-02-05 15:20:38 UTC (rev 2413) @@ -34,7 +34,7 @@ rc <- outer(rs, cs) if (type == "response") { if (!is.null(object$pCCA)) - warning("Conditional ('partial') component ignored") + Xbar <- Xbar + object$pCCA$Fit / sqrt(rc) out <- (Xbar + 1) * rc * gtot } else { # type == "working" out <- Xbar * sqrt(rc) Modified: pkg/vegan/R/predict.rda.R =================================================================== --- pkg/vegan/R/predict.rda.R 2013-02-05 11:38:37 UTC (rev 2412) +++ pkg/vegan/R/predict.rda.R 2013-02-05 15:20:38 UTC (rev 2413) @@ -30,6 +30,8 @@ newdata = newdata, rank = take) } if (inherits(object, "capscale")) { + if (!is.null(object$pCCA)) + warning("Conditional ('partial') component ignored") if (take > 0) { out <- u %*% slam/sqrt(nr) if (type == "response") { @@ -54,7 +56,7 @@ out <- out + object$pCCA$Fit } else { if (!is.null(object$pCCA)) - warning("Conditional ('partial') component ignored") + out <- out + object$pCCA$Fit out <- out/sqrt(nrow(out) - 1) } } Modified: pkg/vegan/inst/ChangeLog =================================================================== --- pkg/vegan/inst/ChangeLog 2013-02-05 11:38:37 UTC (rev 2412) +++ pkg/vegan/inst/ChangeLog 2013-02-05 15:20:38 UTC (rev 2413) @@ -9,10 +9,11 @@ approximately. Please comment and correct. * predict.rda, predict.cca: The partial term is handled in - predict.rda(..., type = "response") and in predict.cca(..., type = - "working"). The partial term was earlier handled only in - corresponding simulate.rda(), simulate.cca() functions, but it was - now moved to these more basic functions. + predict(..., type = "response") and in predict(..., type = + "working") for cca() and rda() result objects. The partial term + was earlier handled only in corresponding simulate.rda(), + simulate.cca() functions, but it was now moved to these more basic + functions. The partial capscale() results are still unhandled. * oecosimu: changed the structure of the oecosimu() result object. It now returns a list of two items: "statistic" is the From noreply at r-forge.r-project.org Tue Feb 5 18:31:22 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Tue, 5 Feb 2013 18:31:22 +0100 (CET) Subject: [Vegan-commits] r2414 - pkg/vegan/R Message-ID: <20130205173122.78D441812ED@r-forge.r-project.org> Author: jarioksa Date: 2013-02-05 18:31:21 +0100 (Tue, 05 Feb 2013) New Revision: 2414 Modified: pkg/vegan/R/predict.rda.R Log: predict.capscale uses data adjustment returned instead of wrongly assuming the sqrt(nrows) Modified: pkg/vegan/R/predict.rda.R =================================================================== --- pkg/vegan/R/predict.rda.R 2013-02-05 15:20:38 UTC (rev 2413) +++ pkg/vegan/R/predict.rda.R 2013-02-05 17:31:21 UTC (rev 2414) @@ -33,7 +33,7 @@ if (!is.null(object$pCCA)) warning("Conditional ('partial') component ignored") if (take > 0) { - out <- u %*% slam/sqrt(nr) + out <- u %*% slam/object$adjust if (type == "response") { out <- dist(out) if (!is.null(object$ac)) From noreply at r-forge.r-project.org Wed Feb 6 09:18:48 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Wed, 6 Feb 2013 09:18:48 +0100 (CET) Subject: [Vegan-commits] r2415 - pkg/vegan/tests Message-ID: <20130206081848.920691813E7@r-forge.r-project.org> Author: jarioksa Date: 2013-02-06 09:18:48 +0100 (Wed, 06 Feb 2013) New Revision: 2415 Modified: pkg/vegan/tests/vegan-tests.R pkg/vegan/tests/vegan-tests.Rout.save Log: add tests for simulate.rda,cca,capscale these depend on and use predict functions and serve as a test for their integrity as well. Modified: pkg/vegan/tests/vegan-tests.R =================================================================== --- pkg/vegan/tests/vegan-tests.R 2013-02-05 17:31:21 UTC (rev 2414) +++ pkg/vegan/tests/vegan-tests.R 2013-02-06 08:18:48 UTC (rev 2415) @@ -164,3 +164,30 @@ pro$t rm(x, xp, pro) ### end protest + +### Check that functions related to predict.rda work correctly for all +### constrained ordination methods. + +### simulate.rda/cca/capscale: based on predict.* and the following +### should get back the data +data(dune, dune.env) +ind <- seq_len(nrow(dune)) +target <- as.matrix(dune) +## rda +mod <- rda(dune ~ Condition(Moisture) + Management + A1, dune.env) +dat <- simulate(mod, indx = ind) +all.equal(dat, target, check.attributes = FALSE) +## cca +mod <- cca(dune ~ Condition(Moisture) + Management + A1, dune.env) +dat <- simulate(mod, indx = ind) +all.equal(dat, target, check.attributes = FALSE) +## capscale: Euclidean distances -- non-Euclidean distances have an +## imaginary component and will not give back the data. +d <- dist(dune) +mod <- capscale(d ~ Condition(Moisture) + Management + A1, dune.env) +dat <- simulate(mod, indx = ind) +all.equal(dat, d, check.attributes = FALSE) +## clean up +rm(ind, target, mod, dat, d) +### end simulate.* + Modified: pkg/vegan/tests/vegan-tests.Rout.save =================================================================== --- pkg/vegan/tests/vegan-tests.Rout.save 2013-02-05 17:31:21 UTC (rev 2414) +++ pkg/vegan/tests/vegan-tests.Rout.save 2013-02-06 08:18:48 UTC (rev 2415) @@ -1,5 +1,5 @@ -R Under development (unstable) (2013-01-24 r61741) -- "Unsuffered Consequences" +R Under development (unstable) (2013-02-05 r61841) -- "Unsuffered Consequences" Copyright (C) 2013 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: x86_64-unknown-linux-gnu (64-bit) @@ -547,6 +547,36 @@ > rm(x, xp, pro) > ### end protest > +> ### Check that functions related to predict.rda work correctly for all +> ### constrained ordination methods. +> +> ### simulate.rda/cca/capscale: based on predict.* and the following +> ### should get back the data +> data(dune, dune.env) +> ind <- seq_len(nrow(dune)) +> target <- as.matrix(dune) +> ## rda +> mod <- rda(dune ~ Condition(Moisture) + Management + A1, dune.env) +> dat <- simulate(mod, indx = ind) +> all.equal(dat, target, check.attributes = FALSE) +[1] TRUE +> ## cca +> mod <- cca(dune ~ Condition(Moisture) + Management + A1, dune.env) +> dat <- simulate(mod, indx = ind) +> all.equal(dat, target, check.attributes = FALSE) +[1] TRUE +> ## capscale: Euclidean distances -- non-Euclidean distances have an +> ## imaginary component and will not give back the data. +> d <- dist(dune) +> mod <- capscale(d ~ Condition(Moisture) + Management + A1, dune.env) +> dat <- simulate(mod, indx = ind) +> all.equal(dat, d, check.attributes = FALSE) +[1] TRUE +> ## clean up +> rm(ind, target, mod, dat, d) +> ### end simulate.* +> +> > proc.time() user system elapsed - 2.892 0.036 2.933 + 2.912 0.028 2.947 From noreply at r-forge.r-project.org Wed Feb 6 17:32:12 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Wed, 6 Feb 2013 17:32:12 +0100 (CET) Subject: [Vegan-commits] r2416 - in pkg/vegan: R inst man Message-ID: <20130206163212.E8539183B50@r-forge.r-project.org> Author: jarioksa Date: 2013-02-06 17:32:12 +0100 (Wed, 06 Feb 2013) New Revision: 2416 Modified: pkg/vegan/R/predict.cca.R pkg/vegan/R/predict.rda.R pkg/vegan/R/simulate.rda.R pkg/vegan/inst/ChangeLog pkg/vegan/man/predict.cca.Rd Log: revert r2412-3: there should be no pCCA component in predict type='response' or 'working' Modified: pkg/vegan/R/predict.cca.R =================================================================== --- pkg/vegan/R/predict.cca.R 2013-02-06 08:18:48 UTC (rev 2415) +++ pkg/vegan/R/predict.cca.R 2013-02-06 16:32:12 UTC (rev 2416) @@ -31,16 +31,13 @@ } if (take > 0) Xbar <- u %*% slam %*% t(v) + if (!is.null(object$pCCA)) + warning("Conditional ('partial') component ignored") rc <- outer(rs, cs) - if (type == "response") { - if (!is.null(object$pCCA)) - Xbar <- Xbar + object$pCCA$Fit / sqrt(rc) + if (type == "response") out <- (Xbar + 1) * rc * gtot - } else { # type == "working" + else # type == "working" out <- Xbar * sqrt(rc) - if (!is.null(object$pCCA)) - out <- out + object$pCCA$Fit - } } else if (type == "lc") { if (model == "CA") Modified: pkg/vegan/R/predict.rda.R =================================================================== --- pkg/vegan/R/predict.rda.R 2013-02-06 08:18:48 UTC (rev 2415) +++ pkg/vegan/R/predict.rda.R 2013-02-06 16:32:12 UTC (rev 2416) @@ -25,13 +25,13 @@ w <- u slam <- diag(sqrt(object[[model]]$eig[1:take] * nr), nrow = take) if (type %in% c("response", "working")) { + if (!is.null(object$pCCA)) + warning("Conditional ('partial') component ignored") if (!missing(newdata)) { u <- predict(object, type = if(model == "CCA") "lc" else "wa", newdata = newdata, rank = take) } if (inherits(object, "capscale")) { - if (!is.null(object$pCCA)) - warning("Conditional ('partial') component ignored") if (take > 0) { out <- u %*% slam/object$adjust if (type == "response") { @@ -52,11 +52,7 @@ if (!is.null(scal)) out <- sweep(out, 2, scal, "*") out <- sweep(out, 2, cent, "+") - if (!is.null(object$pCCA)) - out <- out + object$pCCA$Fit } else { - if (!is.null(object$pCCA)) - out <- out + object$pCCA$Fit out <- out/sqrt(nrow(out) - 1) } } Modified: pkg/vegan/R/simulate.rda.R =================================================================== --- pkg/vegan/R/simulate.rda.R 2013-02-06 08:18:48 UTC (rev 2415) +++ pkg/vegan/R/simulate.rda.R 2013-02-06 16:32:12 UTC (rev 2416) @@ -30,6 +30,9 @@ ## an array of response matrices ftd <- predict(object, type = "response", rank = rank) + ## pRDA: add partial Fit to the constrained + if (!is.null(object$pCCA)) + ftd <- ftd + object$pCCA$Fit ## Generate an array ans <- array(0, c(dim(ftd), nsim)) for (i in seq_len(nsim)) { @@ -99,6 +102,9 @@ sq.r <- sqrt(object$rowsum) ## Fitted value ftd <- predict(object, type = "working", rank = rank) + ## pCCA: add partial Fit to the constrained + if (!is.null(object$pCCA)) + ftd <- ftd + object$pCCA$Fit ## Residual Xbar need weighting and back-weighting Xbar <- sweep(object$CA$Xbar, 1, sq.r, "*") ## Simulation Modified: pkg/vegan/inst/ChangeLog =================================================================== --- pkg/vegan/inst/ChangeLog 2013-02-06 08:18:48 UTC (rev 2415) +++ pkg/vegan/inst/ChangeLog 2013-02-06 16:32:12 UTC (rev 2416) @@ -8,13 +8,6 @@ rda, capscale & adonis, and telling how to do this approximately. Please comment and correct. - * predict.rda, predict.cca: The partial term is handled in - predict(..., type = "response") and in predict(..., type = - "working") for cca() and rda() result objects. The partial term - was earlier handled only in corresponding simulate.rda(), - simulate.cca() functions, but it was now moved to these more basic - functions. The partial capscale() results are still unhandled. - * oecosimu: changed the structure of the oecosimu() result object. It now returns a list of two items: "statistic" is the observed statistic, and "oecosimu" which contains the simulation Modified: pkg/vegan/man/predict.cca.Rd =================================================================== --- pkg/vegan/man/predict.cca.Rd 2013-02-06 08:18:48 UTC (rev 2415) +++ pkg/vegan/man/predict.cca.Rd 2013-02-06 16:32:12 UTC (rev 2416) @@ -136,14 +136,13 @@ \code{\link{rda}} and \code{\link{capscale}}. This is often known as calibration, bioindication or environmental reconstruction. Basically, the method is similar to projecting site scores onto biplot - arrows, but it uses regression coefficients. The function can be - called with \code{newdata} so that cross-validation is possible. The + arrows, but it uses regression coefficients. The function can be called + with \code{newdata} so that cross-validation is possible. The \code{newdata} may contain new sites, but species must match in the - original and new data. The function may not work with - \sQuote{partial} models with \code{Condition} term, or the partial - term may be ignored with a warning. The function cannot be used with - \code{newdata} for \code{\link{capscale}} results. The results may - only be interpretable for continuous variables. + original and new data The function + does not work with \sQuote{partial} models with \code{Condition} term, + and it cannot be used with \code{newdata} for \code{\link{capscale}} + results. The results may only be interpretable for continuous variables. Function \code{coef} will give the regression coefficients from centred environmental variables (constraints and conditions) to linear From noreply at r-forge.r-project.org Wed Feb 6 18:01:02 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Wed, 6 Feb 2013 18:01:02 +0100 (CET) Subject: [Vegan-commits] r2417 - in pkg/vegan: R inst man Message-ID: <20130206170103.11D8718455C@r-forge.r-project.org> Author: jarioksa Date: 2013-02-06 18:01:02 +0100 (Wed, 06 Feb 2013) New Revision: 2417 Modified: pkg/vegan/R/predict.cca.R pkg/vegan/R/predict.rda.R pkg/vegan/inst/ChangeLog pkg/vegan/man/predict.cca.Rd Log: do not warn about ignoring pCCA component, because that is the documented intention Modified: pkg/vegan/R/predict.cca.R =================================================================== --- pkg/vegan/R/predict.cca.R 2013-02-06 16:32:12 UTC (rev 2416) +++ pkg/vegan/R/predict.cca.R 2013-02-06 17:01:02 UTC (rev 2417) @@ -31,8 +31,6 @@ } if (take > 0) Xbar <- u %*% slam %*% t(v) - if (!is.null(object$pCCA)) - warning("Conditional ('partial') component ignored") rc <- outer(rs, cs) if (type == "response") out <- (Xbar + 1) * rc * gtot Modified: pkg/vegan/R/predict.rda.R =================================================================== --- pkg/vegan/R/predict.rda.R 2013-02-06 16:32:12 UTC (rev 2416) +++ pkg/vegan/R/predict.rda.R 2013-02-06 17:01:02 UTC (rev 2417) @@ -25,8 +25,6 @@ w <- u slam <- diag(sqrt(object[[model]]$eig[1:take] * nr), nrow = take) if (type %in% c("response", "working")) { - if (!is.null(object$pCCA)) - warning("Conditional ('partial') component ignored") if (!missing(newdata)) { u <- predict(object, type = if(model == "CCA") "lc" else "wa", newdata = newdata, rank = take) Modified: pkg/vegan/inst/ChangeLog =================================================================== --- pkg/vegan/inst/ChangeLog 2013-02-06 16:32:12 UTC (rev 2416) +++ pkg/vegan/inst/ChangeLog 2013-02-06 17:01:02 UTC (rev 2417) @@ -19,6 +19,15 @@ "statistic" as a separate item. So "statistic" is now one level deeper instead of being the main object. + * predict.cca, predict.rda: In rev2412, 2413 we studied including + partial (pCCA) component in predict(..., type="response") and + predict(..., type="working") models, but then adopted a policy of + never having partial component, but always returning only the + component requested for. Therefore warning messages of ignoring + pCCA component were removed. This log entry was made to emphasize + that there is a policy decision, and an alternative policy can be + tracked in the repository. + * simulate: the simulate functions for "rda" and "cca" return objects with original row and column names. Function capscale() already did so, and simulate.nullmodel() was changed so in vegan Modified: pkg/vegan/man/predict.cca.Rd =================================================================== --- pkg/vegan/man/predict.cca.Rd 2013-02-06 16:32:12 UTC (rev 2416) +++ pkg/vegan/man/predict.cca.Rd 2013-02-06 17:01:02 UTC (rev 2417) @@ -38,23 +38,21 @@ \item{object}{A result object from \code{\link{cca}}, \code{\link{rda}}, \code{\link{capscale}} or \code{\link{decorana}}. } \item{model}{Show constrained (\code{"CCA"}) or unconstrained - (\code{"CA"}) results. For \code{\link{capscale}} this can also be - \code{"Imaginary"} for imaginary components with negative - eigenvalues. } - + (\code{"CA"}) results. For \code{fitted} method of + \code{\link{capscale}} this can also be \code{"Imaginary"} for + imaginary components with negative eigenvalues. } \item{newdata}{New data frame to be used in prediction or in calibration. Usually this a new community data frame, but with - \code{type = "lc"} and for constrained component with - \code{type = "response"} and \code{type = "working"} it must be a - data frame. The \code{newdata} must have the same number of rows as - the original community data for a \code{\link{cca}} result with + \code{type = "lc"} and for constrained component with \code{type = + "response"} and \code{type = "working"} it must be a data frame of + constraints. The \code{newdata} must have the same number of rows + as the original community data for a \code{\link{cca}} result with \code{type = "response"} or \code{type = "working"}. If the original model had row or column names, then new data must contain rows or columns with the same names (row names for species scores, column names for \code{"wa"} scores and constraint names of \code{"lc"} scores). In other cases the rows or columns must match directly. } - \item{type}{The type of prediction, fitted values or residuals: \code{"response"} scales results so that the same ordination gives the same results, and \code{"working"} gives the values used @@ -71,28 +69,30 @@ \item{rank}{The rank or the number of axes used in the approximation. The default is to use all axes (full rank) of the \code{"model"} or all available four axes in \code{predict.decorana}.} - \item{scaling}{Scaling or predicted scores - with the same meaning as in \code{\link{cca}}, \code{\link{rda}} and - \code{\link{capscale}}.} + \item{scaling}{Scaling or predicted scores with the same meaning as + in \code{\link{cca}}, \code{\link{rda}} and + \code{\link{capscale}}.} \item{\dots}{Other parameters to the functions.} } \details{ + Function \code{fitted} gives the approximation of the original data - matrix or dissimilarities from the ordination result either in the - scale of the response - or as scaled internally by the function. Function \code{residuals} gives - the approximation of the original data from the unconstrained - ordination. With argument \code{type = "response"} the - \code{fitted.cca} and \code{residuals.cca} function + matrix or dissimilarities from the ordination result either in the + scale of the response or as scaled internally by the function. + Function \code{residuals} gives the approximation of the original + data from the unconstrained ordination. With argument \code{type = + "response"} the \code{fitted.cca} and \code{residuals.cca} function both give the same marginal totals as the original data matrix, and - their entries do not add up to the original data. - Functions \code{fitted.capscale} and \code{residuals.capscale} give the - dissimilarities with \code{type = "response"}, but these are not additive, - but the \code{"working"} scores are additive. - All variants of \code{fitted} and \code{residuals} are defined so - that for model \code{mod <- cca(y ~ x)}, \code{cca(fitted(mod))} is equal - to constrained ordination, and \code{cca(residuals(mod))} is equal to - unconstrained part of the ordination. + fitted and residuals do not add up to the original data. Functions + \code{fitted.capscale} and \code{residuals.capscale} give the + dissimilarities with \code{type = "response"}, but these are not + additive, but the \code{"working"} scores are additive. All + variants of \code{fitted} and \code{residuals} are defined so that + for model \code{mod <- cca(y ~ x)}, \code{cca(fitted(mod))} is equal + to constrained ordination, and \code{cca(residuals(mod))} is equal + to unconstrained part of the ordination. The \code{Condition()} + terms or the partial component is always ignored and will not be + included in \code{predict}ed or \code{fitted} response. Function \code{predict} can find the estimate of the original data matrix or dissimilarities (\code{type = "response"}) with any rank. @@ -105,8 +105,8 @@ explicit \code{scaling} to add those scores to ordination diagrams. With \code{type = "wa"} the function finds the site scores from species scores. In that case, the new data can contain new sites, - but species must match in the original and new data. With \code{type - = "sp"} the function finds species scores from site constraints + but species must match in the original and new data. With \code{type="sp"} + the function finds species scores from site constraints (linear combination scores). In that case the new data can contain new species, but sites must match in the original and new data. With \code{type = "lc"} the function finds the linear combination scores @@ -117,7 +117,7 @@ if constrained component is desired, and community data matrix if residual or unconstrained component is desired. With these types, the function uses \code{newdata} to find new \code{"lc"} (constrained) or - \code{"wa"} scores (unconstrained) and then finding the response or + \code{"wa"} scores (unconstrained) and then finds the response or working data from these new row scores and species scores. The original site (row) and species (column) weights are used for \code{type = "response"} and \code{type = "working"} in correspondence @@ -127,7 +127,7 @@ If a completely new data frame is created, extreme care is needed defining variables similarly as in the original model, in particular with (ordered) factors. If ordination was performed with the formula - interface, the \code{newdata} also can be a data frame or matrix, but + interface, the \code{newdata} can be a data frame or matrix, but extreme care is needed that the columns match in the original and \code{newdata}. From noreply at r-forge.r-project.org Wed Feb 6 18:32:03 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Wed, 6 Feb 2013 18:32:03 +0100 (CET) Subject: [Vegan-commits] r2418 - in pkg/vegan: R inst man Message-ID: <20130206173203.45ED2183B50@r-forge.r-project.org> Author: jarioksa Date: 2013-02-06 18:32:02 +0100 (Wed, 06 Feb 2013) New Revision: 2418 Modified: pkg/vegan/R/fitted.capscale.R pkg/vegan/R/fitted.cca.R pkg/vegan/R/fitted.rda.R pkg/vegan/inst/ChangeLog pkg/vegan/man/predict.cca.Rd Log: fitted.rda,cca,capscale can return the pCCA component Modified: pkg/vegan/R/fitted.capscale.R =================================================================== --- pkg/vegan/R/fitted.capscale.R 2013-02-06 17:01:02 UTC (rev 2417) +++ pkg/vegan/R/fitted.capscale.R 2013-02-06 17:32:02 UTC (rev 2418) @@ -1,5 +1,5 @@ -fitted.capscale <- - function(object, model = c("CCA", "CA", "Imaginary"), +`fitted.capscale` <- + function(object, model = c("CCA", "CA", "pCCA", "Imaginary"), type = c("response", "working"), ...) { model <- match.arg(model) @@ -8,7 +8,8 @@ U <- switch(model, CCA = object$CCA$u.eig, CA = object$CA$u.eig, - Imaginary = object$CA$imaginary.u.eig) + Imaginary = object$CA$imaginary.u.eig, + pCCA = object$pCCA$Fit/object$adjust) ## Distances or working scores U if (type == "response") { U <- dist(U) Modified: pkg/vegan/R/fitted.cca.R =================================================================== --- pkg/vegan/R/fitted.cca.R 2013-02-06 17:01:02 UTC (rev 2417) +++ pkg/vegan/R/fitted.cca.R 2013-02-06 17:32:02 UTC (rev 2418) @@ -1,11 +1,15 @@ -"fitted.cca" <- -function (object, model = c("CCA","CA"), type = c("response", "working"), ...) +`fitted.cca` <- + function (object, model = c("CCA","CA","pCCA"), type = c("response", "working"), + ...) { type <- match.arg(type) model <- match.arg(model) gtot <- object$grand.total rc <- object$rowsum %o% object$colsum - Xbar <- object[[model]]$Xbar + if (model == "pCCA") + Xbar <- object$pCCA$Fit + else + Xbar <- object[[model]]$Xbar if (model == "CCA") Xbar <- qr.fitted(object$CCA$QR, Xbar) if (type == "response") Modified: pkg/vegan/R/fitted.rda.R =================================================================== --- pkg/vegan/R/fitted.rda.R 2013-02-06 17:01:02 UTC (rev 2417) +++ pkg/vegan/R/fitted.rda.R 2013-02-06 17:32:02 UTC (rev 2418) @@ -1,9 +1,12 @@ -"fitted.rda" <- - function (object, model = c("CCA", "CA"), type = c("response", "working"), ...) +`fitted.rda` <- + function (object, model = c("CCA", "CA", "pCCA"), type = c("response", "working"), ...) { type <- match.arg(type) model <- match.arg(model) - Xbar <- object[[model]]$Xbar + if (model == "pCCA") + Xbar <- object$pCCA$Fit + else + Xbar <- object[[model]]$Xbar if (model == "CCA") Xbar <- qr.fitted(object$CCA$QR, Xbar) if (type == "response") { Modified: pkg/vegan/inst/ChangeLog =================================================================== --- pkg/vegan/inst/ChangeLog 2013-02-06 17:01:02 UTC (rev 2417) +++ pkg/vegan/inst/ChangeLog 2013-02-06 17:32:02 UTC (rev 2418) @@ -28,6 +28,9 @@ that there is a policy decision, and an alternative policy can be tracked in the repository. + * fitted.[cca,rda,capscale]: can now return partial component with + argument 'model = "pCCA"'. + * simulate: the simulate functions for "rda" and "cca" return objects with original row and column names. Function capscale() already did so, and simulate.nullmodel() was changed so in vegan Modified: pkg/vegan/man/predict.cca.Rd =================================================================== --- pkg/vegan/man/predict.cca.Rd 2013-02-06 17:01:02 UTC (rev 2417) +++ pkg/vegan/man/predict.cca.Rd 2013-02-06 17:32:02 UTC (rev 2418) @@ -21,9 +21,9 @@ response data. } \usage{ -\method{fitted}{cca}(object, model = c("CCA", "CA"), +\method{fitted}{cca}(object, model = c("CCA", "CA", "pCCA"), type = c("response", "working"), ...) -\method{fitted}{capscale}(object, model = c("CCA", "CA", "Imaginary"), +\method{fitted}{capscale}(object, model = c("CCA", "CA", "pCCA", "Imaginary"), type = c("response", "working"), ...) \method{residuals}{cca}(object, ...) \method{predict}{cca}(object, newdata, type = c("response", "wa", "sp", "lc", "working"), @@ -37,10 +37,11 @@ \arguments{ \item{object}{A result object from \code{\link{cca}}, \code{\link{rda}}, \code{\link{capscale}} or \code{\link{decorana}}. } - \item{model}{Show constrained (\code{"CCA"}) or unconstrained - (\code{"CA"}) results. For \code{fitted} method of - \code{\link{capscale}} this can also be \code{"Imaginary"} for - imaginary components with negative eigenvalues. } + \item{model}{Show constrained (\code{"CCA"}), unconstrained + (\code{"CA"}) or conditioned \dQuote{partial} (\code{"pCCA"}) + results. For \code{fitted} method of \code{\link{capscale}} this + can also be \code{"Imaginary"} for imaginary components with + negative eigenvalues. } \item{newdata}{New data frame to be used in prediction or in calibration. Usually this a new community data frame, but with \code{type = "lc"} and for constrained component with \code{type = From noreply at r-forge.r-project.org Thu Feb 7 17:20:38 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Thu, 7 Feb 2013 17:20:38 +0100 (CET) Subject: [Vegan-commits] r2419 - pkg/vegan/man Message-ID: <20130207162038.B0BCD184C2F@r-forge.r-project.org> Author: jarioksa Date: 2013-02-07 17:20:38 +0100 (Thu, 07 Feb 2013) New Revision: 2419 Modified: pkg/vegan/man/predict.cca.Rd Log: tweak docs Modified: pkg/vegan/man/predict.cca.Rd =================================================================== --- pkg/vegan/man/predict.cca.Rd 2013-02-06 17:32:02 UTC (rev 2418) +++ pkg/vegan/man/predict.cca.Rd 2013-02-07 16:20:38 UTC (rev 2419) @@ -91,9 +91,7 @@ variants of \code{fitted} and \code{residuals} are defined so that for model \code{mod <- cca(y ~ x)}, \code{cca(fitted(mod))} is equal to constrained ordination, and \code{cca(residuals(mod))} is equal - to unconstrained part of the ordination. The \code{Condition()} - terms or the partial component is always ignored and will not be - included in \code{predict}ed or \code{fitted} response. + to unconstrained part of the ordination. Function \code{predict} can find the estimate of the original data matrix or dissimilarities (\code{type = "response"}) with any rank. @@ -140,7 +138,7 @@ arrows, but it uses regression coefficients. The function can be called with \code{newdata} so that cross-validation is possible. The \code{newdata} may contain new sites, but species must match in the - original and new data The function + original and new data. The function does not work with \sQuote{partial} models with \code{Condition} term, and it cannot be used with \code{newdata} for \code{\link{capscale}} results. The results may only be interpretable for continuous variables. From noreply at r-forge.r-project.org Thu Feb 7 18:39:55 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Thu, 7 Feb 2013 18:39:55 +0100 (CET) Subject: [Vegan-commits] r2420 - pkg/vegan/man Message-ID: <20130207173955.43470181132@r-forge.r-project.org> Author: jarioksa Date: 2013-02-07 18:39:54 +0100 (Thu, 07 Feb 2013) New Revision: 2420 Modified: pkg/vegan/man/capscale.Rd pkg/vegan/man/cca.Rd pkg/vegan/man/cca.object.Rd Log: add cross references to cca methods so that people do not request features that already are there Modified: pkg/vegan/man/capscale.Rd =================================================================== --- pkg/vegan/man/capscale.Rd 2013-02-07 16:20:38 UTC (rev 2419) +++ pkg/vegan/man/capscale.Rd 2013-02-07 17:39:54 UTC (rev 2420) @@ -213,7 +213,14 @@ \seealso{\code{\link{rda}}, \code{\link{cca}}, \code{\link{plot.cca}}, \code{\link{anova.cca}}, \code{\link{vegdist}}, - \code{\link{dist}}, \code{\link{cmdscale}}.} + \code{\link{dist}}, \code{\link{cmdscale}}. + + The function returns similar result object as \code{\link{rda}} (see + \code{\link{cca.object}}). This section for \code{\link{rda}} gives a + more complete list of functions that can be used to access and + analyse \code{capscale} results. + +} \examples{ data(varespec) data(varechem) Modified: pkg/vegan/man/cca.Rd =================================================================== --- pkg/vegan/man/cca.Rd 2013-02-07 16:20:38 UTC (rev 2419) +++ pkg/vegan/man/cca.Rd 2013-02-07 17:39:54 UTC (rev 2420) @@ -194,25 +194,61 @@ } \seealso{ - There is a special documentation for \code{\link{plot.cca}} and - \code{\link{summary.cca}} functions - with their helper functions (\code{\link{text.cca}}, - \code{\link{points.cca}}, \code{\link{scores.cca}}). - Function \code{\link{anova.cca}} provides an ANOVA like permutation - test for the ``significance'' of constraints. Automatic model building - (dangerous!) is discussed in \code{\link{deviance.cca}}. Diagnostic - tools, prediction and adding new points in ordination are discussed in - \code{\link{goodness.cca}} and \code{\link{predict.cca}}. - Function \code{\link[ade4]{cca}} (library \pkg{ade4}) provide alternative - implementations of CCA (these are internally quite - different). Function \code{\link{capscale}} is a non-Euclidean generalization of - \code{rda}. The result object is described in - \code{\link{cca.object}}. - You can use \code{\link{as.mlm}} to refit ordination result as a - multiple response linear model to find some descriptive statistics. - Design decisions are explained in - \code{\link{vignette}} \file{decision-vegan} which also can be accessed - with \code{\link{vegandocs}}. + + This help page describes two constrained ordination functions, + \code{cca} and \code{rda}. A related method, distance-based + redundancy analysis (dbRDA) is described separately + (\code{\link{capscale}}). All these function return similar objects + (described in \code{\link{cca.object}}). There are numerous support + functions that can used to access the result object. In the list + below, functions of type \code{cca} will handle all ordination + objects, and functions of \code{rda} only handle \code{rda} and + \code{\link{capscale}} results. + + The main plotting functions are \code{\link{plot.cca}} for all + methods, and \code{\link{biplot.rda}} for RDA and dbRDA. However, + generic \pkg{vegan} plotting functions can also handle the results. + The scores can be accessed and scaled with \code{\link{scores.cca}}, + and summarized with \code{\link{summary.cca}}. The eigenvalues can + be accessed with \code{\link{eigenvals.cca}} and the regression + coefficients for constraints with \code{\link{coef.cca}}. The + eigenvalues can be plotted with \code{\link{screeplot.cca}}, and the + (adjusted) \eqn{R^2}{R-squared} can be found with + \code{\link{RsquareAdj.rda}}. The scores can be also calculated for + new data sets with \code{\link{predict.cca}} which allows adding + points to ordinations. The values of constraints can be inferred + from ordination and community composition with + \code{\link{calibrate.cca}}. + + Diagnostic statistics can be found with \code{\link{goodness.cca}}, + \code{\link{inertcomp}}, \code{\link{spenvcor}}, + \code{\link{intersetcor}} and \code{\link{vif.cca}}. Function + \code{\link{as.mlm.cca}} refits the result object as a multiple + \code{\link{lm}} object, and this allows finding influence + statistics (\code{\link{lm.influence}}, \code{\link{cooks.distance}} + etc.). + + Permutation based signficance for the overall model, single + constraining variables or axes can be found with + \code{\link{anova.cca}}. Automatic model building with \R{} + \code{\link{step}} function is possible with + \code{\link{deviance.cca}}, \code{\link{add1.cca}} and + \code{\link{drop1.cca}}. Functions \code{\link{ordistep}} and + \code{\link{ordiR2step}} (for RDA) are special functions for + constrained ordination. Randomized data sets can be generated with + \code{\link{simulate.cca}}. + + Separate methods based on constrained ordination model are principal + response curves (\code{\link{prc}}) and variance partioning between + several components (\code{\link{varpart}}). + + Design decisions are explained in \code{\link{vignette}} + \file{decision-vegan} which also can be accessed with + \code{\link{vegandocs}}. + + Package \pkg{ade4} provides alternative constrained ordination + functions \code{\link[ade4]{cca}} and \code{\link[ade4]{pcaiv}}. + } \examples{ Modified: pkg/vegan/man/cca.object.Rd =================================================================== --- pkg/vegan/man/cca.object.Rd 2013-02-07 16:20:38 UTC (rev 2419) +++ pkg/vegan/man/cca.object.Rd 2013-02-07 17:39:54 UTC (rev 2420) @@ -190,6 +190,10 @@ linear model (\code{\link{lm}}) in order to more easily find some statistics (which in principle could be directly found from the \code{cca.object} as well). + + This section in \code{\link{cca}} gives a more complete list of + methods to handle the constrained ordination result object. + } \references{ Legendre, P. and Legendre, L. (2012) \emph{Numerical Ecology}. 3rd English From noreply at r-forge.r-project.org Thu Feb 7 18:55:39 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Thu, 7 Feb 2013 18:55:39 +0100 (CET) Subject: [Vegan-commits] r2421 - in branches/2.0: R inst inst/doc man Message-ID: <20130207175539.67A9E1847B7@r-forge.r-project.org> Author: jarioksa Date: 2013-02-07 18:55:39 +0100 (Thu, 07 Feb 2013) New Revision: 2421 Modified: branches/2.0/R/fitted.capscale.R branches/2.0/R/fitted.cca.R branches/2.0/R/fitted.rda.R branches/2.0/R/predict.cca.R branches/2.0/R/predict.rda.R branches/2.0/inst/ChangeLog branches/2.0/inst/doc/FAQ-vegan.texi branches/2.0/man/capscale.Rd branches/2.0/man/cca.Rd branches/2.0/man/cca.object.Rd branches/2.0/man/predict.cca.Rd branches/2.0/man/procrustes.Rd Log: selected merges in 2389:2420. Mainly predict.cca/fitted.cca etc and doc upgrades (FAQ, cca x-refs) Modified: branches/2.0/R/fitted.capscale.R =================================================================== --- branches/2.0/R/fitted.capscale.R 2013-02-07 17:39:54 UTC (rev 2420) +++ branches/2.0/R/fitted.capscale.R 2013-02-07 17:55:39 UTC (rev 2421) @@ -1,5 +1,5 @@ -fitted.capscale <- - function(object, model = c("CCA", "CA", "Imaginary"), +`fitted.capscale` <- + function(object, model = c("CCA", "CA", "pCCA", "Imaginary"), type = c("response", "working"), ...) { model <- match.arg(model) @@ -8,7 +8,8 @@ U <- switch(model, CCA = object$CCA$u.eig, CA = object$CA$u.eig, - Imaginary = object$CA$imaginary.u.eig) + Imaginary = object$CA$imaginary.u.eig, + pCCA = object$pCCA$Fit/object$adjust) ## Distances or working scores U if (type == "response") { U <- dist(U) Modified: branches/2.0/R/fitted.cca.R =================================================================== --- branches/2.0/R/fitted.cca.R 2013-02-07 17:39:54 UTC (rev 2420) +++ branches/2.0/R/fitted.cca.R 2013-02-07 17:55:39 UTC (rev 2421) @@ -1,11 +1,15 @@ -"fitted.cca" <- -function (object, model = c("CCA","CA"), type = c("response", "working"), ...) +`fitted.cca` <- + function (object, model = c("CCA","CA","pCCA"), type = c("response", "working"), + ...) { type <- match.arg(type) model <- match.arg(model) gtot <- object$grand.total rc <- object$rowsum %o% object$colsum - Xbar <- object[[model]]$Xbar + if (model == "pCCA") + Xbar <- object$pCCA$Fit + else + Xbar <- object[[model]]$Xbar if (model == "CCA") Xbar <- qr.fitted(object$CCA$QR, Xbar) if (type == "response") Modified: branches/2.0/R/fitted.rda.R =================================================================== --- branches/2.0/R/fitted.rda.R 2013-02-07 17:39:54 UTC (rev 2420) +++ branches/2.0/R/fitted.rda.R 2013-02-07 17:55:39 UTC (rev 2421) @@ -1,9 +1,12 @@ -"fitted.rda" <- - function (object, model = c("CCA", "CA"), type = c("response", "working"), ...) +`fitted.rda` <- + function (object, model = c("CCA", "CA", "pCCA"), type = c("response", "working"), ...) { type <- match.arg(type) model <- match.arg(model) - Xbar <- object[[model]]$Xbar + if (model == "pCCA") + Xbar <- object$pCCA$Fit + else + Xbar <- object[[model]]$Xbar if (model == "CCA") Xbar <- qr.fitted(object$CCA$QR, Xbar) if (type == "response") { Modified: branches/2.0/R/predict.cca.R =================================================================== --- branches/2.0/R/predict.cca.R 2013-02-07 17:39:54 UTC (rev 2420) +++ branches/2.0/R/predict.cca.R 2013-02-07 17:55:39 UTC (rev 2421) @@ -31,8 +31,6 @@ } if (take > 0) Xbar <- u %*% slam %*% t(v) - if (!is.null(object$pCCA)) - warning("Conditional ('partial') component ignored") rc <- outer(rs, cs) if (type == "response") out <- (Xbar + 1) * rc * gtot Modified: branches/2.0/R/predict.rda.R =================================================================== --- branches/2.0/R/predict.rda.R 2013-02-07 17:39:54 UTC (rev 2420) +++ branches/2.0/R/predict.rda.R 2013-02-07 17:55:39 UTC (rev 2421) @@ -25,15 +25,13 @@ w <- u slam <- diag(sqrt(object[[model]]$eig[1:take] * nr), nrow = take) if (type %in% c("response", "working")) { - if (!is.null(object$pCCA)) - warning("Conditional ('partial') component ignored") if (!missing(newdata)) { u <- predict(object, type = if(model == "CCA") "lc" else "wa", newdata = newdata, rank = take) } if (inherits(object, "capscale")) { if (take > 0) { - out <- u %*% slam/sqrt(nr) + out <- u %*% slam/object$adjust if (type == "response") { out <- dist(out) if (!is.null(object$ac)) Modified: branches/2.0/inst/ChangeLog =================================================================== --- branches/2.0/inst/ChangeLog 2013-02-07 17:39:54 UTC (rev 2420) +++ branches/2.0/inst/ChangeLog 2013-02-07 17:55:39 UTC (rev 2421) @@ -4,15 +4,19 @@ Version 2.0-6 (opened October 8, 2012) - * merge 2404: refer Legendre & Legendre for the vegan rda - algorithm. + * merge 2420: cca cross references. + * merge 2417 thru 2419: predict & fitted upgraded for cca etc. + * merge 2414: adjustment in predict.capscale. + * merge 2408: FAQ on random effects in cca etc. + * merge 2404,2411: refer Legendre & Legendre for the vegan rda + algorithm. * merge 2934 (partial, mc): oecosimu handles nestedfun() returning data.frame. Not merged: checking length of statistic when setting its name. * merge 2932,3: matching names in treedive() and treedist(). - * merge 2388 (partial): faster protest, the part of evaluating the - test statistic hand crafted, because parallelizations caused - conflicts here. + * merge 2388 (partial), 2389, 2390: faster protest, the part of + evaluating the test statistic hand crafted, because + parallelizations caused conflicts here. * merge 2385, 7: protest print, faster sum of squares in procrustes. * merge 2384: new FAQ entries. * merge 2383: remove alias to print.wcmdscale. Modified: branches/2.0/inst/doc/FAQ-vegan.texi =================================================================== --- branches/2.0/inst/doc/FAQ-vegan.texi 2013-02-07 17:39:54 UTC (rev 2420) +++ branches/2.0/inst/doc/FAQ-vegan.texi 2013-02-07 17:55:39 UTC (rev 2421) @@ -8,7 +8,7 @@ @setfilename FAQ- at pkg{vegan}.info @settitle @pkg{vegan} FAQ @setchapternewpage on - at set FAQ_YEAR 2012 + at set FAQ_YEAR 2013 @afourpaper @c %**end of header @@ -26,7 +26,7 @@ Creative Commons, 543 Howard Street, 5th Floor, San Francisco, California, 94105, USA. -Copyright @copyright{} 2008-2012 Jari Oksanen +Copyright @copyright{} 2008-2013 Jari Oksanen @end quotation @end copying @@ -324,7 +324,7 @@ @chapter Ordination @menu -* I have only numeric and positive data but @pkg{vegan} still complaints:: +* I have only numeric and positive data but @pkg{vegan} still complains:: * Can I analyse binary or cover class data?:: * Why dissimilarities in @pkg{vegan} differ from other sources?:: * Why NMDS stress is sometimes 0.1 and sometimes 10?:: @@ -335,6 +335,7 @@ * How the RDA results are scaled?:: * cca fails with ``data.frame expected'' or ``"site.env" missing'':: * Variance explained by ordination axes:: +* Can I have random effects in constrained ordination or in @code{adonis}?:: * Is it possible to have passive points in ordination?:: * Class variables and dummies:: * How are environmental arrows scaled?:: @@ -348,9 +349,9 @@ * Can I zoom into an ordination plot?:: @end menu - at node I have only numeric and positive data but @pkg{vegan} still complaints, Can I analyse binary or cover class data?, Ordination, Ordination + at node I have only numeric and positive data but @pkg{vegan} still complains, Can I analyse binary or cover class data?, Ordination, Ordination @comment node-name, next, previous, up - at section I have only numeric and positive data but @pkg{vegan} still complaints + at section I have only numeric and positive data but @pkg{vegan} still complains You are wrong! Computers are painfully pedantic, and if they find non-numeric or negative data entries, you really have them. Check your @@ -361,7 +362,7 @@ the data). Another common reason is that you had empty cells in your input data, and these were interpreted as missing values. - at node Can I analyse binary or cover class data?, Why dissimilarities in @pkg{vegan} differ from other sources?, I have only numeric and positive data but @pkg{vegan} still complaints, Ordination + at node Can I analyse binary or cover class data?, Why dissimilarities in @pkg{vegan} differ from other sources?, I have only numeric and positive data but @pkg{vegan} still complains, Ordination @section Can I analyse binary or cover class data? Yes. Most @pkg{vegan} methods can handle binary data or cover abundance data. @@ -488,7 +489,7 @@ you do not need package @pkg{ade4}, you can detach it with command @code{detach(package:ade4)}. - at node Variance explained by ordination axes, Is it possible to have passive points in ordination?, cca fails with ``data.frame expected'' or ``"site.env" missing'', Ordination + at node Variance explained by ordination axes, Can I have random effects in constrained ordination or in @code{adonis}?, cca fails with ``data.frame expected'' or ``"site.env" missing'', Ordination @section Variance explained by ordination axes. In general, @pkg{vegan} does not directly give any statistics on the @@ -547,7 +548,46 @@ @end itemize - at node Is it possible to have passive points in ordination?, Class variables and dummies, Variance explained by ordination axes, Ordination + at node Can I have random effects in constrained ordination or in @code{adonis}?, Is it possible to have passive points in ordination?, Variance explained by ordination axes, Ordination + at section Can I have random effects in constrained ordination or in @code{adonis}? + +No. Strictly speaking, this is impossible. However, you can define +models that respond to similar goals as random effects models, although +they strictly speaking use only fixed effects. + +Constrained ordination functions @code{cca}, @code{rda} and + at code{capscale} can have @code{Condition()} terms in their formula. The + at code{Condition()} define partial terms that are fitted before other +constraints and can be used to remove the effects of background +variables, and their contribution to decomposing inertia (variance) is +reported separately. These partial terms are often regarded as similar +to random effects, but they are still fitted in the same way as other +terms and strictly speaking they are fixed terms. + +Function @code{adonis} evaluates terms sequentially. In a model with +right-hand-side @code{~ A + B} the effects of @code{A} are evaluated +first, and the effects of @code{B} after removing the effects of + at code{A}. Sequential tests are also available in @code{anova} function +for constrained ordination results by setting argument @code{by = "term"}. +In this way, the first terms can serve in a similar role as +random effects, although they are fitted in the same way as all other +terms, and strictly speaking they are fixed terms. + +The permutation tests can usually have a @code{strata} argument which +restricts the permutations within levels of a factor given in the +argument. This can be used to restrict the permutations within levels of +factor regarded as a random term. More structured permutations are +available with the @pkg{permute} package. + +A major reason why real random effects models are impossible in most + at pkg{vegan} functions is that their tests are based on the permutation +of the data. The data are given, that is fixed, and therefore +permutation tests are basically tests of fixed terms on fixed data. +Random effect terms would require permutations of data with a random +component instead of the given, fixed data, and such tests are not +available in @pkg{vegan}. + + at node Is it possible to have passive points in ordination?, Class variables and dummies, Can I have random effects in constrained ordination or in @code{adonis}?, Ordination @section Is it possible to have passive points in ordination? @pkg{Vegan} does not have a concept of passive points, or a point that should Modified: branches/2.0/man/capscale.Rd =================================================================== --- branches/2.0/man/capscale.Rd 2013-02-07 17:39:54 UTC (rev 2420) +++ branches/2.0/man/capscale.Rd 2013-02-07 17:55:39 UTC (rev 2421) @@ -213,7 +213,14 @@ \seealso{\code{\link{rda}}, \code{\link{cca}}, \code{\link{plot.cca}}, \code{\link{anova.cca}}, \code{\link{vegdist}}, - \code{\link{dist}}, \code{\link{cmdscale}}.} + \code{\link{dist}}, \code{\link{cmdscale}}. + + The function returns similar result object as \code{\link{rda}} (see + \code{\link{cca.object}}). This section for \code{\link{rda}} gives a + more complete list of functions that can be used to access and + analyse \code{capscale} results. + +} \examples{ data(varespec) data(varechem) Modified: branches/2.0/man/cca.Rd =================================================================== --- branches/2.0/man/cca.Rd 2013-02-07 17:39:54 UTC (rev 2420) +++ branches/2.0/man/cca.Rd 2013-02-07 17:55:39 UTC (rev 2421) @@ -67,7 +67,7 @@ decomposition (\code{\link{svd}}). Function \code{rda} is similar, but uses ordinary, unweighted linear regression and unweighted SVD. Legendre & Legendre (2012), Table 11.5 (p. 650) give a skeleton of the RDA - algorithm of \pgk{vegan}. The algorithm of CCA is similar, but + algorithm of \pkg{vegan}. The algorithm of CCA is similar, but involves standardization by row and column weights. The functions can be called either with matrix-like entries for community @@ -194,25 +194,61 @@ } \seealso{ - There is a special documentation for \code{\link{plot.cca}} and - \code{\link{summary.cca}} functions - with their helper functions (\code{\link{text.cca}}, - \code{\link{points.cca}}, \code{\link{scores.cca}}). - Function \code{\link{anova.cca}} provides an ANOVA like permutation - test for the ``significance'' of constraints. Automatic model building - (dangerous!) is discussed in \code{\link{deviance.cca}}. Diagnostic - tools, prediction and adding new points in ordination are discussed in - \code{\link{goodness.cca}} and \code{\link{predict.cca}}. - Function \code{\link[ade4]{cca}} (library \pkg{ade4}) provide alternative - implementations of CCA (these are internally quite - different). Function \code{\link{capscale}} is a non-Euclidean generalization of - \code{rda}. The result object is described in - \code{\link{cca.object}}. - You can use \code{\link{as.mlm}} to refit ordination result as a - multiple response linear model to find some descriptive statistics. - Design decisions are explained in - \code{\link{vignette}} \file{decision-vegan} which also can be accessed - with \code{\link{vegandocs}}. + + This help page describes two constrained ordination functions, + \code{cca} and \code{rda}. A related method, distance-based + redundancy analysis (dbRDA) is described separately + (\code{\link{capscale}}). All these function return similar objects + (described in \code{\link{cca.object}}). There are numerous support + functions that can used to access the result object. In the list + below, functions of type \code{cca} will handle all ordination + objects, and functions of \code{rda} only handle \code{rda} and + \code{\link{capscale}} results. + + The main plotting functions are \code{\link{plot.cca}} for all + methods, and \code{\link{biplot.rda}} for RDA and dbRDA. However, + generic \pkg{vegan} plotting functions can also handle the results. + The scores can be accessed and scaled with \code{\link{scores.cca}}, + and summarized with \code{\link{summary.cca}}. The eigenvalues can + be accessed with \code{\link{eigenvals.cca}} and the regression + coefficients for constraints with \code{\link{coef.cca}}. The + eigenvalues can be plotted with \code{\link{screeplot.cca}}, and the + (adjusted) \eqn{R^2}{R-squared} can be found with + \code{\link{RsquareAdj.rda}}. The scores can be also calculated for + new data sets with \code{\link{predict.cca}} which allows adding + points to ordinations. The values of constraints can be inferred + from ordination and community composition with + \code{\link{calibrate.cca}}. + + Diagnostic statistics can be found with \code{\link{goodness.cca}}, + \code{\link{inertcomp}}, \code{\link{spenvcor}}, + \code{\link{intersetcor}} and \code{\link{vif.cca}}. Function + \code{\link{as.mlm.cca}} refits the result object as a multiple + \code{\link{lm}} object, and this allows finding influence + statistics (\code{\link{lm.influence}}, \code{\link{cooks.distance}} + etc.). + + Permutation based signficance for the overall model, single + constraining variables or axes can be found with + \code{\link{anova.cca}}. Automatic model building with \R{} + \code{\link{step}} function is possible with + \code{\link{deviance.cca}}, \code{\link{add1.cca}} and + \code{\link{drop1.cca}}. Functions \code{\link{ordistep}} and + \code{\link{ordiR2step}} (for RDA) are special functions for + constrained ordination. Randomized data sets can be generated with + \code{\link{simulate.cca}}. + + Separate methods based on constrained ordination model are principal + response curves (\code{\link{prc}}) and variance partioning between + several components (\code{\link{varpart}}). + + Design decisions are explained in \code{\link{vignette}} + \file{decision-vegan} which also can be accessed with + \code{\link{vegandocs}}. + + Package \pkg{ade4} provides alternative constrained ordination + functions \code{\link[ade4]{cca}} and \code{\link[ade4]{pcaiv}}. + } \examples{ Modified: branches/2.0/man/cca.object.Rd =================================================================== --- branches/2.0/man/cca.object.Rd 2013-02-07 17:39:54 UTC (rev 2420) +++ branches/2.0/man/cca.object.Rd 2013-02-07 17:55:39 UTC (rev 2421) @@ -190,6 +190,10 @@ linear model (\code{\link{lm}}) in order to more easily find some statistics (which in principle could be directly found from the \code{cca.object} as well). + + This section in \code{\link{cca}} gives a more complete list of + methods to handle the constrained ordination result object. + } \references{ Legendre, P. and Legendre, L. (2012) \emph{Numerical Ecology}. 3rd English Modified: branches/2.0/man/predict.cca.Rd =================================================================== --- branches/2.0/man/predict.cca.Rd 2013-02-07 17:39:54 UTC (rev 2420) +++ branches/2.0/man/predict.cca.Rd 2013-02-07 17:55:39 UTC (rev 2421) @@ -21,9 +21,9 @@ response data. } \usage{ -\method{fitted}{cca}(object, model = c("CCA", "CA"), +\method{fitted}{cca}(object, model = c("CCA", "CA", "pCCA"), type = c("response", "working"), ...) -\method{fitted}{capscale}(object, model = c("CCA", "CA", "Imaginary"), +\method{fitted}{capscale}(object, model = c("CCA", "CA", "pCCA", "Imaginary"), type = c("response", "working"), ...) \method{residuals}{cca}(object, ...) \method{predict}{cca}(object, newdata, type = c("response", "wa", "sp", "lc", "working"), @@ -37,24 +37,23 @@ \arguments{ \item{object}{A result object from \code{\link{cca}}, \code{\link{rda}}, \code{\link{capscale}} or \code{\link{decorana}}. } - \item{model}{Show constrained (\code{"CCA"}) or unconstrained - (\code{"CA"}) results. For \code{\link{capscale}} this can also be - \code{"Imaginary"} for imaginary components with negative - eigenvalues. } - + \item{model}{Show constrained (\code{"CCA"}), unconstrained + (\code{"CA"}) or conditioned \dQuote{partial} (\code{"pCCA"}) + results. For \code{fitted} method of \code{\link{capscale}} this + can also be \code{"Imaginary"} for imaginary components with + negative eigenvalues. } \item{newdata}{New data frame to be used in prediction or in calibration. Usually this a new community data frame, but with - \code{type = "lc"} and for constrained component with - \code{type = "response"} and \code{type = "working"} it must be a - data frame. The \code{newdata} must have the same number of rows as - the original community data for a \code{\link{cca}} result with + \code{type = "lc"} and for constrained component with \code{type = + "response"} and \code{type = "working"} it must be a data frame of + constraints. The \code{newdata} must have the same number of rows + as the original community data for a \code{\link{cca}} result with \code{type = "response"} or \code{type = "working"}. If the original model had row or column names, then new data must contain rows or columns with the same names (row names for species scores, column names for \code{"wa"} scores and constraint names of \code{"lc"} scores). In other cases the rows or columns must match directly. } - \item{type}{The type of prediction, fitted values or residuals: \code{"response"} scales results so that the same ordination gives the same results, and \code{"working"} gives the values used @@ -71,28 +70,28 @@ \item{rank}{The rank or the number of axes used in the approximation. The default is to use all axes (full rank) of the \code{"model"} or all available four axes in \code{predict.decorana}.} - \item{scaling}{Scaling or predicted scores - with the same meaning as in \code{\link{cca}}, \code{\link{rda}} and - \code{\link{capscale}}.} + \item{scaling}{Scaling or predicted scores with the same meaning as + in \code{\link{cca}}, \code{\link{rda}} and + \code{\link{capscale}}.} \item{\dots}{Other parameters to the functions.} } \details{ + Function \code{fitted} gives the approximation of the original data - matrix or dissimilarities from the ordination result either in the - scale of the response - or as scaled internally by the function. Function \code{residuals} gives - the approximation of the original data from the unconstrained - ordination. With argument \code{type = "response"} the - \code{fitted.cca} and \code{residuals.cca} function + matrix or dissimilarities from the ordination result either in the + scale of the response or as scaled internally by the function. + Function \code{residuals} gives the approximation of the original + data from the unconstrained ordination. With argument \code{type = + "response"} the \code{fitted.cca} and \code{residuals.cca} function both give the same marginal totals as the original data matrix, and - their entries do not add up to the original data. - Functions \code{fitted.capscale} and \code{residuals.capscale} give the - dissimilarities with \code{type = "response"}, but these are not additive, - but the \code{"working"} scores are additive. - All variants of \code{fitted} and \code{residuals} are defined so - that for model \code{mod <- cca(y ~ x)}, \code{cca(fitted(mod))} is equal - to constrained ordination, and \code{cca(residuals(mod))} is equal to - unconstrained part of the ordination. + fitted and residuals do not add up to the original data. Functions + \code{fitted.capscale} and \code{residuals.capscale} give the + dissimilarities with \code{type = "response"}, but these are not + additive, but the \code{"working"} scores are additive. All + variants of \code{fitted} and \code{residuals} are defined so that + for model \code{mod <- cca(y ~ x)}, \code{cca(fitted(mod))} is equal + to constrained ordination, and \code{cca(residuals(mod))} is equal + to unconstrained part of the ordination. Function \code{predict} can find the estimate of the original data matrix or dissimilarities (\code{type = "response"}) with any rank. @@ -105,8 +104,8 @@ explicit \code{scaling} to add those scores to ordination diagrams. With \code{type = "wa"} the function finds the site scores from species scores. In that case, the new data can contain new sites, - but species must match in the original and new data. With \code{type - = "sp"} the function finds species scores from site constraints + but species must match in the original and new data. With \code{type="sp"} + the function finds species scores from site constraints (linear combination scores). In that case the new data can contain new species, but sites must match in the original and new data. With \code{type = "lc"} the function finds the linear combination scores @@ -117,7 +116,7 @@ if constrained component is desired, and community data matrix if residual or unconstrained component is desired. With these types, the function uses \code{newdata} to find new \code{"lc"} (constrained) or - \code{"wa"} scores (unconstrained) and then finding the response or + \code{"wa"} scores (unconstrained) and then finds the response or working data from these new row scores and species scores. The original site (row) and species (column) weights are used for \code{type = "response"} and \code{type = "working"} in correspondence @@ -127,7 +126,7 @@ If a completely new data frame is created, extreme care is needed defining variables similarly as in the original model, in particular with (ordered) factors. If ordination was performed with the formula - interface, the \code{newdata} also can be a data frame or matrix, but + interface, the \code{newdata} can be a data frame or matrix, but extreme care is needed that the columns match in the original and \code{newdata}. @@ -139,7 +138,7 @@ arrows, but it uses regression coefficients. The function can be called with \code{newdata} so that cross-validation is possible. The \code{newdata} may contain new sites, but species must match in the - original and new data The function + original and new data. The function does not work with \sQuote{partial} models with \code{Condition} term, and it cannot be used with \code{newdata} for \code{\link{capscale}} results. The results may only be interpretable for continuous variables. Modified: branches/2.0/man/procrustes.Rd =================================================================== --- branches/2.0/man/procrustes.Rd 2013-02-07 17:39:54 UTC (rev 2420) +++ branches/2.0/man/procrustes.Rd 2013-02-07 17:55:39 UTC (rev 2421) @@ -135,15 +135,16 @@ function canot be used with \code{newdata} for \code{symmetric} analysis. - Function \code{protest} calls \code{procrustes(..., symmetric = TRUE)} + Function \code{protest} performs symmetric Procrustes analysis repeatedly to estimate the `significance' of the Procrustes statistic. Function \code{protest} uses a correlation-like statistic derived from the symmetric Procrustes sum of squares \eqn{ss} as - \eqn{r =\sqrt{(1-ss)}}, and sometimes called \eqn{m_{12}}. Function - \code{protest} has own \code{print} method, but otherwise uses - \code{procrustes} methods. Thus \code{plot} with a \code{protest} object - yields a ``Procrustean superimposition plot.'' -} + \eqn{r =\sqrt{1-ss}}{r = sqrt(1-ss)}, and also prints the sum of + squares of the symmetric analysis, sometimes called + \eqn{m_{12}^2}{squared m12}. Function \code{protest} has own + \code{print} method, but otherwise uses \code{procrustes} + methods. Thus \code{plot} with a \code{protest} object yields a + ``Procrustean superimposition plot.'' } \value{ Function \code{procrustes} returns an object of class From noreply at r-forge.r-project.org Fri Feb 8 09:08:21 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Fri, 8 Feb 2013 09:08:21 +0100 (CET) Subject: [Vegan-commits] r2422 - branches/2.0/inst www Message-ID: <20130208080821.2DA1B1844E2@r-forge.r-project.org> Author: jarioksa Date: 2013-02-08 09:08:20 +0100 (Fri, 08 Feb 2013) New Revision: 2422 Modified: branches/2.0/inst/NEWS.Rd www/NEWS.html Log: expand NEWS and remove linebreaks within \code{} Modified: branches/2.0/inst/NEWS.Rd =================================================================== --- branches/2.0/inst/NEWS.Rd 2013-02-07 17:55:39 UTC (rev 2421) +++ branches/2.0/inst/NEWS.Rd 2013-02-08 08:08:20 UTC (rev 2422) @@ -9,39 +9,41 @@ \itemize{ \item The species scores were scaled correctly in - \code{capscale()} only when Euclidean distances were used. Most - graphics will change and should be redone. The function also - now displays the value of the additive constant when argument - \code{add = TRUE} was used. + \code{capscale()} only when Euclidean distances were used. Usually + \code{capscale()} is used with non-Euclidean distances, and in + these cases the scaling was wrong. Most graphics will change and + should be redone. The change of scaling mainly influences the + spread of species scores with respect to the site scores. \item Function \code{clamtest()} failed to set the minimum - abundance threshold in some cases. The output was wrong when - some of the possible species groups were missing. The problems - were reported by Richard Telford (Bergen, Norway). + abundance threshold in some cases. In addition, the output was + wrong when some of the possible species groups were missing. The + problems were reported by Richard Telford (Bergen, Norway). \item Plotting an object fitted by \code{envfit()} would fail if \code{p.max} was used and there were unused levels for one or more factors. The unused levels could result from deletion of - observations with missing values or simply the result of + observations with missing values or simply as the result of supplying a subset of a larger data set to \code{envfit()}. \item \code{multipart()} printed wrong information about the analysis type (but did analysis correctly). Reported by Valerie Coudrain. - \item \code{oecosimu()} failed if its \code{nestedfun} returned - a data frame. A more fundamental fix will be in \pkg{vegan} - 2.2-0. + \item \code{oecosimu()} failed if its \code{nestedfun} returned a + data frame. A more fundamental fix will be in \pkg{vegan} 2.2-0, + where the structure of the \code{oecosimu()} result will change. \item The plot of two-dimensional \code{procrustes()} solutions often draw original axes in a wrong angle. The problem was reported by Elizabeth Ottesen (MIT). - \item Function \code{treedive()} for functional diversity did - not correctly match the species names in the community data and - classification tree when the tree contained species that did - not occur in the data. Related function \code{treedist()} for - phylogenetic distances did not try to match the names at all. + \item Function \code{treedive()} for functional or phylogenetic + diversity did not correctly match the species names between the + community data and species tree when the tree contained species + that did not occur in the data. Related function + \code{treedist()} for phylogenetic distances did not try to match + the names at all. } @@ -51,6 +53,14 @@ \itemize{ + \item The output of \code{capscale()} displays the value of the + additive constant when argument \code{add = TRUE} was used. + + \item \code{fitted()} functions for \code{cca()}, \code{rda()} and + \code{capscale()} can now return conditioned (partial) component + of the response: Argument \code{model} gained a new alternative + \code{model = "pCCA"}. + \item \code{dispindmorisita()} output gained a new column for Chi-squared based probabilities that the null hypothesis (random distribution) is true. @@ -71,11 +81,11 @@ method. \item \code{ordiR2step()} gained new argument \code{R2scope} - (defaults \code{TRUE}) which can be used to turn off the - criterion of stopping when the adjusted \eqn{R^2}{R2} of the - current model exceeds that of the scope. This option allows - model building when the \code{scope} would be overdetermined - (number of predictors higher than number of observations). + (defaults \code{TRUE}) which can be used to turn off the criterion + of stopping when the adjusted \eqn{R^2}{R-squared} of the current + model exceeds that of the scope. This option allows model + building when the \code{scope} would be overdetermined (number of + predictors higher than number of observations). \code{ordiR2step()} now handles partial redundancy analysis (pRDA). @@ -83,19 +93,21 @@ \item \code{orditorp()} gained argument \code{select} to select the rows or columns of the results to display. - \item \code{protest()} prints the standardized residual - statistic \eqn{m_{12}^2}{squared m12} in addition to the squared - Procrustes correlation \eqn{R^2}{R2}. Both were calculated, but - only the latter was displayed. + \item \code{protest()} prints the standardized residual statistic + \eqn{m_{12}^2}{squared m12} in addition to the squared Procrustes + correlation \eqn{R^2}{R-squared}. Both were calculated, but only + the latter was displayed. Permutation tests are much faster in \code{protest()}. Instead of calling repeatedly \code{procrustes()}, the goodness of fit - statistic is evaluated within then function. + statistic is evaluated within the function. \item \code{wcmdscale()} gained methods for \code{print}, \code{plot} etc. of the results. These methods are only used if - the full \code{wcmdscale} result is returned with, e.g., - argument \code{eig = TRUE}. + the full \code{wcmdscale} result is returned with, e.g., argument + \code{eig = TRUE}. The default is still to return only a matrix of + scores similarly as the standard \R function \code{cmdscale()}, + and in that case the new methods are not used. } @@ -110,9 +122,9 @@ \itemize{ - \item \code{anova( |