[Vegan-commits] r2878 - in pkg/vegan: R inst man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Mon Sep 1 08:59:06 CEST 2014
Author: jarioksa
Date: 2014-09-01 08:59:06 +0200 (Mon, 01 Sep 2014)
New Revision: 2878
Modified:
pkg/vegan/R/nestednodf.R
pkg/vegan/R/ordiellipse.R
pkg/vegan/R/ordihull.R
pkg/vegan/R/ordispider.R
pkg/vegan/inst/ChangeLog
pkg/vegan/man/nestedtemp.Rd
Log:
Merge branch 'master' into r-forge-svn-local
Modified: pkg/vegan/R/nestednodf.R
===================================================================
--- pkg/vegan/R/nestednodf.R 2014-08-28 08:50:50 UTC (rev 2877)
+++ pkg/vegan/R/nestednodf.R 2014-09-01 06:59:06 UTC (rev 2878)
@@ -1,5 +1,5 @@
`nestednodf` <-
- function(comm, order = TRUE, weighted = FALSE)
+ function(comm, order = TRUE, weighted = FALSE, wbinary = FALSE)
{
bin.comm <- ifelse(comm > 0, 1, 0)
rfill <- rowSums(bin.comm)
@@ -34,8 +34,12 @@
next
if (weighted) {
second <- comm[j, ]
- N.paired.rows[counter] <-
- sum(first - second > 0 & second > 0)/sum(second > 0)
+ if (!wbinary)
+ N.paired.rows[counter] <-
+ sum(first - second > 0 & second > 0)/sum(second > 0)
+ else
+ N.paired.rows[counter] <-
+ sum(first - second >= 0 & second > 0)/sum(second > 0)
}
else {
N.paired.rows[counter] <-
@@ -52,8 +56,12 @@
next
if (weighted) {
second <- comm[, j]
- N.paired.cols[counter] <-
- sum(first - second > 0 & second > 0)/sum(second > 0)
+ if (!wbinary)
+ N.paired.cols[counter] <-
+ sum(first - second > 0 & second > 0)/sum(second > 0)
+ else
+ N.paired.cols[counter] <-
+ sum(first - second >= 0 & second > 0)/sum(second > 0)
}
else {
N.paired.cols[counter] <-
Modified: pkg/vegan/R/ordiellipse.R
===================================================================
--- pkg/vegan/R/ordiellipse.R 2014-08-28 08:50:50 UTC (rev 2877)
+++ pkg/vegan/R/ordiellipse.R 2014-09-01 06:59:06 UTC (rev 2878)
@@ -34,7 +34,7 @@
if (label)
cntrs <- names <- NULL
## Remove NA scores
- kk <- complete.cases(pts)
+ kk <- complete.cases(pts) & !is.na(groups)
for (is in inds) {
gr <- out[groups == is & kk]
if (length(gr) > 1) {
Modified: pkg/vegan/R/ordihull.R
===================================================================
--- pkg/vegan/R/ordihull.R 2014-08-28 08:50:50 UTC (rev 2877)
+++ pkg/vegan/R/ordihull.R 2014-09-01 06:59:06 UTC (rev 2878)
@@ -30,7 +30,7 @@
if (label)
cntrs <- names <- NULL
## Remove NA scores
- kk <- complete.cases(pts)
+ kk <- complete.cases(pts) & !is.na(groups)
for (is in inds) {
gr <- out[groups == is & kk]
if (length(gr) > 1) {
Modified: pkg/vegan/R/ordispider.R
===================================================================
--- pkg/vegan/R/ordispider.R 2014-08-28 08:50:50 UTC (rev 2877)
+++ pkg/vegan/R/ordispider.R 2014-09-01 06:59:06 UTC (rev 2878)
@@ -38,8 +38,8 @@
inds <- names(table(groups))
if (label)
cntrs <- names <- NULL
- ## 'kk' removes NA scores
- kk <- complete.cases(pts)
+ ## 'kk' removes NA scores and NA groups
+ kk <- complete.cases(pts) & !is.na(groups)
for (is in inds) {
gr <- out[groups == is & kk]
if (length(gr)) {
Modified: pkg/vegan/inst/ChangeLog
===================================================================
--- pkg/vegan/inst/ChangeLog 2014-08-28 08:50:50 UTC (rev 2877)
+++ pkg/vegan/inst/ChangeLog 2014-09-01 06:59:06 UTC (rev 2878)
@@ -4,6 +4,11 @@
Version 2.1-41 (opened December 12, 2013)
+ * ordiellipse, ordihull, ordispider: can now handle (omit) NA
+ cases in 'groups'. They were able to omit to NA cases in scores,
+ but having NA in 'groups' triggered really cryptic error
+ messages.
+
* adipart, multipart, hiersimu: it is now an error to provide
non-nested sampling hierarchy (used to be a warning).
@@ -159,6 +164,14 @@
sure. Also fixed handling of tied values in assessing the P-values
in vectorfit.
+ * nestednodf: vegan 2.1-36 (release 2.0-10) changed the function
+ so that weighted analysis of binary data was equal to unweighted
+ binary analysis, but this broke consinstency with the original
+ software and publication by Almeida-Neto & Ulrich. The fix was now
+ made optional, and the default is to follow published method by
+ adding argument 'wbinary' (defaults FALSE). Based on the
+ suggestion by Matt Barbour in GitHub.
+
* ordispider: can now use spatial medians as centres instead of
the default centroids. The kind of centre is defined by new
argument 'spiders'.
Modified: pkg/vegan/man/nestedtemp.Rd
===================================================================
--- pkg/vegan/man/nestedtemp.Rd 2014-08-28 08:50:50 UTC (rev 2877)
+++ pkg/vegan/man/nestedtemp.Rd 2014-09-01 06:59:06 UTC (rev 2878)
@@ -24,7 +24,7 @@
nestedn0(comm)
nesteddisc(comm, niter = 200)
nestedtemp(comm, ...)
-nestednodf(comm, order = TRUE, weighted = FALSE)
+nestednodf(comm, order = TRUE, weighted = FALSE, wbinary = FALSE)
nestedbetasor(comm)
nestedbetajac(comm)
\method{plot}{nestedtemp}(x, kind = c("temperature", "incidence"),
@@ -43,6 +43,8 @@
returned accordingly.}
\item{order}{Order rows and columns by frequencies.}
\item{weighted}{Use species abundances as weights of interactions.}
+ \item{wbinary}{Modify original method so that binary data give the same
+ result in weighted and and unweighted analysis. }
\item{\dots}{Other arguments to functions.}
}
@@ -112,7 +114,14 @@
al. 2008). With \code{weighted = TRUE}, the function finds the
weighted version of the index (Almeida-Neto & Ulrich,
2011). However, this requires quantitative null models for adequate
- testing.
+ testing. Almeida-Neto & Ulrich (2011) say that you have positive
+ nestedness if values in the first row/column are higher than in the
+ second. With this condition, weighted analysis of binary data will
+ always give zero nestedness. With argument \code{wbinary = TRUE},
+ equality of rows/colums also indicates nestedness, and binary data
+ will give identical results in weighted and unweighted analysis.
+ However, this can also influence the results of weighted analysis so
+ that the results may differ from Almeida-Neto & Ulrich (2011).
Functions \code{nestedbetasor} and \code{nestedbetajac} find
multiple-site dissimilarities and decompose these into components of
More information about the Vegan-commits
mailing list