[Vegan-commits] r2626 - in pkg/vegan: R inst
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Thu Sep 26 12:27:31 CEST 2013
Author: jarioksa
Date: 2013-09-26 12:27:31 +0200 (Thu, 26 Sep 2013)
New Revision: 2626
Modified:
pkg/vegan/R/nestednodf.R
pkg/vegan/inst/ChangeLog
Log:
nestednodf(..., weighted=TRUE) gave wrong fill and was inconsistent if data were binary
Modified: pkg/vegan/R/nestednodf.R
===================================================================
--- pkg/vegan/R/nestednodf.R 2013-09-26 10:11:52 UTC (rev 2625)
+++ pkg/vegan/R/nestednodf.R 2013-09-26 10:27:31 UTC (rev 2626)
@@ -22,7 +22,7 @@
}
nr <- NROW(comm)
nc <- NCOL(comm)
- fill <- sum(rfill)/length(comm)
+ fill <- sum(rfill)/prod(dim(comm))
N.paired.rows <- numeric(nr * (nr - 1)/2)
N.paired.cols <- numeric(nc * (nc - 1)/2)
counter <- 0
@@ -35,7 +35,7 @@
if (weighted) {
second <- comm[j, ]
N.paired.rows[counter] <-
- sum(first - second > 0 & second > 0)/sum(second > 0)
+ sum(first - second >= 0 & second > 0)/sum(second > 0)
}
else {
N.paired.rows[counter] <-
@@ -53,7 +53,7 @@
if (weighted) {
second <- comm[, j]
N.paired.cols[counter] <-
- sum(first - second > 0 & second > 0)/sum(second > 0)
+ sum(first - second >= 0 & second > 0)/sum(second > 0)
}
else {
N.paired.cols[counter] <-
Modified: pkg/vegan/inst/ChangeLog
===================================================================
--- pkg/vegan/inst/ChangeLog 2013-09-26 10:11:52 UTC (rev 2625)
+++ pkg/vegan/inst/ChangeLog 2013-09-26 10:27:31 UTC (rev 2626)
@@ -6,6 +6,20 @@
* opened with the release of vegan 2.0-9.
+ * nestednodf: matrix fill was wrongly calculated in weighted
+ analysis. The nominator was length of 'comm', and if input was a
+ data frame that was the number of columns instead of the number of
+ cells. The fill was correct in non-weighted analysis because there
+ data were transformed to a matrix, and the length of a matrix is
+ the number of cells (unlike in data frames).
+
+ * nestednodf: weighted analysis gave all statistics as zero if
+ binary data were supplied. Some ">" comparisons were changed to
+ ">=" and now weighted analysis of binary data gives same results
+ as non-weighted analysis. However, this can change results of
+ weighted analysis of quantitative data. The change needs
+ endorsement by the function author Gustavo Carvalho.
+
* oecosimu: warns user if the specified nullmodel 'method' changes
quantitative input data to binary data under cover. Some people
have not noticed this.
More information about the Vegan-commits
mailing list