[Vegan-commits] r2984 - in pkg/vegan: R inst src
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Mon Jan 11 12:05:00 CET 2016
Author: jarioksa
Date: 2016-01-11 12:04:59 +0100 (Mon, 11 Jan 2016)
New Revision: 2984
Modified:
pkg/vegan/R/metaMDS.R
pkg/vegan/R/specpool.R
pkg/vegan/inst/NEWS.Rd
pkg/vegan/src/monoMDS.f
Log:
Merge branch 'cran-2.3' into r-forge-svn-local
Modified: pkg/vegan/R/metaMDS.R
===================================================================
--- pkg/vegan/R/metaMDS.R 2015-12-03 13:09:29 UTC (rev 2983)
+++ pkg/vegan/R/metaMDS.R 2016-01-11 11:04:59 UTC (rev 2984)
@@ -33,6 +33,8 @@
attr(dis, "method") <- "user supplied"
wascores <- FALSE
} else {
+ if (trace > 2)
+ cat(">>> Calculation of dissimilarities\n")
dis <- metaMDSdist(comm, distance = distance,
autotransform = autotransform,
noshare = noshare, trace = trace,
@@ -40,6 +42,8 @@
}
if (missing(previous.best))
previous.best <- NULL
+ if (trace > 2)
+ cat(">>> NMDS iterations\n")
out <- metaMDSiter(dis, k = k, trymax = trymax, trace = trace,
plot = plot, previous.best = previous.best,
engine = engine, ...)
@@ -47,7 +51,9 @@
## a problem: you may have insufficient data for NMDS
if (out$stress < 1e-3) {
warning("Stress is (nearly) zero - you may have insufficient data")
- }
+ }
+ if (trace > 2)
+ cat(">>> Post-processing NMDS\n")
points <- postMDS(out$points, dis, plot = max(0, plot - 1), ...)
if (is.null(rownames(points)))
rownames(points) <- rownames(comm)
Modified: pkg/vegan/R/specpool.R
===================================================================
--- pkg/vegan/R/specpool.R 2015-12-03 13:09:29 UTC (rev 2983)
+++ pkg/vegan/R/specpool.R 2016-01-11 11:04:59 UTC (rev 2984)
@@ -35,23 +35,26 @@
S[is] <- sum(freq > 0)
if (S[is] == 0)
next
- if (n >= 1)
+ if (n >= 1L)
a1 <- sum(freq == 1)
- if (n >= 2)
+ if (n >= 2L)
a2 <- sum(freq == 2)
- else 0
+ else
+ a2 <- 0
chao[is] <- S[is] + if(!is.na(a2) && a2 > 0)
ssc * a1 * a1/2/a2
else
ssc * a1 * (a1-1)/2
jack.1[is] <- S[is] + a1 * (n - 1)/n
- jack.2[is] <- S[is] + a1 * (2 * n - 3)/n - a2 * (n -
- 2)^2/n/(n - 1)
+ if (n > 1L)
+ jack.2[is] <- S[is] + a1 * (2 * n - 3)/n -
+ a2 * (n - 2)^2/n/(n - 1)
+ else
+ jack.2[is] <- S[is]
bootS[is] <- S[is] + sum((1 - p)^n)
- aa <- if (!is.na(a2) && a2 > 0)
- a1/a2
- else 0
- if (a2 > 0)
+ aa <- if (!is.na(a2) && a2 > 0) a1/a2
+ else 0
+ if (!is.na(a2) && a2 > 0)
var.chao[is] <- a1 * ssc * (0.5 + ssc * (1 + aa/4) * aa) * aa
else
var.chao[is] <-
@@ -61,6 +64,8 @@
0))
var.jack1[is] <- (sum(as.numeric(names(jf))^2 * jf) -
a1/n) * (n - 1)/n
+ } else {
+ var.jack1[is] <- 0
}
pn <- (1 - p)^n
X <- X[, freq > 0, drop = FALSE]
Modified: pkg/vegan/inst/NEWS.Rd
===================================================================
--- pkg/vegan/inst/NEWS.Rd 2015-12-03 13:09:29 UTC (rev 2983)
+++ pkg/vegan/inst/NEWS.Rd 2016-01-11 11:04:59 UTC (rev 2984)
@@ -2,6 +2,60 @@
\title{vegan News}
\encoding{UTF-8}
+\section{Changes in version 2.3-3}{
+ \subsection{BUG FIXES}{
+ \itemize{
+
+ \item \code{metaMDS} and \code{monoMDS} could fail if input
+ dissimilarities were huge: in the reported case they were of
+ magnitude 1E85. Fixes issue
+ \href{https://github.com/vegandevs/vegan/issues/152}{#152} in
+ Github.
+
+ \item Permutations failed if they were defined as \pkg{permute}
+ control structures in \code{estaccum}, \code{ordiareatest},
+ \code{renyiaccum} and \code{tsallisaccum}. Reported by Dan
+ Gafta (Cluj-Napoca) for \code{renyiaccum}.
+
+ \item \code{rarefy} gave false warnings if input was a vector
+ or a single sampling unit.
+
+ \item \code{gdispweight} works when input data are in a matrix
+ instead of a data frame.
+
+ \item Input dissimilarities supplied in symmetric matrices or
+ data frames are more robustly recognized by \code{anosim},
+ \code{bioenv} and \code{mrpp}.
+
+ \item Some extrapolated richness indices in \code{specpool}
+ needed the number of doubletons (= number of species occurring
+ in two sampling units), and these failed when only one sampling
+ unit was supplied. The extrapolated richness cannot be
+ estimated from a single sampling unit, but now such cases are
+ handled smoothly instead of failing: observed non-extrapolated
+ richness with zero standard error will be reported. The issue
+ was reported in
+ \href{http://stackoverflow.com/questions/34027496/error-message-when-using-specpool-in-vegan-package}{StackOverflow}.
+
+ } %itemize
+ } % bug fixes
+
+ \subsection{NEW FEATURES}{
+ \itemize{
+
+ \item \code{treedist} and \code{treedive} refuse to handle
+ trees with reversals, i.e, higher levels are more homogeneous
+ than lower levels. Function \code{treeheight} will estimate
+ their total height with absolute values of branch
+ lengths. Function \code{treedive} refuses to handle trees with
+ negative branch heights indicating negative
+ dissimilarities. Function \code{treedive} is faster.
+
+ } %itemize
+ } %new features
+
+} %v2.3-3
+
\section{Changes in version 2.3-2}{
\subsection{BUG FIXES}{
Modified: pkg/vegan/src/monoMDS.f
===================================================================
--- pkg/vegan/src/monoMDS.f 2015-12-03 13:09:29 UTC (rev 2983)
+++ pkg/vegan/src/monoMDS.f 2016-01-11 11:04:59 UTC (rev 2984)
@@ -10,6 +10,10 @@
C 1.01 April 6, 2011 - added argument STRS(NGRP) to return the stress
C for each of the NGRP groups of dissimilarities
C i.e., from each separate regression.
+C 1.02 January 7, 2016 - fixed bug in MONREG so that huge
+C dissimilarities are correctly handled in
+C creating the initial partition for monotone
+C regression with primary tie treatment.
C
C Written by Dr. Peter R. Minchin
C Department of Biological Sciences
@@ -596,9 +600,9 @@
C
ELSE
FACTR1=4.0**COSAV
- FACTR2=1.6/( (1.0+(MIN(1D0,SRATAV))**5) *
+ FACTR2=1.6/( (1.0+(MIN(1.0,SRATAV))**5) *
. (1.0+ACOSAV-ABS(COSAV)) )
- FACTR3=SQRT(MIN(1D0,SRATIO))
+ FACTR3=SQRT(MIN(1.0,SRATIO))
STEP=STEP*FACTR1*FACTR2*FACTR3
ENDIF
RETURN
@@ -900,7 +904,9 @@
IF (I.LT.N) THEN
DNEXT=DISS(I+1)
ELSE
- DNEXT=DISS(I)+1.0
+C---Bug fix January 7, 2016: correctly handles huge dissimilarities
+C DNEXT=DISS(I)+1.0
+ DNEXT=DISS(I)*2.0
END IF
IF (ABS(DNEXT-DISS(I)).GT.TOLER) THEN
C---NTIE is the number of DISS values in the current group of tied values
More information about the Vegan-commits
mailing list