[Vegan-commits] r1017 - pkg/vegan/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Mon Sep 21 19:13:36 CEST 2009
Author: jarioksa
Date: 2009-09-21 19:13:36 +0200 (Mon, 21 Sep 2009)
New Revision: 1017
Modified:
pkg/vegan/R/oecosimu.R
Log:
oecosimu: make 'z = 0' when all simulations are constant and sd is zero
Modified: pkg/vegan/R/oecosimu.R
===================================================================
--- pkg/vegan/R/oecosimu.R 2009-09-21 14:15:53 UTC (rev 1016)
+++ pkg/vegan/R/oecosimu.R 2009-09-21 17:13:36 UTC (rev 1017)
@@ -93,8 +93,11 @@
}
}
## end of addition
-
- z <- (indstat - rowMeans(simind))/apply(simind, 1, sd)
+
+ sd <- apply(simind, 1, sd)
+ z <- (indstat - rowMeans(simind))/sd
+ if (any(sd < sqrt(.Machine$double.eps)))
+ z[sd < sqrt(.Machine$double.eps)] <- 0
p <- 2*pmin(rowSums(indstat > simind), rowSums(indstat < simind))
p <- (p + 1)/(nsimul + 1)
More information about the Vegan-commits
mailing list