[Vegan-commits] r839 - in pkg/vegan: R inst man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sat May 30 15:45:12 CEST 2009
Author: jarioksa
Date: 2009-05-30 15:45:11 +0200 (Sat, 30 May 2009)
New Revision: 839
Modified:
pkg/vegan/R/anosim.R
pkg/vegan/R/print.anosim.R
pkg/vegan/inst/ChangeLog
pkg/vegan/man/anosim.Rd
Log:
anosim: test statistic is put among the permutations
Modified: pkg/vegan/R/anosim.R
===================================================================
--- pkg/vegan/R/anosim.R 2009-05-30 10:20:58 UTC (rev 838)
+++ pkg/vegan/R/anosim.R 2009-05-30 13:45:11 UTC (rev 839)
@@ -1,5 +1,5 @@
"anosim" <-
- function (dat, grouping, permutations = 1000,
+ function (dat, grouping, permutations = 999,
distance = "bray", strata)
{
if (inherits(dat, "dist"))
@@ -28,6 +28,8 @@
cl.vec[within] <- levels(grouping)[grouping[take]]
cl.vec <- factor(cl.vec, levels = c("Between", levels(grouping)))
if (permutations) {
+ if (permutations %% 100 == 0)
+ permutations <- permutations - 1
perm <- rep(0, permutations)
for (i in 1:permutations) {
take <- permuted.index(N, strata)
@@ -36,7 +38,7 @@
tmp.ave <- tapply(x.rank, tmp.within, mean)
perm[i] <- -diff(tmp.ave)/div
}
- p.val <- sum(perm >= statistic)/permutations
+ p.val <- (1 + sum(perm >= statistic))/(1 + permutations)
sol$signif <- p.val
sol$perm <- perm
}
Modified: pkg/vegan/R/print.anosim.R
===================================================================
--- pkg/vegan/R/print.anosim.R 2009-05-30 10:20:58 UTC (rev 838)
+++ pkg/vegan/R/print.anosim.R 2009-05-30 13:45:11 UTC (rev 839)
@@ -8,7 +8,7 @@
cat(formatC(x$statistic, digits = digits), "\n")
nperm <- x$permutations
if (nperm) {
- cat(" Significance:", format.pval(x$signif, eps = 1/nperm),
+ cat(" Significance:", format.pval(x$signif),
"\n\n")
cat("Based on ", nperm, " permutations")
}
Modified: pkg/vegan/inst/ChangeLog
===================================================================
--- pkg/vegan/inst/ChangeLog 2009-05-30 10:20:58 UTC (rev 838)
+++ pkg/vegan/inst/ChangeLog 2009-05-30 13:45:11 UTC (rev 839)
@@ -29,6 +29,9 @@
* mantel, mantel.partial: observed value of test statistic is now
considered as one of the permutations.
+ * anosim: observed value of test statistic is now considered as
+ one of the permutatons.
+
Version 1.16-18 (closed May 14, 2009)
* tsallis: got new argument 'hill' similar to that of renyi.
Modified: pkg/vegan/man/anosim.Rd
===================================================================
--- pkg/vegan/man/anosim.Rd 2009-05-30 10:20:58 UTC (rev 838)
+++ pkg/vegan/man/anosim.Rd 2009-05-30 13:45:11 UTC (rev 839)
@@ -11,7 +11,7 @@
of sampling units.
}
\usage{
-anosim(dat, grouping, permutations=1000, distance = "bray", strata)
+anosim(dat, grouping, permutations = 999, distance = "bray", strata)
}
\arguments{
More information about the Vegan-commits
mailing list