[Vegan-commits] r2415 - pkg/vegan/tests
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Wed Feb 6 09:18:48 CET 2013
Author: jarioksa
Date: 2013-02-06 09:18:48 +0100 (Wed, 06 Feb 2013)
New Revision: 2415
Modified:
pkg/vegan/tests/vegan-tests.R
pkg/vegan/tests/vegan-tests.Rout.save
Log:
add tests for simulate.rda,cca,capscale
these depend on and use predict functions and serve
as a test for their integrity as well.
Modified: pkg/vegan/tests/vegan-tests.R
===================================================================
--- pkg/vegan/tests/vegan-tests.R 2013-02-05 17:31:21 UTC (rev 2414)
+++ pkg/vegan/tests/vegan-tests.R 2013-02-06 08:18:48 UTC (rev 2415)
@@ -164,3 +164,30 @@
pro$t
rm(x, xp, pro)
### end protest
+
+### Check that functions related to predict.rda work correctly for all
+### constrained ordination methods.
+
+### simulate.rda/cca/capscale: based on predict.* and the following
+### should get back the data
+data(dune, dune.env)
+ind <- seq_len(nrow(dune))
+target <- as.matrix(dune)
+## rda
+mod <- rda(dune ~ Condition(Moisture) + Management + A1, dune.env)
+dat <- simulate(mod, indx = ind)
+all.equal(dat, target, check.attributes = FALSE)
+## cca
+mod <- cca(dune ~ Condition(Moisture) + Management + A1, dune.env)
+dat <- simulate(mod, indx = ind)
+all.equal(dat, target, check.attributes = FALSE)
+## capscale: Euclidean distances -- non-Euclidean distances have an
+## imaginary component and will not give back the data.
+d <- dist(dune)
+mod <- capscale(d ~ Condition(Moisture) + Management + A1, dune.env)
+dat <- simulate(mod, indx = ind)
+all.equal(dat, d, check.attributes = FALSE)
+## clean up
+rm(ind, target, mod, dat, d)
+### end simulate.*
+
Modified: pkg/vegan/tests/vegan-tests.Rout.save
===================================================================
--- pkg/vegan/tests/vegan-tests.Rout.save 2013-02-05 17:31:21 UTC (rev 2414)
+++ pkg/vegan/tests/vegan-tests.Rout.save 2013-02-06 08:18:48 UTC (rev 2415)
@@ -1,5 +1,5 @@
-R Under development (unstable) (2013-01-24 r61741) -- "Unsuffered Consequences"
+R Under development (unstable) (2013-02-05 r61841) -- "Unsuffered Consequences"
Copyright (C) 2013 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: x86_64-unknown-linux-gnu (64-bit)
@@ -547,6 +547,36 @@
> rm(x, xp, pro)
> ### end protest
>
+> ### Check that functions related to predict.rda work correctly for all
+> ### constrained ordination methods.
+>
+> ### simulate.rda/cca/capscale: based on predict.* and the following
+> ### should get back the data
+> data(dune, dune.env)
+> ind <- seq_len(nrow(dune))
+> target <- as.matrix(dune)
+> ## rda
+> mod <- rda(dune ~ Condition(Moisture) + Management + A1, dune.env)
+> dat <- simulate(mod, indx = ind)
+> all.equal(dat, target, check.attributes = FALSE)
+[1] TRUE
+> ## cca
+> mod <- cca(dune ~ Condition(Moisture) + Management + A1, dune.env)
+> dat <- simulate(mod, indx = ind)
+> all.equal(dat, target, check.attributes = FALSE)
+[1] TRUE
+> ## capscale: Euclidean distances -- non-Euclidean distances have an
+> ## imaginary component and will not give back the data.
+> d <- dist(dune)
+> mod <- capscale(d ~ Condition(Moisture) + Management + A1, dune.env)
+> dat <- simulate(mod, indx = ind)
+> all.equal(dat, d, check.attributes = FALSE)
+[1] TRUE
+> ## clean up
+> rm(ind, target, mod, dat, d)
+> ### end simulate.*
+>
+>
> proc.time()
user system elapsed
- 2.892 0.036 2.933
+ 2.912 0.028 2.947
More information about the Vegan-commits
mailing list