[Vegan-commits] r914 - pkg/vegan/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Tue Aug 11 11:39:05 CEST 2009
Author: jarioksa
Date: 2009-08-11 11:39:04 +0200 (Tue, 11 Aug 2009)
New Revision: 914
Modified:
pkg/vegan/R/poolaccum.R
Log:
poolaccum: Chao index works (gives finite estimates) with zero doubletons
Modified: pkg/vegan/R/poolaccum.R
===================================================================
--- pkg/vegan/R/poolaccum.R 2009-08-11 08:35:56 UTC (rev 913)
+++ pkg/vegan/R/poolaccum.R 2009-08-11 09:39:04 UTC (rev 914)
@@ -20,7 +20,7 @@
boot[,i] <- 2*S[,i] - m + rowSums(exp(sweep(log1p(-sweep(tmp, 1, N, "/")), 1, N, "*") ))
a1 <- rowSums(tmp == 1)
a2 <- rowSums(tmp == 2)
- chao[, i] <- S[,i] + a1*a1/2/a2
+ chao[, i] <- S[,i] + ifelse(a2 > 0, a1*a1/2/a2, 0)
jack1[,i] <- S[,i] + a1 * (N-1)/N
jack2[,i] <- S[,i] + a1*(2*N-3)/N - a2*(N-2)^2/N/(N-1)
}
More information about the Vegan-commits
mailing list