[Vegan-commits] r2252 - in pkg/vegan: . R man tests/Examples
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Mon Aug 20 07:57:25 CEST 2012
Author: jarioksa
Date: 2012-08-20 07:57:24 +0200 (Mon, 20 Aug 2012)
New Revision: 2252
Added:
pkg/vegan/R/density.anosim.R
Modified:
pkg/vegan/NAMESPACE
pkg/vegan/R/density.oecosimu.R
pkg/vegan/man/adonis.Rd
pkg/vegan/man/anosim.Rd
pkg/vegan/man/anova.cca.Rd
pkg/vegan/man/mantel.Rd
pkg/vegan/man/mrpp.Rd
pkg/vegan/man/procrustes.Rd
pkg/vegan/tests/Examples/vegan-Ex.Rout.save
Log:
Merge branch 'master' into r-forge-svn-local
Modified: pkg/vegan/NAMESPACE
===================================================================
--- pkg/vegan/NAMESPACE 2012-08-18 06:22:51 UTC (rev 2251)
+++ pkg/vegan/NAMESPACE 2012-08-20 05:57:24 UTC (rev 2252)
@@ -132,8 +132,15 @@
# cophenetic: stats
S3method(cophenetic, spantree)
# density: stats
+S3method(density, adonis)
+S3method(density, anosim)
+S3method(density, mantel)
+S3method(density, mrpp)
S3method(density, oecosimu)
+S3method(density, permutest.cca)
+S3method(density, protest)
# densityplot: lattice
+S3method(densityplot, adonis)
S3method(densityplot, oecosimu)
# deviance: stats
S3method(deviance, cca)
Added: pkg/vegan/R/density.anosim.R
===================================================================
--- pkg/vegan/R/density.anosim.R (rev 0)
+++ pkg/vegan/R/density.anosim.R 2012-08-20 05:57:24 UTC (rev 2252)
@@ -0,0 +1,88 @@
+### density & densityplot methods for vegan functions returning
+### statistics from permuted/simulated data. These are modelled after
+### density.oecosimu and densityplot.oecosimu (which are in their
+### separate files).
+
+## anosim
+
+`density.anosim` <-
+ function(x, ...)
+{
+ out <- density(x$perm, ...)
+ out$call <- match.call()
+ out$call[[1]] <- as.name("density")
+ out
+}
+
+## adonis can return a matrix of terms, hence we also have densityplot()
+
+`density.adonis` <-
+ function(x, ...)
+{
+ out <- density(x$f.perms, ...)
+ out$call <- match.call()
+ out$call[[1]] <- as.name("density")
+ out
+}
+
+`densityplot.adonis` <-
+ function(x, data, xlab = "Null", ...)
+{
+ require(lattice) || stop("requires package 'lattice'")
+ sim <- x$f.perms
+ obs <- x$aov.tab$F.Model
+ nm <- rownames(x$aov.tab)[col(sim)]
+ densityplot( ~ as.vector(sim) | factor(nm, levels = unique(nm)),
+ xlab = xlab,
+ panel = function(x, ...) {
+ panel.densityplot(x, ...)
+ panel.abline(v = obs[panel.number()], ...)
+ },
+ ...)
+}
+
+## mantel
+
+`density.mantel` <-
+ function(x, ...)
+{
+ out <- density(x$perm, ...)
+ out$call <- match.call()
+ out$call[[1]] <- as.name("density")
+ out
+}
+
+## mrpp
+
+`density.mrpp` <-
+ function(x, ...)
+{
+ out <- density(x$boot.deltas, ...)
+ out$call <- match.call()
+ out$call[[1]] <- as.name("density")
+ out
+}
+
+## anova.cca does not return permutation results, but permutest.cca
+## does. However, permutest.cca always finds only one statistic. Full
+## tables anova.cca are found by repeated calls to permutest.cca.
+
+`density.permutest.cca` <-
+ function(x, ...)
+{
+ out <- density(x$F.perm, ...)
+ out$call <- match.call()
+ out$call[[1]] <- as.name("density")
+ out
+}
+
+## protest
+
+`density.protest` <-
+ function(x, ...)
+{
+ out <- density(x$t, ...)
+ out$call <- match.call()
+ out$call[[1]] <- as.name("density")
+ out
+}
Modified: pkg/vegan/R/density.oecosimu.R
===================================================================
--- pkg/vegan/R/density.oecosimu.R 2012-08-18 06:22:51 UTC (rev 2251)
+++ pkg/vegan/R/density.oecosimu.R 2012-08-20 05:57:24 UTC (rev 2252)
@@ -3,6 +3,7 @@
{
out <- density(t(x$oecosimu$simulated), ...)
out$call <- match.call()
+ out$call[[1]] <- as.name("density")
out
}
Modified: pkg/vegan/man/adonis.Rd
===================================================================
--- pkg/vegan/man/adonis.Rd 2012-08-18 06:22:51 UTC (rev 2251)
+++ pkg/vegan/man/adonis.Rd 2012-08-20 05:57:24 UTC (rev 2252)
@@ -1,6 +1,7 @@
\encoding{UTF-8}
\name{adonis}
\alias{adonis}
+\alias{density.adonis}
\title{Permutational Multivariate Analysis of Variance Using Distance Matrices}
@@ -134,10 +135,12 @@
sites; each column represents a fit of a sites distances (from all
other sites) to the linear model.These are what you get when you
fit distances of one site to
- your predictors. }
+ your predictors. }
\item{f.perms}{ an \eqn{N} by \eqn{m} matrix of the null \eqn{F}
- statistics for each source of variation based on \eqn{N}
- permutations of the data.}
+ statistics for each source of variation based on \eqn{N}
+ permutations of the data. The distribution of a single term can be
+ inspected with \code{\link{density}} function, or all terms
+ simultaneously with \code{densityplot}.}
\item{model.matrix}{The \code{\link{model.matrix}} for the right hand
side of the formula.}
\item{terms}{The \code{\link{terms}} component of the model.}
@@ -216,10 +219,10 @@
ordispider(mod, group=dat$field, lty=3, col="red")
### Correct hypothesis test (with strata)
-adonis(Y ~ NO3, data=dat, strata=dat$field, perm=1e3)
+adonis(Y ~ NO3, data=dat, strata=dat$field, perm=999)
### Incorrect (no strata)
-adonis(Y ~ NO3, data=dat, perm=1e3)
+adonis(Y ~ NO3, data=dat, perm=999)
}
\keyword{multivariate }
Modified: pkg/vegan/man/anosim.Rd
===================================================================
--- pkg/vegan/man/anosim.Rd 2012-08-18 06:22:51 UTC (rev 2251)
+++ pkg/vegan/man/anosim.Rd 2012-08-20 05:57:24 UTC (rev 2252)
@@ -2,6 +2,7 @@
\alias{anosim}
\alias{summary.anosim}
\alias{plot.anosim}
+\alias{density.anosim}
\title{ Analysis of Similarities }
\description{
@@ -56,10 +57,11 @@
grouping.
The statistical significance of observed \eqn{R} is assessed by
- permuting the grouping vector to obtain the empirical
- distribution of \eqn{R} under null-model. See
- \code{\link{permutations}} for additional details on permutation tests
- in Vegan.
+ permuting the grouping vector to obtain the empirical distribution
+ of \eqn{R} under null-model. See \code{\link{permutations}} for
+ additional details on permutation tests in Vegan. The distribution
+ of simulated values can be inspected with the \code{density}
+ function.
The function has \code{summary} and \code{plot} methods. These both
show valuable information to assess the validity of the method: The
@@ -74,7 +76,8 @@
\item{call }{Function call.}
\item{statistic}{The value of ANOSIM statistic \eqn{R}}
\item{signif}{Significance from permutation.}
- \item{perm}{Permutation values of \eqn{R}}
+ \item{perm}{Permutation values of \eqn{R}. The distribution of
+ permutation values can be inspected with function \code{density}.}
\item{class.vec}{Factor with value \code{Between} for dissimilarities
between classes and class name for corresponding dissimilarity
within class.}
Modified: pkg/vegan/man/anova.cca.Rd
===================================================================
--- pkg/vegan/man/anova.cca.Rd 2012-08-18 06:22:51 UTC (rev 2251)
+++ pkg/vegan/man/anova.cca.Rd 2012-08-20 05:57:24 UTC (rev 2252)
@@ -8,6 +8,7 @@
\alias{permutest}
\alias{permutest.default}
\alias{permutest.cca}
+\alias{density.permutest.cca}
\title{Permutation Test for Constrained Correspondence Analysis,
Redundancy Analysis and Constrained Analysis of Principal Coordinates }
@@ -138,12 +139,15 @@
exit from the function.
}
-\value{
+\value{
Function \code{permutest.cca} returns an object of class
- \code{"permutest.cca"}, which has its own \code{print} method. The
- function \code{anova.cca} calls \code{permutest.cca}, fills an
- \code{\link{anova}} table and uses \code{\link{print.anova}} for printing.
+ \code{"permutest.cca"}, which has its own \code{print} method. The
+ distribution of permuted \eqn{F} values can be inspected with
+ \code{density} function. The function \code{anova.cca} calls
+ \code{permutest.cca}, fills an \code{\link{anova}} table and uses
+ \code{\link{print.anova}} for printing.
}
+
\note{
Some cases of \code{anova} need access to the original data on
constraints (at least \code{by = "term"} and \code{by = "margin"}),
Modified: pkg/vegan/man/mantel.Rd
===================================================================
--- pkg/vegan/man/mantel.Rd 2012-08-18 06:22:51 UTC (rev 2251)
+++ pkg/vegan/man/mantel.Rd 2012-08-20 05:57:24 UTC (rev 2252)
@@ -1,6 +1,7 @@
\name{mantel}
\alias{mantel}
\alias{mantel.partial}
+\alias{density.mantel}
\title{Mantel and Partial Mantel Tests for Dissimilarity Matrices }
\description{
@@ -63,7 +64,8 @@
\code{\link{cor.test}}.}
\item{statistic}{The Mantel statistic.}
\item{signif}{Empirical significance level from permutations.}
- \item{perm}{A vector of permuted values.}
+ \item{perm}{A vector of permuted values. The distribution of
+ permuted values can be inspected with \code{density} funciton.}
\item{permutations}{Number of permutations.}
}
\references{ The test is due to Mantel, of course, but the
Modified: pkg/vegan/man/mrpp.Rd
===================================================================
--- pkg/vegan/man/mrpp.Rd 2012-08-18 06:22:51 UTC (rev 2251)
+++ pkg/vegan/man/mrpp.Rd 2012-08-20 05:57:24 UTC (rev 2252)
@@ -3,6 +3,7 @@
\alias{meandist}
\alias{summary.meandist}
\alias{plot.meandist}
+\alias{density.mrpp}
\title{Multi Response Permutation Procedure and Mean Dissimilarity Matrix}
@@ -143,7 +144,8 @@
the dist object.}
\item{weight.type}{The choice of group weights used.}
\item{boot.deltas}{The vector of "permuted deltas," the deltas
- calculated from each of the permuted datasets.}
+ calculated from each of the permuted datasets. The distribution of
+ this item can be inspected with \code{density} function.}
\item{permutations}{The number of permutations used.}
}
\references{
Modified: pkg/vegan/man/procrustes.Rd
===================================================================
--- pkg/vegan/man/procrustes.Rd 2012-08-18 06:22:51 UTC (rev 2251)
+++ pkg/vegan/man/procrustes.Rd 2012-08-20 05:57:24 UTC (rev 2252)
@@ -9,7 +9,7 @@
\alias{fitted.procrustes}
\alias{predict.procrustes}
\alias{protest}
-\alias{print.protest}
+\alias{density.protest}
\title{Procrustes Rotation of Two Configurations and PROTEST }
\description{
@@ -162,7 +162,8 @@
\item{call}{Function call.}
\item{t0}{This and the following items are only in class
\code{protest}: Procrustes correlation from non-permuted solution.}
- \item{t}{Procrustes correlations from permutations.}
+ \item{t}{Procrustes correlations from permutations. The distribution
+ of these correlations can be ispected with \code{density} function.}
\item{signif}{`Significance' of \code{t}}
\item{permutations}{Number of permutations.}
\item{strata}{The name of the stratifying variable.}
Modified: pkg/vegan/tests/Examples/vegan-Ex.Rout.save
===================================================================
--- pkg/vegan/tests/Examples/vegan-Ex.Rout.save 2012-08-18 06:22:51 UTC (rev 2251)
+++ pkg/vegan/tests/Examples/vegan-Ex.Rout.save 2012-08-20 05:57:24 UTC (rev 2252)
@@ -161,7 +161,7 @@
Formula:
y ~ poly(x1, 1) + poly(x2, 1)
-<environment: 0x102422ae8>
+<environment: 0x10246d238>
Total model degrees of freedom 3
GCV score: 0.0427924
@@ -621,7 +621,7 @@
> ### Name: adonis
> ### Title: Permutational Multivariate Analysis of Variance Using Distance
> ### Matrices
-> ### Aliases: adonis
+> ### Aliases: adonis density.adonis
> ### Keywords: multivariate nonparametric
>
> ### ** Examples
@@ -726,7 +726,7 @@
>
> ### Name: anosim
> ### Title: Analysis of Similarities
-> ### Aliases: anosim summary.anosim plot.anosim
+> ### Aliases: anosim summary.anosim plot.anosim density.anosim
> ### Keywords: multivariate nonparametric htest
>
> ### ** Examples
@@ -779,6 +779,7 @@
> ### Redundancy Analysis and Constrained Analysis of Principal Coordinates
> ### Aliases: anova.cca anova.ccanull anova.ccabyaxis anova.ccabyterm
> ### anova.ccabymargin anova.prc permutest permutest.default permutest.cca
+> ### density.permutest.cca
> ### Keywords: multivariate htest
>
> ### ** Examples
@@ -2657,7 +2658,8 @@
[1] "Moisture1" "Moisture2" "Moisture4" "Moisture5"
> plot(ord)
-> plot(fit, labels=list(factors = paste0("M", c(1,2,4,5))), bg = rgb(1,1,0,0.5))
+> plot(fit, labels=list(factors = paste("M", c(1,2,4,5), sep = "")),
++ bg = rgb(1,1,0,0.5))
>
>
>
@@ -3365,7 +3367,7 @@
>
> ### Name: mantel
> ### Title: Mantel and Partial Mantel Tests for Dissimilarity Matrices
-> ### Aliases: mantel mantel.partial
+> ### Aliases: mantel mantel.partial density.mantel
> ### Keywords: multivariate htest
>
> ### ** Examples
@@ -3791,7 +3793,7 @@
> ### Name: mrpp
> ### Title: Multi Response Permutation Procedure and Mean Dissimilarity
> ### Matrix
-> ### Aliases: mrpp meandist summary.meandist plot.meandist
+> ### Aliases: mrpp meandist summary.meandist plot.meandist density.mrpp
> ### Keywords: multivariate nonparametric htest
>
> ### ** Examples
@@ -4903,7 +4905,7 @@
Formula:
y ~ s(x1, x2, k = knots)
-<environment: 0x109c47348>
+<environment: 0x10a815200>
Estimated degrees of freedom:
6.4351 total = 7.435071
@@ -4919,7 +4921,7 @@
Formula:
y ~ s(x1, x2, k = knots)
-<environment: 0x109a2bc00>
+<environment: 0x10acdc078>
Estimated degrees of freedom:
6.1039 total = 7.103853
@@ -5075,7 +5077,7 @@
Formula:
y ~ s(x1, x2, k = knots)
-<environment: 0x1070664b0>
+<environment: 0x107b67040>
Estimated degrees of freedom:
8.9275 total = 9.927492
@@ -5088,7 +5090,7 @@
Formula:
y ~ s(x1, x2, k = knots)
-<environment: 0x108ccc378>
+<environment: 0x10af199f8>
Estimated degrees of freedom:
7.7529 total = 8.75294
@@ -5101,7 +5103,7 @@
Formula:
y ~ s(x1, x2, k = knots)
-<environment: 0x10a9493c8>
+<environment: 0x10a096db8>
Estimated degrees of freedom:
8.8962 total = 9.89616
@@ -5828,7 +5830,7 @@
> ### Aliases: procrustes summary.procrustes plot.procrustes
> ### points.procrustes text.procrustes lines.procrustes
> ### residuals.procrustes fitted.procrustes predict.procrustes protest
-> ### print.protest
+> ### density.protest
> ### Keywords: multivariate htest
>
> ### ** Examples
@@ -7645,7 +7647,7 @@
Formula:
y ~ s(x1, x2, k = knots)
-<environment: 0x10a89acd8>
+<environment: 0x10aec3f08>
Estimated degrees of freedom:
2 total = 3
@@ -8125,7 +8127,7 @@
> ### * <FOOTER>
> ###
> cat("Time elapsed: ", proc.time() - get("ptime", pos = 'CheckExEnv'),"\n")
-Time elapsed: 81.617 1.462 84.217 0 0
+Time elapsed: 153.286 4.277 466.257 0 0
> grDevices::dev.off()
null device
1
More information about the Vegan-commits
mailing list