[med-svn] [SCM] vegan branch, master, updated. debian/2.0-3-1-10-g049dcc3
Charles Plessy
plessy at debian.org
Thu Apr 4 05:44:26 UTC 2013
The following commit has been merged in the master branch:
commit c52b80dd4a0b29d54bfce9b46a5527173e650640
Author: Charles Plessy <plessy at debian.org>
Date: Thu Apr 4 14:41:42 2013 +0900
Imported Upstream version 2.0-4
diff --git a/DESCRIPTION b/DESCRIPTION
index 5e26444..05aa2dd 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -1,7 +1,7 @@
Package: vegan
Title: Community Ecology Package
-Version: 2.0-3
-Date: November 13, 2011
+Version: 2.0-4
+Date: June 18, 2012
Author: Jari Oksanen, F. Guillaume Blanchet, Roeland Kindt, Pierre
Legendre, Peter R. Minchin, R. B. O'Hara, Gavin L. Simpson,
Peter Solymos, M. Henry H. Stevens, Helene Wagner
@@ -13,6 +13,6 @@ Description: Ordination methods, diversity analysis and other functions
for community and vegetation ecologists.
License: GPL-2
URL: http://cran.r-project.org, http://vegan.r-forge.r-project.org/
-Packaged: 2012-03-03 14:58:34 UTC; jarioksa
+Packaged: 2012-06-18 10:55:31 UTC; jarioksa
Repository: CRAN
-Date/Publication: 2012-03-03 15:54:48
+Date/Publication: 2012-06-19 09:32:41
diff --git a/MD5 b/MD5
index bc83aaa..73a69e4 100644
--- a/MD5
+++ b/MD5
@@ -1,5 +1,5 @@
-bf4d4c62bd940fc718718c6069918504 *DESCRIPTION
-41b083e83ac861a4a9f0bd48c125adfd *NAMESPACE
+12748bc3d050f5cc3e9705f885fec6dd *DESCRIPTION
+b06b62a7c78c5d4ec84b2f567fd8e465 *NAMESPACE
0f88ae5115f589efd416613a823cbb3f *R/AIC.radfit.R
5c5fdbcdc2a38e2cbafdb8f2c5eb2e08 *R/CCorA.R
6592cf7dc692f87b4a147eb625e18624 *R/MDSrotate.R
@@ -12,7 +12,9 @@ e4754677764163b028ce3237d9b4a11b *R/SSlomolino.R
d80688d78aba3cd9367ffaaaec6ec252 *R/TukeyHSD.betadisper.R
a7e4a96ac08502dc4cd7023d0510e94f *R/add1.cca.R
bc63dc46c564df2dea69d90f25e52ba3 *R/ade2vegancca.R
-3d838e755252eb897083a7246242dc2c *R/adipart.R
+3fea698281bc0b4c3a5ad26f4d44d0e2 *R/adipart.R
+3018034f2134aef536ee9a5ef6b50a06 *R/adipart.default.R
+a71174cb8825cf6ed74612bc7cd41fcc *R/adipart.formula.R
e71c569aecb494fdf872bbebe65276f9 *R/adonis.R
38726b7dad817378b3fc41094c11595a *R/alias.cca.R
fa03b3668c0435eebc778b9def908be9 *R/anosim.R
@@ -22,7 +24,7 @@ a3767eb78bd5d62341ff198fbf65d1b1 *R/anova.cca.R
350cc1a6e930a195c80b5c7aef0d9b7e *R/anova.ccabymargin.R
42491e7011d7ae79ea2a8db2086768f9 *R/anova.ccabyterm.R
97cbe54d0f4f7adee7a20b6c982d1ecf *R/anova.ccanull.R
-9c9b67fa121a01d8124982270ef26994 *R/anova.prc.R
+7fab08bcc596df60a22c4b04c8507121 *R/anova.prc.R
6fb2bf929aed44ef41bfd4dfc6e010cc *R/as.fisher.R
eee49f0fce625a3b8266b82f05c86aac *R/as.mcmc.oecosimu.R
cfaa7dc7d3f45c29e59e83326f1371d4 *R/as.mcmc.permat.R
@@ -34,11 +36,11 @@ a7f01bd69394d5554cf10279a2690080 *R/as.preston.R
124345e75a121a5d750d1b306156614a *R/as.ts.oecosimu.R
251aa91b87e2f964f24fe61791eedac9 *R/as.ts.permat.R
fbec6d133dea10372ce082c7035a8ab2 *R/beals.R
-b6c105ed2f26849d46622bd0a51d89a1 *R/betadisper.R
+36d76d3619d9effc5819e907a45d7476 *R/betadisper.R
92d22ad6b8870005ed86940cd90f2077 *R/betadiver.R
46ae3f75a0b483fecab589637d72a307 *R/bgdispersal.R
4603ea944d470a9e284cb6cab6d75529 *R/bioenv.R
-44c71d93c0fdb07bb4e6dabb86234c69 *R/bioenv.default.R
+4018f8ddbc314125dbd17d44f710147e *R/bioenv.default.R
82a17642aae8182c9345a03a846a853c *R/bioenv.formula.R
875d40515bf55ee65dc7fcdefb9f52d1 *R/biplot.CCorA.R
329ff7c5c96cbfe243b933a748af979c *R/biplot.rda.R
@@ -59,8 +61,9 @@ bbff0e97ac052b1742a0e4ba082bac68 *R/cascadeKM.R
2e09a82ec52e211afc2ac6e8d4b40898 *R/cca.R
22fd69d812ee7dbaf9b23d6774ab0883 *R/cca.default.R
e01e3acecdb9ac8d9195937e9879d126 *R/cca.formula.R
-7078bd9cff99707edafde89349d99ab5 *R/centroids.cca.R
-634910db19eccfddf645677279b772d5 *R/clamtest.R
+6102056b628e02085c3bfe779a67c633 *R/centroids.cca.R
+c66d8fbe69ccca94f2ee8f777ff16ae2 *R/checkSelect.R
+6c516cbb81d76ad6c22175809211eec4 *R/clamtest.R
365fa22c822e835218740e858d256526 *R/coef.cca.R
3a7297a8e2b2858f3b776a35689e5eca *R/coef.radfit.R
ea10763445cb76b219d18bb274109df5 *R/coef.rda.R
@@ -109,7 +112,9 @@ c3bc6f9771503a4b93f4dce3096fd874 *R/goodness.cca.R
7af5f06020065621d8466decb16e0aa4 *R/goodness.metaMDS.R
3676ae4dd5c789334fb822a8caa81979 *R/goodness.rda.R
8a767726c40223a58d4055759bf41efe *R/head.summary.cca.R
-49a897504538b35d7d691034e388cb1a *R/hiersimu.R
+3d19236ee5dd2f1c678061773895e86f *R/hiersimu.R
+14cebf89aebdc5c9b4c910dee6417487 *R/hiersimu.default.R
+9cc65f22f3489d18c27fc07df9f32337 *R/hiersimu.formula.R
d02fc9c672a9b2c4a31065702a3381be *R/humpfit.R
1637bd10b39801c14b65656f29dafcf1 *R/identify.ordiplot.R
ba2579e418e11343a471548b2f2bc44a *R/indpower.R
@@ -132,17 +137,19 @@ e0f782c5a0cb558189b5b15a5bea072f *R/linestack.R
fdb2f4786b31866197c80d827584edaf *R/mantel.correlog.R
3109021e5461bac44124343acfd3ec81 *R/mantel.partial.R
e054f13ad65a7f2616561c73557b412b *R/meandist.R
-7333159388899baa209f823e91f084e3 *R/metaMDS.R
+57cb748570098b7e5a5aedbddb39fb84 *R/metaMDS.R
26b26e400ead4cf3de31d7eab29c6984 *R/metaMDSdist.R
e0ae9ef92dbe17d6a919913190311048 *R/metaMDSiter.R
f63315501ad2f3a96dee9ee27a867131 *R/metaMDSredist.R
928df675822d321e4533ba2b7cf0c79f *R/model.frame.cca.R
9406148bd2cfa3e74b83adfe24858c46 *R/model.matrix.cca.R
-9692174b8ce0b517a67198eed0ea973c *R/monoMDS.R
+6d2cb1f0c26e7082477f0067701beed4 *R/monoMDS.R
beae6832197823e4ade3569c021b1693 *R/mrpp.R
0c8ef224eeeb965c8b60bb63d5adf10e *R/mso.R
-c98ea22fa5283333c7b6b9f6e1c0923e *R/msoplot.R
-4ff67a54af049a2b04a106c119d9d7e9 *R/multipart.R
+0595a503a1542927040f1b643e85d9a2 *R/msoplot.R
+7c219818ce5841e957db47f16986080b *R/multipart.R
+569dd4c9ebbe2ab60d33ff3e4e4bda38 *R/multipart.default.R
+dde94f190e182c04ffa012e3a2ba38cd *R/multipart.formula.R
f5e79cb1c2dc1fcabb6e6b5cb4dc0828 *R/nestedbetasor.R
85d4744650c1e2a0edf16809b77f7ab4 *R/nestedchecker.R
c15884dd28790c7521ecb33175c86e5c *R/nesteddisc.R
@@ -163,15 +170,15 @@ e179219789c19417082b3c8b220f13e4 *R/ordiR2step.R
e06d56a6e7d47767b9e71a73cbd3a80b *R/ordiarrows.R
76020bb8174d580dd0f4866df2172339 *R/ordicloud.R
793f91b9bf7c35f335949121d6f317c9 *R/ordicluster.R
-b11499414d6ef3ac8cff7021c3e591ef *R/ordiellipse.R
+7160bf241bdbe59c1145160435b274ae *R/ordiellipse.R
c253906529c77aead16b293275f1afc3 *R/ordigrid.R
-269694dd239e85c370f5d76511aaea4c *R/ordihull.R
-56f59a26d0cdec13a074fcf2e97b3837 *R/ordilabel.R
+9ca9cd415622e47453a06897e2fde751 *R/ordihull.R
+91a30c47b3cd009d2f36acbef3f30632 *R/ordilabel.R
20a6f500c31e6640de535f0730b69a55 *R/ordilattice.getEnvfit.R
c805e6801ef30758b9f7718269cabdfc *R/ordimedian.R
55d2f18681d065ea6dd29e0f1e64772e *R/ordiplot.R
-7d7d165fc1774e8e6c724d44e04bcce7 *R/ordiplot3d.R
-7c18c2f5cd25000767e7bd3d8ff8f36b *R/ordipointlabel.R
+58a7e6f3453b1d95e1984c392577d4a8 *R/ordiplot3d.R
+fc7bc36cc7cf7f4280f071c831a8a6a6 *R/ordipointlabel.R
9d2a860c9143446f950755327af2f7ce *R/ordiresids.R
601554e97800197af1bc50993406d9ef *R/ordirgl.R
41949d4c859f08bc5a978791d387d1a4 *R/ordisegments.R
@@ -206,7 +213,7 @@ d6efc684c3506870243a337fadd85ed8 *R/plot.cca.R
38ccde16c9eb9028219d27f14d343b3e *R/plot.clamtest.R
8c043a9b7262c33ec2054045cdaa1811 *R/plot.contribdiv.R
0ab3b62ac155ede193867f43640dbd34 *R/plot.decorana.R
-f0692f86c83728eb003d2c89f4793405 *R/plot.envfit.R
+0b0701c8bdeb6695a75503b6c0e93466 *R/plot.envfit.R
10bf121300b684a8173f680de54f452a *R/plot.fisherfit.R
9a4f1746e6e5b80b48994f404e72eb74 *R/plot.humpfit.R
ed258eefbe3facce3533a16395217fab *R/plot.isomap.R
@@ -218,7 +225,7 @@ fdfbb536547823f1c25bcf756c33d19d *R/plot.ordisurf.R
da30b6ae5fd0e30543f18064cf19b54a *R/plot.orditkplot.R
7e136913597f9f78ac069be6a5a3f465 *R/plot.permat.R
90fd0b03484169b406eeac09c33cb75e *R/plot.poolaccum.R
-2b2a91e13330e5d3bc16bab258461b96 *R/plot.prc.R
+fdc1beae72f52a43883861a8b56bf289 *R/plot.prc.R
6cd9c1a91d03a8afb8f9148f0d369cad *R/plot.preston.R
31b95161a7558e111e3c01778b9d17db *R/plot.prestonfit.R
11d54a7950f3e00548eb8c32f4f5be98 *R/plot.procrustes.R
@@ -234,18 +241,18 @@ e449c6ef786f8802c9806b51248b66cc *R/plot.specaccum.R
abc96c8853871035d494dfa9086d4d6e *R/plot.taxondive.R
6104fadf391072e78a8f2825ac41ceb2 *R/plot.varpart.R
00d109fe7fc29440698b9f1a4bbc876f *R/plot.varpart234.R
-82ab63d55601419edb5a7acd369aa4fd *R/points.cca.R
-6cf0edcd409b18f6125302db78d8bee4 *R/points.decorana.R
+4c6a8925c0eef5a61483ab0825b4e870 *R/points.cca.R
+3fbe4782d2c376d98f23db8890c42b3b *R/points.decorana.R
b5661457c540b56e77eba97b8b290a91 *R/points.humpfit.R
-7f171e0b57d0406a163de38138ef08e7 *R/points.metaMDS.R
-6ed251a41447383eaa0d411654c7a398 *R/points.ordiplot.R
+a0e1e2d579fa8c1992a26a2e8d435750 *R/points.metaMDS.R
+a54bcddf1b7a44ee1f86ae4eaccb7179 *R/points.ordiplot.R
e352171f478eb27cf4a875cc3a1693fc *R/points.orditkplot.R
7409704e2e94cd051524e8c5af3bdcb4 *R/points.procrustes.R
d76776427a3f064c91b4c1c14da0d96b *R/points.radline.R
b4fbbb0786258e1e83c4262e0db2aa43 *R/poolaccum.R
91aa7fd2fbd99f8e325932d59886dac7 *R/postMDS.R
f9dcd972e5c81ce936c9ec5b296d484c *R/prc.R
-77b758705d20c2e3f5bd655a3e05dfca *R/predict.cca.R
+16ab904d42612ca4009a99bb66255233 *R/predict.cca.R
049f41cca1b39bf0a221723855cffcff *R/predict.decorana.R
e9107f2a97c429ff8e45c62a3671c281 *R/predict.fitspecaccum.R
06cca728e43d29da2528b01dccb26962 *R/predict.humpfit.R
@@ -257,7 +264,7 @@ eb223fbfded71ae4f0b374c1e92c3f2e *R/predict.specaccum.R
7db2fd99abc08bf5e1341e5b74fb4617 *R/prestonfit.R
953d32321b6e12a30209a8cda78244c9 *R/print.CCorA.R
3a1584c7d991683a61271fb2fc002b73 *R/print.MOStest.R
-1f1b32133f7608f3fa69b42678034c17 *R/print.adipart.R
+a70e6320123f0206b106483e01fffac4 *R/print.adipart.R
1e07dd6a9eefb1d0af31a4db98c94305 *R/print.adonis.R
15b31674cb74df69467902853a9254d1 *R/print.anosim.R
7c99a949e155f76c3a223741afb39836 *R/print.betadisper.R
@@ -273,7 +280,7 @@ aa617465dd91f58e0281c19e9ee5ce40 *R/print.hiersimu.R
b31dbaa6493fdda1f865f95b3e889aab *R/print.isomap.R
7965811709121f361245c75e4932b434 *R/print.mantel.R
f92fd82d10ce91e2cba2239e756e1332 *R/print.mantel.correlog.R
-6f3ceb9dd5fea3a490f25c27be74209a *R/print.metaMDS.R
+9d6b6102e251f155c0b9af98d37a5f49 *R/print.metaMDS.R
7e9b861d872cad8928c5ccfa4de01fa3 *R/print.monoMDS.R
8bd5bbb931a97ddada79e4552bd614b8 *R/print.mrpp.R
946b3b708190211e9eb1acc94ffa102d *R/print.mso.R
@@ -338,7 +345,7 @@ ef65ea5fb624aef7e34284d932503876 *R/renyi.R
38df11064481bc21f8555152cfd3d115 *R/residuals.procrustes.R
4ee8534c438c824f1cf4ea62337e259d *R/rgl.isomap.R
9134d94e86e79778b460a4e522fd7c04 *R/rgl.renyiaccum.R
-1960f256009ad81b5c825663d7753599 *R/rrarefy.R
+4ffd3879dcf18d0bdef8ffc8bf5b8ad3 *R/rrarefy.R
ed66f1e11f53f7fbdbd8663de2b7f5dd *R/scores.R
d46cc2163dbc117a978f64d54df7bbd4 *R/scores.betadisper.R
341ee43f8524dccb5e369513a16923b1 *R/scores.betadiver.R
@@ -358,7 +365,7 @@ f146575a3f60358567dfed56e8cbb2cd *R/scores.ordiplot.R
3fe910b739d447ba5026f077cb0c670d *R/screeplot.prcomp.R
66d8c6dfecb51ca1afdf309926c00d08 *R/screeplot.princomp.R
95f15a952493d1965e59006be7f0b8d1 *R/showvarparts.R
-50d157f7d389ee330c7bc1f72f39dc28 *R/simper.R
+d634237d94bc2d40dd8e5f2170c49353 *R/simper.R
b35ee7d9cdc86eecefb5dcf478fc8abf *R/simpleRDA2.R
73367e17a66ffeca6410771f0ca8d1ef *R/simulate.rda.R
9f235c650efc4217a3cc88996b627e1d *R/spandepth.R
@@ -390,10 +397,10 @@ a8c1bf3d3f371f3ee5a3de3c39a4113a *R/summary.procrustes.R
7c55757d8187363116d3561d53cbc5ba *R/swan.R
62bc8a0693a71adb1457b0a102d8951a *R/taxa2dist.R
90ec6192eb43f8fd29bc93485f4ef293 *R/taxondive.R
-5d8939e1dcad7d0c5d05dbf33776419a *R/text.cca.R
-39a50300ba07378fe760766e4fb4d2e2 *R/text.decorana.R
-4ed613e4dbc286c10ffee107ed5bbe1c *R/text.metaMDS.R
-2334363d7f81cb95af1b30cb819cce52 *R/text.ordiplot.R
+502b11cc8435f7a3d6e35326c1375ea6 *R/text.cca.R
+1f4d9ba97695c0fa99456f427114b049 *R/text.decorana.R
+6a6e426f6e464bb7bdaa75d92674562c *R/text.metaMDS.R
+974bdc93cd9b352d30debf3e93111136 *R/text.ordiplot.R
846003f5f9de23241805042ac459ed1d *R/text.orditkplot.R
0fc7a75cf414d76cc751cc33ed5d6384 *R/tolerance.R
207fe2c0d2f5da03f65e287f93ea2d15 *R/tolerance.cca.R
@@ -434,22 +441,22 @@ c51905bd025ccea2737527b6fca4a081 *data/mite.pcnm.rda
ee3c343418d7cf2e435028adf93205f1 *data/sipoo.rda
f87df84297865b5faf31e232e97a0f94 *data/varechem.rda
82153b3e47807b926b77cef49900f422 *data/varespec.rda
-844b87019c6e39e9503b3d4a13a94925 *inst/ChangeLog
-cc13af92c07919615ba5bf0704c110ea *inst/NEWS.Rd
+fe89ca7a45cf17172c295e0637c45915 *inst/ChangeLog
+c1072e0d722947cb1f14848474f8a497 *inst/NEWS.Rd
9abfab8b05c34dd283379a7d87500ffb *inst/ONEWS
-80310d18d3b7ce449b513d1f9f1725ee *inst/doc/FAQ-vegan.pdf
-57f7576f4e7a0a9aa93fd789cd27500f *inst/doc/FAQ-vegan.texi
+2bf5f9d0d6a982272e2f6a7a154b159b *inst/doc/FAQ-vegan.pdf
+106b655f1410bb42eb5cb46b733451ec *inst/doc/FAQ-vegan.texi
57c45e7d2bd1713cf12ab2b2bd20e0a4 *inst/doc/Makefile
-cb55054a3225fc5f4bd8749ec7b699fd *inst/doc/NEWS.html
-4aab109224c0e0f6129e81a551b8bfbb *inst/doc/decision-vegan.Rnw
-c1ce5b4a56d047de23c31f4a909a29c7 *inst/doc/decision-vegan.pdf
-06f59c3695ce60534cc632ca0ace35a7 *inst/doc/decision-vegan.tex
+3c900692f99137362b10da3e15785d6b *inst/doc/NEWS.html
+bfad8283cb33e6e2837f62360671a014 *inst/doc/decision-vegan.Rnw
+6f974abe20a7b03315e5ff97db7bd6bf *inst/doc/decision-vegan.pdf
+96080f151551fe55e0fede9277229056 *inst/doc/decision-vegan.tex
68b9e795bdeba8df6da627413bce041c *inst/doc/diversity-vegan.Rnw
-a13a7acdc56962166efe6360e0fea883 *inst/doc/diversity-vegan.pdf
-d2ff8dadfb7bc65dda7ab79cda9eab0f *inst/doc/diversity-vegan.tex
-da1e04e30a60541c2ff1dc6ec5ed7d88 *inst/doc/intro-vegan.Rnw
-53cc4898f9d0dfdf13435bcc2116aec6 *inst/doc/intro-vegan.pdf
-c0eec5bffefc3d9913fc01de9b936cec *inst/doc/intro-vegan.tex
+9b5980940f30caf9f03ee02f5d91d9b2 *inst/doc/diversity-vegan.pdf
+70b04c5745010d664b334bb08a74bdb5 *inst/doc/diversity-vegan.tex
+387e8ebdd98b55308b7d8e833a2c9c2a *inst/doc/intro-vegan.Rnw
+4da9c9eac1ef9715b588a3abfe8b93f4 *inst/doc/intro-vegan.pdf
+d402b6d714e9c382053ffae26ed8b5cb *inst/doc/intro-vegan.tex
a1c35ea488b715441cd2269eb6998945 *inst/doc/partitioning.pdf
bafe698f5c543e20d4c52659545677bf *inst/doc/vegan.bib
8790e1afcfbf88c374d6c87928eab54f *inst/doc/veganjss.sty
@@ -460,16 +467,16 @@ fd218be03aa2591e5123d11780ccba1a *man/MOStest.Rd
0c2b91d47a27d3eca28c1937172ad025 *man/RsquareAdj.Rd
eb6df0e2eba46d2bbdc056baff276481 *man/SSarrhenius.Rd
52e5b417de274fcc3415c4a24ebfd167 *man/add1.cca.Rd
-b64208f06b6de9d10f9099198d1acb31 *man/adipart.Rd
-b96fecf37ad6f14e30061d69e8658eb1 *man/adonis.Rd
-af60b65c99acf41aa191fc0ebcc94b3c *man/anosim.Rd
-a71882b256b97e14cf9b5bec3cdebd7f *man/anova.cca.Rd
+40859386dd6bcf4f534086eb5af441be *man/adipart.Rd
+59a0c8a693e78a8bbfc697dc7e7c659e *man/adonis.Rd
+e53842f5c91b0d5a6405018455c054b9 *man/anosim.Rd
+4455b3a62d0afced71232987ce954345 *man/anova.cca.Rd
c57af27fa11dadcd48981fcf42b2d221 *man/as.mlm.Rd
c1fec65743ee33818457d6a8512f899b *man/beals.Rd
-5057574e6ccd08f9777fce8973ce307c *man/betadisper.Rd
+b2067f585b93a5402e5e03e551f3974e *man/betadisper.Rd
43d3d85bd4fb2968397cc8284dc28c9b *man/betadiver.Rd
050375e9a158a5c1d01118dacb89553e *man/bgdispersal.Rd
-2b377956d4c31ec5cc26350986b0d7c7 *man/bioenv.Rd
+d70c076364daf2d719df7a8d30603d2d *man/bioenv.Rd
1eab4a6369fa1d203a4a3f41f4ee4c06 *man/biplot.rda.Rd
b9c71f79ddf9ef942e4d66ea50077aae *man/capscale.Rd
5bf9340fd1b1fe55841ceb14ceb47134 *man/cascadeKM.Rd
@@ -478,7 +485,7 @@ b9c71f79ddf9ef942e4d66ea50077aae *man/capscale.Rd
0c376bfe24a62389460c7fa7d5d78b90 *man/clamtest.Rd
335d0f7691ad9d0c48fffce9f9db6201 *man/contribdiv.Rd
c41033fb9c572365490cc23b9870c950 *man/decorana.Rd
-07460bce856b9824ff8fbb590a8962cc *man/decostand.Rd
+47583461eb570b83ad1944b97668fad2 *man/decostand.Rd
a62d730c922e7d476d45e8f21178f1b3 *man/designdist.Rd
c01e0664652fbc8ef4963059bee4e422 *man/deviance.cca.Rd
fa5821f3d5077efdf01f78f68bcaec83 *man/dispindmorisita.Rd
@@ -487,7 +494,7 @@ b9e1c696647b4029f944e830184eb2c9 *man/diversity.Rd
31a227bd7e2dd4cf92c9b936e1f49963 *man/dune.Rd
5bdeafda9c2d62feec3bde6b4cd49e3b *man/dune.taxon.Rd
5f5f8c7df063606ccde6124c5dbe8add *man/eigenvals.Rd
-da397f9aadd4a7cffdbba240bbf1d1a1 *man/envfit.Rd
+44da1163984ac12972ba0eb90aa50322 *man/envfit.Rd
919976c144bda3a083af284255ea3695 *man/eventstar.Rd
49360011c9efdee6d23c31bdc13e7061 *man/fisherfit.Rd
841b3f32510ed2c3f64186d623f858ae *man/goodness.cca.Rd
@@ -500,22 +507,22 @@ e473a6d2589993b85fc1176866fdde78 *man/linestack.Rd
ecf0c9cbdf26bbadec0c055e618e94a6 *man/make.cepnames.Rd
b2dea662ac33f79c7feed561c3e7ba5a *man/mantel.Rd
9605f23ced71ce53c3a6a02c13e9a8af *man/mantel.correlog.Rd
-f91c59b8491675c54b60a210482ecd52 *man/metaMDS.Rd
+b8e7bb396124a40a0a9d6cca683139e2 *man/metaMDS.Rd
4cfb02239809fa03b28e10ec8e8c9c6b *man/mite.Rd
0d0876437491b3701e4d20cbbf0d1b6f *man/model.matrix.cca.Rd
-6ecab9652c7320762d822fcdbe67a8da *man/monoMDS.Rd
-4a90700c377935552327c2e29a73aae5 *man/mrpp.Rd
-1b19ebd543a2b1c26faa737d68442fdb *man/mso.Rd
-6a14a3f0e24a55d609ff4c06e4a2cfeb *man/multipart.Rd
+54d0363b992caac0546642cd5c6d3f7b *man/monoMDS.Rd
+6c99ed635bd1c164710db16ded9e4402 *man/mrpp.Rd
+99129fa5cefe7d1a83ca04f32f0a91ba *man/mso.Rd
+0b83da5291da2f3ee0fd387ef2bbca6f *man/multipart.Rd
17b0186a4e98a2fe6b66d9f56ad3f958 *man/nestedtemp.Rd
2907c7465be1247d2ed930025b877403 *man/nobs.adonis.Rd
ba28e7e71d0637fd962d53d1e23488c0 *man/oecosimu.Rd
3e6f6e4c473e4ea91c18d34bf487ff0c *man/ordiarrows.Rd
-71571e6b14ee7491a4bf37719a8eb797 *man/ordihull.Rd
+03aab4cb7ca71141281d2abd3e810231 *man/ordihull.Rd
8f8a34c5fcfcc1fe9f88ca16e84a1da6 *man/ordilabel.Rd
994cfc973f88c682b741e48377e1b9b4 *man/ordiplot.Rd
-a2045a0a63bd573a4ca231d9a74114b5 *man/ordiplot3d.Rd
-cca1916f3682c81cb29a90e036111209 *man/ordipointlabel.Rd
+10e145cf5d658345925da8536e2afb63 *man/ordiplot3d.Rd
+ca2ed47e3adb6f4ab9aa861872b07e4b *man/ordipointlabel.Rd
d4d27a34b2e7d9d1b732a0d06cb9d9f4 *man/ordiresids.Rd
9bd611f72fad857e16a10f46f8f80e86 *man/ordistep.Rd
1a3cb1337bb8ce725d62c4cb530a2f02 *man/ordisurf.Rd
@@ -528,9 +535,9 @@ d971701b3c6f89b3a6b358a3966a43d2 *man/ordixyplot.Rd
fb24c58ca61caf767ced5bd79dbff57e *man/permutest.betadisper.Rd
a8862a670b6894fc38bbb2ade4c85e23 *man/plot.cca.Rd
9f296f0830397598ee4849fc006762d1 *man/prc.Rd
-ebb4ec93cb068be7674124121a131c70 *man/predict.cca.Rd
+f72046fbb4bfbcbc13b60d4288f3e16c *man/predict.cca.Rd
e0fcf2ebc4cfbad289fbc9d6dc4b74d2 *man/procrustes.Rd
-d851ec8bb25a840b3a1278c1db725810 *man/pyrifos.Rd
+01a6ca946df5ad493adfb54003ad8e00 *man/pyrifos.Rd
b8768707b4d121b6c4ea9feca9f472ce *man/radfit.Rd
3e70bfa0a8ae5d4c3c60dba77500b584 *man/rankindex.Rd
aa050f298d26952caa4343b8cfb3ef03 *man/raupcrick.Rd
@@ -538,7 +545,7 @@ aa050f298d26952caa4343b8cfb3ef03 *man/raupcrick.Rd
c1ffd9ca78ad968e1da11fdba007cbe8 *man/renyi.Rd
5c25a88ca55fabce5783509c706faad5 *man/scores.Rd
ce3aa1e8e15c5f95a345fc822630767b *man/screeplot.cca.Rd
-07c21f26832826e4fc76ba0699be90bb *man/simper.Rd
+947c357c856ef350340eb54673c0bc5c *man/simper.Rd
45cd418b2264b4eb6abc89cc11a7877f *man/simulate.rda.Rd
b34910fa6ed6c9bfbd90a7f7443a135f *man/sipoo.Rd
d7dd63e022633049766cffdaf6cac723 *man/spantree.Rd
diff --git a/NAMESPACE b/NAMESPACE
index 802510b..7595e66 100644
--- a/NAMESPACE
+++ b/NAMESPACE
@@ -68,6 +68,9 @@ importFrom(lattice, densityplot)
if (getRversion() < "2.13.0") {
importFrom(permute, nobs)
}
+# adipart: vegan
+S3method(adipart, default)
+S3method(adipart, formula)
# AIC: stats
S3method(AIC, radfit)
# RsquareAdj: vegan
@@ -168,6 +171,9 @@ S3method(goodness, monoMDS)
S3method(goodness, rda)
# head: utils
S3method(head, summary.cca)
+# hiersimu: vegan
+S3method(hiersimu, default)
+S3method(hiersimu, formula)
# identify: graphics
S3method(identify, ordiplot)
# lines: graphics
@@ -181,6 +187,9 @@ S3method(lines, spantree)
# model.frame, model.matrix: stats
S3method(model.frame, cca)
S3method(model.matrix, cca)
+# multipart: vegan
+S3method(multipart, default)
+S3method(multipart, formula)
# nobs: stats
S3method(nobs, CCorA)
S3method(nobs, adonis)
diff --git a/R/adipart.R b/R/adipart.R
index e11835c..8e8adcc 100644
--- a/R/adipart.R
+++ b/R/adipart.R
@@ -1,113 +1,6 @@
adipart <-
-function(formula, data, index=c("richness", "shannon", "simpson"),
- weights=c("unif", "prop"), relative = FALSE, nsimul=99, ...)
+function (...)
{
- ## evaluate formula
- lhs <- formula[[2]]
- if (missing(data))
- data <- parent.frame()
- lhs <- as.matrix(eval(lhs, data))
- formula[[2]] <- NULL
- rhs <- model.frame(formula, data, drop.unused.levels = TRUE)
- tlab <- attr(attr(rhs, "terms"), "term.labels")
- nlevs <- length(tlab)
- if (nlevs < 2)
- stop("provide at least two level hierarchy")
- if (any(rowSums(lhs) == 0))
- stop("data matrix contains empty rows")
- if (any(lhs < 0))
- stop("data matrix contains negative entries")
-
- ## part check proper design of the model frame
- noint <- attr(attr(attr(rhs, "terms"), "factors"), "dimnames")[[1]]
- int <- attr(attr(attr(rhs, "terms"), "factors"), "dimnames")[[2]]
- if (!identical(noint, int))
- stop("interactions are not allowed in formula")
- if (!all(attr(attr(rhs, "terms"), "dataClasses") == "factor"))
- stop("all right hand side variables in formula must be factors")
- l1 <- sapply(rhs, function(z) length(unique(z)))
- if (!any(sapply(2:nlevs, function(z) l1[z] <= l1[z-1])))
- stop("number of levels are inapropriate, check sequence")
- rval <- list()
- rval[[1]] <- as.factor(rhs[,nlevs])
- rval[[1]] <- rval[[1]][drop = TRUE]
- nCol <- nlevs - 1
- for (i in 2:nlevs) {
- rval[[i]] <- interaction(rhs[,nCol], rval[[(i-1)]], drop=TRUE)
- nCol <- nCol - 1
- }
- rval <- as.data.frame(rval[rev(1:length(rval))])
- l2 <- sapply(rval, function(z) length(unique(z)))
- if (any(l1 != l2))
- warning("levels are not perfectly nested")
-
- ## aggregate response matrix
- fullgamma <-if (nlevels(rhs[,nlevs]) == 1)
- TRUE else FALSE
- ftmp <- vector("list", nlevs)
- for (i in 1:nlevs) {
- ftmp[[i]] <- as.formula(paste("~", tlab[i], "- 1"))
- }
-
- ## is there a method/burnin/thin in ... ?
- method <- if (is.null(list(...)$method))
- "r2dtable" else list(...)$method
- burnin <- if (is.null(list(...)$burnin))
- 0 else list(...)$burnin
- thin <- if (is.null(list(...)$thin))
- 1 else list(...)$thin
- base <- if (is.null(list(...)$base))
- exp(1) else list(...)$base
-
- ## evaluate other arguments
- index <- match.arg(index)
- weights <- match.arg(weights)
- switch(index,
- "richness" = {
- divfun <- function(x) apply(x > 0, 1, sum)},
- "shannon" = {
- divfun <- function(x) diversity(x, index = "shannon", MARGIN = 1, base=base)},
- "simpson" = {
- divfun <- function(x) diversity(x, index = "simpson", MARGIN = 1)})
- sumMatr <- sum(lhs)
-
- ## this is the function passed to oecosimu
- wdivfun <- function(x) {
- if (fullgamma) {
- tmp <- lapply(1:(nlevs-1), function(i) t(model.matrix(ftmp[[i]], rhs)) %*% x)
- tmp[[nlevs]] <- matrix(colSums(lhs), nrow = 1, ncol = ncol(lhs))
- } else {
- tmp <- lapply(1:nlevs, function(i) t(model.matrix(ftmp[[i]], rhs)) %*% x)
- }
- ## weights will change in oecosimu thus need to be recalculated
- if (weights == "prop")
- wt <- lapply(1:nlevs, function(i) apply(tmp[[i]], 1, function(z) sum(z) / sumMatr))
- else wt <- lapply(1:nlevs, function(i) rep(1 / NROW(tmp[[i]]), NROW(tmp[[i]])))
- a <- sapply(1:nlevs, function(i) sum(divfun(tmp[[i]]) * wt[[i]]))
- if (relative)
- a <- a / a[length(a)]
- b <- sapply(2:nlevs, function(i) a[i] - a[(i-1)])
- c(a, b)
- }
- if (nsimul > 0) {
- sim <- oecosimu(lhs, wdivfun, method = method, nsimul=nsimul,
- burnin=burnin, thin=thin)
- } else {
- sim <- wdivfun(lhs)
- tmp <- rep(NA, length(sim))
- sim <- list(statistic = sim,
- oecosimu = list(z = tmp, pval = tmp, method = NA, statistic = sim))
- }
- nam <- c(paste("alpha", 1:(nlevs-1), sep="."), "gamma",
- paste("beta", 1:(nlevs-1), sep="."))
- names(sim$statistic) <- attr(sim$oecosimu$statistic, "names") <- nam
- attr(sim, "call") <- match.call()
- attr(sim, "index") <- index
- attr(sim, "weights") <- weights
- attr(sim, "n.levels") <- nlevs
- attr(sim, "terms") <- tlab
- attr(sim, "model") <- rhs
- class(sim) <- c("adipart", "list")
- sim
+ UseMethod("adipart")
}
diff --git a/R/adipart.R b/R/adipart.default.R
similarity index 63%
copy from R/adipart.R
copy to R/adipart.default.R
index e11835c..50c246d 100644
--- a/R/adipart.R
+++ b/R/adipart.default.R
@@ -1,36 +1,32 @@
-adipart <-
-function(formula, data, index=c("richness", "shannon", "simpson"),
+adipart.default <-
+function(y, x, index=c("richness", "shannon", "simpson"),
weights=c("unif", "prop"), relative = FALSE, nsimul=99, ...)
{
## evaluate formula
- lhs <- formula[[2]]
- if (missing(data))
- data <- parent.frame()
- lhs <- as.matrix(eval(lhs, data))
- formula[[2]] <- NULL
- rhs <- model.frame(formula, data, drop.unused.levels = TRUE)
- tlab <- attr(attr(rhs, "terms"), "term.labels")
- nlevs <- length(tlab)
+ lhs <- as.matrix(y)
+ if (missing(x))
+ x <- cbind(level_1=seq_len(nrow(lhs)),
+ leve_2=rep(1, nrow(lhs)))
+ rhs <- data.frame(x)
+ rhs[] <- lapply(rhs, as.factor)
+ rhs[] <- lapply(rhs, droplevels)
+ nlevs <- ncol(rhs)
if (nlevs < 2)
stop("provide at least two level hierarchy")
if (any(rowSums(lhs) == 0))
stop("data matrix contains empty rows")
if (any(lhs < 0))
stop("data matrix contains negative entries")
+ if (is.null(colnames(rhs)))
+ colnames(rhs) <- paste("level", 1:nlevs, sep="_")
+ tlab <- colnames(rhs)
## part check proper design of the model frame
- noint <- attr(attr(attr(rhs, "terms"), "factors"), "dimnames")[[1]]
- int <- attr(attr(attr(rhs, "terms"), "factors"), "dimnames")[[2]]
- if (!identical(noint, int))
- stop("interactions are not allowed in formula")
- if (!all(attr(attr(rhs, "terms"), "dataClasses") == "factor"))
- stop("all right hand side variables in formula must be factors")
l1 <- sapply(rhs, function(z) length(unique(z)))
if (!any(sapply(2:nlevs, function(z) l1[z] <= l1[z-1])))
stop("number of levels are inapropriate, check sequence")
rval <- list()
- rval[[1]] <- as.factor(rhs[,nlevs])
- rval[[1]] <- rval[[1]][drop = TRUE]
+ rval[[1]] <- rhs[,nlevs]
nCol <- nlevs - 1
for (i in 2:nlevs) {
rval[[i]] <- interaction(rhs[,nCol], rval[[(i-1)]], drop=TRUE)
@@ -63,26 +59,27 @@ function(formula, data, index=c("richness", "shannon", "simpson"),
index <- match.arg(index)
weights <- match.arg(weights)
switch(index,
- "richness" = {
- divfun <- function(x) apply(x > 0, 1, sum)},
- "shannon" = {
- divfun <- function(x) diversity(x, index = "shannon", MARGIN = 1, base=base)},
- "simpson" = {
- divfun <- function(x) diversity(x, index = "simpson", MARGIN = 1)})
- sumMatr <- sum(lhs)
+ "richness" = {
+ divfun <- function(x) apply(x > 0, 1, sum)},
+ "shannon" = {
+ divfun <- function(x) diversity(x, index = "shannon", MARGIN = 1, base=base)},
+ "simpson" = {
+ divfun <- function(x) diversity(x, index = "simpson", MARGIN = 1)})
## this is the function passed to oecosimu
wdivfun <- function(x) {
+ ## matrix sum *can* change in oecosimu (but default is constant sumMatr)
+ sumMatr <- sum(x)
if (fullgamma) {
tmp <- lapply(1:(nlevs-1), function(i) t(model.matrix(ftmp[[i]], rhs)) %*% x)
- tmp[[nlevs]] <- matrix(colSums(lhs), nrow = 1, ncol = ncol(lhs))
+ tmp[[nlevs]] <- matrix(colSums(x), nrow = 1, ncol = ncol(x))
} else {
tmp <- lapply(1:nlevs, function(i) t(model.matrix(ftmp[[i]], rhs)) %*% x)
}
## weights will change in oecosimu thus need to be recalculated
if (weights == "prop")
wt <- lapply(1:nlevs, function(i) apply(tmp[[i]], 1, function(z) sum(z) / sumMatr))
- else wt <- lapply(1:nlevs, function(i) rep(1 / NROW(tmp[[i]]), NROW(tmp[[i]])))
+ else wt <- lapply(1:nlevs, function(i) rep(1 / NROW(tmp[[i]]), NROW(tmp[[i]])))
a <- sapply(1:nlevs, function(i) sum(divfun(tmp[[i]]) * wt[[i]]))
if (relative)
a <- a / a[length(a)]
@@ -91,15 +88,15 @@ function(formula, data, index=c("richness", "shannon", "simpson"),
}
if (nsimul > 0) {
sim <- oecosimu(lhs, wdivfun, method = method, nsimul=nsimul,
- burnin=burnin, thin=thin)
- } else {
- sim <- wdivfun(lhs)
- tmp <- rep(NA, length(sim))
- sim <- list(statistic = sim,
- oecosimu = list(z = tmp, pval = tmp, method = NA, statistic = sim))
- }
+ burnin=burnin, thin=thin)
+ } else {
+ sim <- wdivfun(lhs)
+ tmp <- rep(NA, length(sim))
+ sim <- list(statistic = sim,
+ oecosimu = list(z = tmp, pval = tmp, method = NA, statistic = sim))
+ }
nam <- c(paste("alpha", 1:(nlevs-1), sep="."), "gamma",
- paste("beta", 1:(nlevs-1), sep="."))
+ paste("beta", 1:(nlevs-1), sep="."))
names(sim$statistic) <- attr(sim$oecosimu$statistic, "names") <- nam
attr(sim, "call") <- match.call()
attr(sim, "index") <- index
@@ -110,4 +107,3 @@ function(formula, data, index=c("richness", "shannon", "simpson"),
class(sim) <- c("adipart", "list")
sim
}
-
diff --git a/R/adipart.R b/R/adipart.formula.R
similarity index 79%
copy from R/adipart.R
copy to R/adipart.formula.R
index e11835c..3d5c47c 100644
--- a/R/adipart.R
+++ b/R/adipart.formula.R
@@ -1,4 +1,4 @@
-adipart <-
+adipart.formula <-
function(formula, data, index=c("richness", "shannon", "simpson"),
weights=c("unif", "prop"), relative = FALSE, nsimul=99, ...)
{
@@ -63,26 +63,27 @@ function(formula, data, index=c("richness", "shannon", "simpson"),
index <- match.arg(index)
weights <- match.arg(weights)
switch(index,
- "richness" = {
- divfun <- function(x) apply(x > 0, 1, sum)},
- "shannon" = {
- divfun <- function(x) diversity(x, index = "shannon", MARGIN = 1, base=base)},
- "simpson" = {
- divfun <- function(x) diversity(x, index = "simpson", MARGIN = 1)})
- sumMatr <- sum(lhs)
+ "richness" = {
+ divfun <- function(x) apply(x > 0, 1, sum)},
+ "shannon" = {
+ divfun <- function(x) diversity(x, index = "shannon", MARGIN = 1, base=base)},
+ "simpson" = {
+ divfun <- function(x) diversity(x, index = "simpson", MARGIN = 1)})
## this is the function passed to oecosimu
wdivfun <- function(x) {
+ ## matrix sum *can* change in oecosimu (but default is constant sumMatr)
+ sumMatr <- sum(x)
if (fullgamma) {
tmp <- lapply(1:(nlevs-1), function(i) t(model.matrix(ftmp[[i]], rhs)) %*% x)
- tmp[[nlevs]] <- matrix(colSums(lhs), nrow = 1, ncol = ncol(lhs))
+ tmp[[nlevs]] <- matrix(colSums(x), nrow = 1, ncol = ncol(x))
} else {
tmp <- lapply(1:nlevs, function(i) t(model.matrix(ftmp[[i]], rhs)) %*% x)
}
## weights will change in oecosimu thus need to be recalculated
if (weights == "prop")
wt <- lapply(1:nlevs, function(i) apply(tmp[[i]], 1, function(z) sum(z) / sumMatr))
- else wt <- lapply(1:nlevs, function(i) rep(1 / NROW(tmp[[i]]), NROW(tmp[[i]])))
+ else wt <- lapply(1:nlevs, function(i) rep(1 / NROW(tmp[[i]]), NROW(tmp[[i]])))
a <- sapply(1:nlevs, function(i) sum(divfun(tmp[[i]]) * wt[[i]]))
if (relative)
a <- a / a[length(a)]
@@ -91,15 +92,15 @@ function(formula, data, index=c("richness", "shannon", "simpson"),
}
if (nsimul > 0) {
sim <- oecosimu(lhs, wdivfun, method = method, nsimul=nsimul,
- burnin=burnin, thin=thin)
- } else {
- sim <- wdivfun(lhs)
- tmp <- rep(NA, length(sim))
- sim <- list(statistic = sim,
- oecosimu = list(z = tmp, pval = tmp, method = NA, statistic = sim))
- }
+ burnin=burnin, thin=thin)
+ } else {
+ sim <- wdivfun(lhs)
+ tmp <- rep(NA, length(sim))
+ sim <- list(statistic = sim,
+ oecosimu = list(z = tmp, pval = tmp, method = NA, statistic = sim))
+ }
nam <- c(paste("alpha", 1:(nlevs-1), sep="."), "gamma",
- paste("beta", 1:(nlevs-1), sep="."))
+ paste("beta", 1:(nlevs-1), sep="."))
names(sim$statistic) <- attr(sim$oecosimu$statistic, "names") <- nam
attr(sim, "call") <- match.call()
attr(sim, "index") <- index
@@ -110,4 +111,3 @@ function(formula, data, index=c("richness", "shannon", "simpson"),
class(sim) <- c("adipart", "list")
sim
}
-
diff --git a/R/anova.prc.R b/R/anova.prc.R
index e3b90fb..5e2b9ff 100644
--- a/R/anova.prc.R
+++ b/R/anova.prc.R
@@ -15,7 +15,7 @@
names(object$call), 0)
call <- object$call[c(1,m)]
call$formula <- fla
- call[[1]] <- as.name("rda.formula")
+ call[[1]] <- as.name("rda")
object <- eval(call, parent.frame())
anova(object, ...)
} else {
diff --git a/R/betadisper.R b/R/betadisper.R
index 6720b20..9eb5a0a 100644
--- a/R/betadisper.R
+++ b/R/betadisper.R
@@ -1,5 +1,5 @@
`betadisper` <-
- function(d, group, type = c("median","centroid"))
+ function(d, group, type = c("median","centroid"), bias.adjust=FALSE)
{
## inline function for spatial medians
spatialMed <- function(vectors, group, pos) {
@@ -67,7 +67,8 @@
## Remove zero eigenvalues
eig <- eig[(want <- abs(eig/eig[1]) > TOL)]
## scale Eigenvectors
- vectors <- vectors[, want, drop = FALSE] %*% diag(sqrt(abs(eig)))
+ vectors <- vectors[, want, drop = FALSE] %*% diag(sqrt(abs(eig)),
+ nrow = length(eig))
## store which are the positive eigenvalues
pos <- eig > 0
## group centroids in PCoA space
@@ -89,6 +90,10 @@
## zij are the distances of each point to its group centroid
zij <- sqrt(abs(dist.pos - dist.neg))
+ if (bias.adjust) {
+ n.group <- table(group)
+ zij <- zij*sqrt(n.group[group]/(n.group[group]-1))
+ }
## add in correct labels
colnames(vectors) <- names(eig) <- paste("PCoA", seq_along(eig), sep = "")
if(is.matrix(centroids))
@@ -101,5 +106,6 @@
class(retval) <- "betadisper"
attr(retval, "method") <- attr(d, "method")
attr(retval, "type") <- type
+ attr(retval, "bias.adjust") <- bias.adjust
retval
}
diff --git a/R/bioenv.default.R b/R/bioenv.default.R
index 51bcc66..a377036 100644
--- a/R/bioenv.default.R
+++ b/R/bioenv.default.R
@@ -33,7 +33,18 @@ function (comm, env, method = "spearman", index = "bray", upto = ncol(env),
}
x <- scale(env)
best <- list()
- comdis <- vegdist(comm, method = index)
+ if (inherits(comm, "dist")) {
+ comdis <- comm
+ index <- attr(comdis, "method")
+ if (is.null(index))
+ index <- "unspecified"
+ } else if (is.matrix(comm) && nrow(comm) == ncol(comm) &&
+ isTRUE(all.equal(comm, t(comm)))) {
+ comdis <- as.dist(comm)
+ index <- "supplied square matrix"
+ } else {
+ comdis <- vegdist(comm, method = index)
+ }
for (i in 1:upto) {
if (trace) {
nvar <- choose(n, i)
diff --git a/R/centroids.cca.R b/R/centroids.cca.R
index db1809f..12deeac 100644
--- a/R/centroids.cca.R
+++ b/R/centroids.cca.R
@@ -5,6 +5,7 @@
if (!any(facts))
return(NULL)
mf <- mf[, facts, drop = FALSE]
+ mf <- droplevels(mf)
if (missing(wt))
wt <- rep(1, nrow(mf))
ind <- seq_len(nrow(mf))
diff --git a/R/checkSelect.R b/R/checkSelect.R
new file mode 100644
index 0000000..f3bc99d
--- /dev/null
+++ b/R/checkSelect.R
@@ -0,0 +1,16 @@
+## internal function for checking select arguments in ordination plotting
+## functions
+.checkSelect <- function(select, scores) {
+ ## check `select` and length of scores match
+ if(is.logical(select) &&
+ !isTRUE(all.equal(length(select), NROW(scores)))) {
+ warning("Length of logical vector 'select' does not match the number of scores.\nIgnoring 'select'.")
+ } else {
+ scores <- if(is.matrix(scores)) {
+ scores[select, , drop = FALSE]
+ } else {
+ scores[select]
+ }
+ }
+ scores
+}
diff --git a/R/clamtest.R b/R/clamtest.R
index 5906950..eea17c3 100644
--- a/R/clamtest.R
+++ b/R/clamtest.R
@@ -54,9 +54,10 @@ specialization = 2/3, npoints = 20, alpha = 0.05/20)
#pi_i=b
## function to calculate test statistic from Appendix D
## (Ecological Archives E092-112-A4)
+ ## coverage limit is count, not freq !!!
testfun <- function(p_i, pi_i, C1, C2, n, m) {
- C1 <- ifelse(p_i < coverage.limit, C1, 1)
- C2 <- ifelse(pi_i < coverage.limit, C2, 1)
+ C1 <- ifelse(p_i*n < coverage.limit, C1, 1)
+ C2 <- ifelse(pi_i*m < coverage.limit, C2, 1)
Var <- C1^2*(p_i*(1-p_i)/n) + uu^2*C2^2*(pi_i*(1-pi_i)/m)
C1*p_i - C2*pi_i*uu - Zp*sqrt(Var)
}
diff --git a/R/hiersimu.R b/R/hiersimu.R
index b3d25a6..00a273d 100644
--- a/R/hiersimu.R
+++ b/R/hiersimu.R
@@ -1,96 +1,5 @@
hiersimu <-
-function(formula, data, FUN, location = c("mean", "median"),
-relative = FALSE, drop.highest = FALSE, nsimul=99, ...)
+function (...)
{
- ## evaluate formula
- lhs <- formula[[2]]
- if (missing(data))
- data <- parent.frame()
- lhs <- as.matrix(eval(lhs, data))
- formula[[2]] <- NULL
- rhs <- model.frame(formula, data, drop.unused.levels = TRUE)
- tlab <- attr(attr(rhs, "terms"), "term.labels")
- nlevs <- length(tlab)
-
- ## part check proper design of the model frame
- noint <- attr(attr(attr(rhs, "terms"), "factors"), "dimnames")[[1]]
- int <- attr(attr(attr(rhs, "terms"), "factors"), "dimnames")[[2]]
- if (!identical(noint, int))
- stop("interactions are not allowed in formula")
- if (!all(attr(attr(rhs, "terms"), "dataClasses") == "factor"))
- stop("all right hand side variables in formula must be factors")
- l1 <- sapply(rhs, function(z) length(unique(z)))
- if (nlevs > 1 && !any(sapply(2:nlevs, function(z) l1[z] <= l1[z-1])))
- stop("number of levels are inapropriate, check sequence")
- rval <- list()
- rval[[1]] <- as.factor(rhs[,nlevs])
- rval[[1]] <- rval[[1]][drop = TRUE]
- if (nlevs > 1) {
- nCol <- nlevs - 1
- for (i in 2:nlevs) {
- rval[[i]] <- interaction(rhs[,nCol], rval[[(i-1)]], drop=TRUE)
- nCol <- nCol - 1
- }
- }
- rval <- as.data.frame(rval[rev(1:length(rval))])
- l2 <- sapply(rval, function(z) length(unique(z)))
- if (any(l1 != l2))
- warning("levels are not perfectly nested")
-
- ## aggregate response matrix
- fullgamma <-if (nlevels(rhs[,nlevs]) == 1)
- TRUE else FALSE
- if (fullgamma && drop.highest)
- nlevs <- nlevs - 1
- if (nlevs == 1 && relative)
- stop("'relative=FALSE' makes no sense with 1 level")
- ftmp <- vector("list", nlevs)
- for (i in 1:nlevs) {
- ftmp[[i]] <- as.formula(paste("~", tlab[i], "- 1"))
- }
-
- ## is there a method/burnin/thin in ... ?
- method <- if (is.null(list(...)$method))
- "r2dtable" else list(...)$method
- burnin <- if (is.null(list(...)$burnin))
- 0 else list(...)$burnin
- thin <- if (is.null(list(...)$thin))
- 1 else list(...)$thin
-
- ## evaluate other arguments
- if (!is.function(FUN))
- stop("'FUN' must be a function")
- location <- match.arg(location)
- aggrFUN <- switch(location,
- "mean" = mean,
- "median" = median)
-
- ## this is the function passed to oecosimu
- evalFUN <- function(x) {
- if (fullgamma && !drop.highest) {
- tmp <- lapply(1:(nlevs-1), function(i) t(model.matrix(ftmp[[i]], rhs)) %*% x)
- tmp[[nlevs]] <- matrix(colSums(lhs), nrow = 1, ncol = ncol(lhs))
- } else {
- tmp <- lapply(1:nlevs, function(i) t(model.matrix(ftmp[[i]], rhs)) %*% x)
- }
- a <- sapply(1:nlevs, function(i) aggrFUN(FUN(tmp[[i]]))) # dots removed from FUN
- if (relative)
- a <- a / a[length(a)]
- a
- }
-
- ## processing oecosimu results
- sim <- oecosimu(lhs, evalFUN, method = method, nsimul=nsimul,
- burnin=burnin, thin=thin)
-# nam <- paste("level", 1:nlevs, sep=".")
-# names(sim$statistic) <- attr(sim$oecosimu$statistic, "names") <- nam
- names(sim$statistic) <- attr(sim$oecosimu$statistic, "names") <- tlab[1:nlevs]
- attr(sim, "call") <- match.call()
- attr(sim, "FUN") <- FUN
- attr(sim, "location") <- location
- attr(sim, "n.levels") <- nlevs
- attr(sim, "terms") <- tlab
- attr(sim, "model") <- rhs
- class(sim) <- c("hiersimu", "list")
- sim
+ UseMethod("hiersimu")
}
diff --git a/R/hiersimu.R b/R/hiersimu.default.R
similarity index 73%
copy from R/hiersimu.R
copy to R/hiersimu.default.R
index b3d25a6..a3b29a0 100644
--- a/R/hiersimu.R
+++ b/R/hiersimu.default.R
@@ -1,30 +1,27 @@
-hiersimu <-
-function(formula, data, FUN, location = c("mean", "median"),
+hiersimu.default <-
+function(y, x, FUN, location = c("mean", "median"),
relative = FALSE, drop.highest = FALSE, nsimul=99, ...)
{
## evaluate formula
- lhs <- formula[[2]]
- if (missing(data))
- data <- parent.frame()
- lhs <- as.matrix(eval(lhs, data))
- formula[[2]] <- NULL
- rhs <- model.frame(formula, data, drop.unused.levels = TRUE)
- tlab <- attr(attr(rhs, "terms"), "term.labels")
- nlevs <- length(tlab)
+ lhs <- as.matrix(y)
+ if (missing(x))
+ x <- cbind(level_1=seq_len(nrow(lhs)),
+ leve_2=rep(1, nrow(lhs)))
+ rhs <- data.frame(x)
+ rhs[] <- lapply(rhs, as.factor)
+ rhs[] <- lapply(rhs, droplevels)
+ nlevs <- ncol(rhs)
+ if (is.null(colnames(rhs)))
+ colnames(rhs) <- paste("level", 1:nlevs, sep="_")
+ tlab <- colnames(rhs)
## part check proper design of the model frame
- noint <- attr(attr(attr(rhs, "terms"), "factors"), "dimnames")[[1]]
- int <- attr(attr(attr(rhs, "terms"), "factors"), "dimnames")[[2]]
- if (!identical(noint, int))
- stop("interactions are not allowed in formula")
- if (!all(attr(attr(rhs, "terms"), "dataClasses") == "factor"))
- stop("all right hand side variables in formula must be factors")
l1 <- sapply(rhs, function(z) length(unique(z)))
- if (nlevs > 1 && !any(sapply(2:nlevs, function(z) l1[z] <= l1[z-1])))
+ if (!any(sapply(2:nlevs, function(z) l1[z] <= l1[z-1])))
stop("number of levels are inapropriate, check sequence")
rval <- list()
- rval[[1]] <- as.factor(rhs[,nlevs])
- rval[[1]] <- rval[[1]][drop = TRUE]
+ rval[[1]] <- rhs[,nlevs]
+ nCol <- nlevs - 1
if (nlevs > 1) {
nCol <- nlevs - 1
for (i in 2:nlevs) {
@@ -69,7 +66,7 @@ relative = FALSE, drop.highest = FALSE, nsimul=99, ...)
evalFUN <- function(x) {
if (fullgamma && !drop.highest) {
tmp <- lapply(1:(nlevs-1), function(i) t(model.matrix(ftmp[[i]], rhs)) %*% x)
- tmp[[nlevs]] <- matrix(colSums(lhs), nrow = 1, ncol = ncol(lhs))
+ tmp[[nlevs]] <- matrix(colSums(x), nrow = 1, ncol = ncol(x))
} else {
tmp <- lapply(1:nlevs, function(i) t(model.matrix(ftmp[[i]], rhs)) %*% x)
}
diff --git a/R/hiersimu.R b/R/hiersimu.formula.R
similarity index 97%
copy from R/hiersimu.R
copy to R/hiersimu.formula.R
index b3d25a6..01eaaae 100644
--- a/R/hiersimu.R
+++ b/R/hiersimu.formula.R
@@ -1,4 +1,4 @@
-hiersimu <-
+hiersimu.formula <-
function(formula, data, FUN, location = c("mean", "median"),
relative = FALSE, drop.highest = FALSE, nsimul=99, ...)
{
@@ -69,7 +69,7 @@ relative = FALSE, drop.highest = FALSE, nsimul=99, ...)
evalFUN <- function(x) {
if (fullgamma && !drop.highest) {
tmp <- lapply(1:(nlevs-1), function(i) t(model.matrix(ftmp[[i]], rhs)) %*% x)
- tmp[[nlevs]] <- matrix(colSums(lhs), nrow = 1, ncol = ncol(lhs))
+ tmp[[nlevs]] <- matrix(colSums(x), nrow = 1, ncol = ncol(x))
} else {
tmp <- lapply(1:nlevs, function(i) t(model.matrix(ftmp[[i]], rhs)) %*% x)
}
diff --git a/R/metaMDS.R b/R/metaMDS.R
index 9b4c8aa..fafa804 100644
--- a/R/metaMDS.R
+++ b/R/metaMDS.R
@@ -37,6 +37,11 @@
out <- metaMDSiter(dis, k = k, trymax = trymax, trace = trace,
plot = plot, previous.best = previous.best,
engine = engine, ...)
+ ## Nearly zero stress is usually not a good thing but a symptom of
+ ## a problem: you may have insufficient data for NMDS
+ if (out$stress < 1e-3) {
+ warning("Stress is (nearly) zero - you may have insufficient data")
+ }
points <- postMDS(out$points, dis, plot = max(0, plot - 1), ...)
if (is.null(rownames(points)))
rownames(points) <- rownames(comm)
diff --git a/R/monoMDS.R b/R/monoMDS.R
index aa40bb3..5db770a 100644
--- a/R/monoMDS.R
+++ b/R/monoMDS.R
@@ -89,7 +89,7 @@
iregn <- 3
nobj <- nrow(mat)
}
- ## ndis: number dissimilarities
+ ## ndis: number of >0 dissimilarities (distinct points)
ndis <- length(dist)
## starting configuration
if (missing(y)) {
diff --git a/R/msoplot.R b/R/msoplot.R
index ac4456c..45b27d0 100644
--- a/R/msoplot.R
+++ b/R/msoplot.R
@@ -1,5 +1,5 @@
`msoplot` <-
- function (x, alpha = 0.05, explained = FALSE, ...)
+ function (x, alpha = 0.05, explained = FALSE, ylim = NULL, ...)
{
object.cca <- x
if (is.data.frame(object.cca$vario)) {
@@ -17,19 +17,18 @@
"Residual variance", "Explained variance", "Conditioned variance")
ci.lab <- "C.I. for total variance"
sign.lab <- if(hasSig) "Sign. autocorrelation" else NULL
- ## You should not change par, or at least you must put
- ## back the old values when exiting:
- ## op <- par(omi = c(0.5, 0.5, 0, 0))
- ## on.exit(par(op))
- ##par(omi = c(0.5, 0.5, 0, 0))
if (is.numeric(object$CCA$rank)) {
if (!explained)
b <- b - 1
if (is.numeric(object$vario$se))
b <- b - 1
- plot(vario$Dist, vario$All, type = "n", lty = 1,
- pch = 3, xlab = "Distance", ylab = "Variance",
- ylim = c(0, ymax), cex.lab = 1.2, ...)
+ figmat <- cbind(vario$All + z * vario$se,
+ vario$All - z * vario$se,
+ vario$Sum,
+ vario[, 6:(b + 3)])
+ matplot(vario$Dist, cbind(0,figmat), type = "n",
+ xlab = "Distance", ylab = "Variance",
+ ylim = ylim, ...)
lines(vario$Dist, vario$All + z * vario$se, lty = 1, ...)
lines(vario$Dist, vario$All - z * vario$se, lty = 1, ...)
lines(vario$Dist, vario$Sum, type = "b", lty = 2,
@@ -39,24 +38,22 @@
lty=c(c(1,2,1,1,1)[2:b], 1, if(hasSig) NA),
pch=c(3, (6:(b+3))-6, NA, if(hasSig) 15)
)
- for (i in 6:(b + 3)) {
- lines(vario$Dist, vario[, i], type = "b", lty = 1,
- pch = i - 6, ...)
- }
- text(x = c(vario$Dist), y = rep(0, length(vario$Dist)),
+ matlines(vario$Dist, figmat[,-c(1:3)], type = "b", lty = 1,
+ pch = 6:(b+3)-6, ...)
+ text(x = c(vario$Dist), y = par("usr")[3], pos = 3,
label = c(vario$n), cex = 0.8, ...)
- lines(x = rep(max(object$H)/2, 2), y = c(-10, ymax +
- 10), lty = 3, ...)
+ abline(v = max(object$H/2), lty = 3, ...)
}
else {
+ if (is.null(ylim))
+ ylim <- c(0, ymax)
plot(vario$Dist, vario$All, type = "b", lty = 1,
- pch = 0, xlab = "Distance", ylab = "Variance",
- ylim = c(0, ymax), cex.lab = 1.2, ...)
- lines(c(0, 10), rep(object$tot.chi, 2), lty = 5, ...)
- text(x = c(vario$Dist), y = rep(0, length(vario$Dist)),
+ pch = 0, xlab = "Distance", ylab = "Variance",
+ ylim = ylim, ...)
+ abline(h = object$tot.chi, lty = 5, ...)
+ text(x = c(vario$Dist), y = par("usr")[3], pos = 3,
label = c(vario$n), cex = 0.8)
- lines(x = rep(max(object$H)/2, 2), y = c(-10, ymax +
- 10), lty = 3, ...)
+ abline(v = max(object$H)/2, lty = 3, ...)
legend("topleft",
c("Total variance","Global variance estimate",
if(hasSig) "Sign. autocorrelation"),
diff --git a/R/multipart.R b/R/multipart.R
index 797fe20..a906f73 100644
--- a/R/multipart.R
+++ b/R/multipart.R
@@ -1,139 +1,5 @@
multipart <-
-function(formula, data, index=c("renyi", "tsallis"), scales = 1,
- global = FALSE, relative = FALSE, nsimul=99, ...)
+function (...)
{
- if (length(scales) > 1)
- stop("length of 'scales' must be 1")
- ## evaluate formula
- lhs <- formula[[2]]
- if (missing(data))
- data <- parent.frame()
- lhs <- as.matrix(eval(lhs, data))
- formula[[2]] <- NULL
- rhs <- model.frame(formula, data, drop.unused.levels = TRUE)
- tlab <- attr(attr(rhs, "terms"), "term.labels")
- nlevs <- length(tlab)
- if (nlevs < 2)
- stop("provide at least two level hierarchy")
- if (any(rowSums(lhs) == 0))
- stop("data matrix contains empty rows")
- if (any(lhs < 0))
- stop("data matrix contains negative entries")
-
- ## part check proper design of the model frame
- noint <- attr(attr(attr(rhs, "terms"), "factors"), "dimnames")[[1]]
- int <- attr(attr(attr(rhs, "terms"), "factors"), "dimnames")[[2]]
- if (!identical(noint, int))
- stop("interactions are not allowed in formula")
- if (!all(attr(attr(rhs, "terms"), "dataClasses") == "factor"))
- stop("all right hand side variables in formula must be factors")
- l1 <- sapply(rhs, function(z) length(unique(z)))
- if (!any(sapply(2:nlevs, function(z) l1[z] <= l1[z-1])))
- stop("number of levels are inapropriate, check sequence")
- rval <- list()
- rval[[1]] <- as.factor(rhs[,nlevs])
- rval[[1]] <- rval[[1]][drop = TRUE]
- nCol <- nlevs - 1
- for (i in 2:nlevs) {
- rval[[i]] <- interaction(rhs[,nCol], rval[[(i-1)]], drop=TRUE)
- nCol <- nCol - 1
- }
- rval <- as.data.frame(rval[rev(1:length(rval))])
- l2 <- sapply(rval, function(z) length(unique(z)))
- if (any(l1 != l2))
- warning("levels are not perfectly nested")
-
- ## aggregate response matrix
- fullgamma <-if (nlevels(rhs[,nlevs]) == 1)
- TRUE else FALSE
-# if (!fullgamma && !global)
-# warning("gamma diversity value might be meaningless")
- ftmp <- vector("list", nlevs)
- for (i in 1:nlevs) {
- ftmp[[i]] <- as.formula(paste("~", tlab[i], "- 1"))
- }
-
- ## is there a method/burnin/thin in ... ?
- method <- if (is.null(list(...)$method))
- "r2dtable" else list(...)$method
- burnin <- if (is.null(list(...)$burnin))
- 0 else list(...)$burnin
- thin <- if (is.null(list(...)$thin))
- 1 else list(...)$thin
-
- ## evaluate other arguments
- index <- match.arg(index)
- divfun <- switch(index,
- "renyi" = function(x) renyi(x, scales=scales, hill = TRUE),
- "tsallis" = function(x) tsallis(x, scales=scales, hill = TRUE))
-
- ## cluster membership determination
- nrhs <- rhs
- nrhs <- sapply(nrhs, as.numeric)
- idcl <- function(i) {
- h <- nrhs[,i]
- l <- nrhs[,(i-1)]
- sapply(unique(l), function(i) h[l==i][1])
- }
- id <- lapply(2:nlevs, idcl)
-
- ## this is the function passed to oecosimu
- if (global) {
- wdivfun <- function(x) {
- if (fullgamma) {
- tmp <- lapply(1:(nlevs-1), function(i) t(model.matrix(ftmp[[i]], rhs)) %*% x)
- tmp[[nlevs]] <- matrix(colSums(lhs), nrow = 1, ncol = ncol(lhs))
- } else {
- tmp <- lapply(1:nlevs, function(i) t(model.matrix(ftmp[[i]], rhs)) %*% x)
- }
- raw <- sapply(1:nlevs, function(i) divfun(tmp[[i]]))
- a <- sapply(raw, mean)
- G <- a[nlevs]
- b <- sapply(1:(nlevs-1), function(i) G / a[i])
- if (relative)
- b <- b / sapply(raw[1:(nlevs-1)], length)
- c(a, b)
- }
- } else {
- wdivfun <- function(x) {
- if (fullgamma) {
- tmp <- lapply(1:(nlevs-1), function(i) t(model.matrix(ftmp[[i]], rhs)) %*% x)
- tmp[[nlevs]] <- matrix(colSums(lhs), nrow = 1, ncol = ncol(lhs))
- } else {
- tmp <- lapply(1:nlevs, function(i) t(model.matrix(ftmp[[i]], rhs)) %*% x)
- }
- a <- sapply(1:nlevs, function(i) divfun(tmp[[i]]))
- am <- lapply(1:(nlevs-1), function(i) {
- sapply(1:length(unique(id[[i]])), function(ii) {
- mean(a[[i]][id[[i]]==ii])
- })
- })
- b <- lapply(1:(nlevs-1), function(i) a[[(i+1)]] / am[[i]])
- bmax <- lapply(id, function(i) table(i))
- if (relative)
- b <- lapply(1:(nlevs-1), function(i) b[[i]] / bmax[[i]])
- c(sapply(a, mean), sapply(b, mean))
- }
- }
- if (nsimul > 0) {
- sim <- oecosimu(lhs, wdivfun, method = method, nsimul=nsimul,
- burnin=burnin, thin=thin)
- } else {
- sim <- wdivfun(lhs)
- tmp <- rep(NA, length(sim))
- sim <- list(statistic = sim,
- oecosimu = list(z = tmp, pval = tmp, method = NA, statistic = sim))
- }
- nam <- c(paste("alpha", 1:(nlevs-1), sep="."), "gamma",
- paste("beta", 1:(nlevs-1), sep="."))
- names(sim$statistic) <- attr(sim$oecosimu$statistic, "names") <- nam
- attr(sim, "call") <- match.call()
- attr(sim, "index") <- index
- attr(sim, "scales") <- scales
- attr(sim, "global") <- TRUE
- attr(sim, "n.levels") <- nlevs
- attr(sim, "terms") <- tlab
- attr(sim, "model") <- rhs
- class(sim) <- c("multipart", "list")
- sim
+ UseMethod("multipart")
}
diff --git a/R/multipart.R b/R/multipart.default.R
similarity index 80%
copy from R/multipart.R
copy to R/multipart.default.R
index 797fe20..c9d2c83 100644
--- a/R/multipart.R
+++ b/R/multipart.default.R
@@ -1,38 +1,34 @@
-multipart <-
-function(formula, data, index=c("renyi", "tsallis"), scales = 1,
+multipart.default <-
+function(y, x, index=c("renyi", "tsallis"), scales = 1,
global = FALSE, relative = FALSE, nsimul=99, ...)
{
if (length(scales) > 1)
stop("length of 'scales' must be 1")
## evaluate formula
- lhs <- formula[[2]]
- if (missing(data))
- data <- parent.frame()
- lhs <- as.matrix(eval(lhs, data))
- formula[[2]] <- NULL
- rhs <- model.frame(formula, data, drop.unused.levels = TRUE)
- tlab <- attr(attr(rhs, "terms"), "term.labels")
- nlevs <- length(tlab)
+ lhs <- as.matrix(y)
+ if (missing(x))
+ x <- cbind(level_1=seq_len(nrow(lhs)),
+ leve_2=rep(1, nrow(lhs)))
+ rhs <- data.frame(x)
+ rhs[] <- lapply(rhs, as.factor)
+ rhs[] <- lapply(rhs, droplevels)
+ nlevs <- ncol(rhs)
if (nlevs < 2)
stop("provide at least two level hierarchy")
if (any(rowSums(lhs) == 0))
stop("data matrix contains empty rows")
if (any(lhs < 0))
stop("data matrix contains negative entries")
+ if (is.null(colnames(rhs)))
+ colnames(rhs) <- paste("level", 1:nlevs, sep="_")
+ tlab <- colnames(rhs)
- ## part check proper design of the model frame
- noint <- attr(attr(attr(rhs, "terms"), "factors"), "dimnames")[[1]]
- int <- attr(attr(attr(rhs, "terms"), "factors"), "dimnames")[[2]]
- if (!identical(noint, int))
- stop("interactions are not allowed in formula")
- if (!all(attr(attr(rhs, "terms"), "dataClasses") == "factor"))
- stop("all right hand side variables in formula must be factors")
+ ## part check proper design of the model frame
l1 <- sapply(rhs, function(z) length(unique(z)))
if (!any(sapply(2:nlevs, function(z) l1[z] <= l1[z-1])))
stop("number of levels are inapropriate, check sequence")
rval <- list()
- rval[[1]] <- as.factor(rhs[,nlevs])
- rval[[1]] <- rval[[1]][drop = TRUE]
+ rval[[1]] <- rhs[,nlevs]
nCol <- nlevs - 1
for (i in 2:nlevs) {
rval[[i]] <- interaction(rhs[,nCol], rval[[(i-1)]], drop=TRUE)
@@ -82,7 +78,7 @@ function(formula, data, index=c("renyi", "tsallis"), scales = 1,
wdivfun <- function(x) {
if (fullgamma) {
tmp <- lapply(1:(nlevs-1), function(i) t(model.matrix(ftmp[[i]], rhs)) %*% x)
- tmp[[nlevs]] <- matrix(colSums(lhs), nrow = 1, ncol = ncol(lhs))
+ tmp[[nlevs]] <- matrix(colSums(x), nrow = 1, ncol = ncol(x))
} else {
tmp <- lapply(1:nlevs, function(i) t(model.matrix(ftmp[[i]], rhs)) %*% x)
}
@@ -98,7 +94,7 @@ function(formula, data, index=c("renyi", "tsallis"), scales = 1,
wdivfun <- function(x) {
if (fullgamma) {
tmp <- lapply(1:(nlevs-1), function(i) t(model.matrix(ftmp[[i]], rhs)) %*% x)
- tmp[[nlevs]] <- matrix(colSums(lhs), nrow = 1, ncol = ncol(lhs))
+ tmp[[nlevs]] <- matrix(colSums(x), nrow = 1, ncol = ncol(x))
} else {
tmp <- lapply(1:nlevs, function(i) t(model.matrix(ftmp[[i]], rhs)) %*% x)
}
diff --git a/R/multipart.R b/R/multipart.formula.R
similarity index 96%
copy from R/multipart.R
copy to R/multipart.formula.R
index 797fe20..b901aa8 100644
--- a/R/multipart.R
+++ b/R/multipart.formula.R
@@ -1,4 +1,4 @@
-multipart <-
+multipart.formula <-
function(formula, data, index=c("renyi", "tsallis"), scales = 1,
global = FALSE, relative = FALSE, nsimul=99, ...)
{
@@ -82,7 +82,7 @@ function(formula, data, index=c("renyi", "tsallis"), scales = 1,
wdivfun <- function(x) {
if (fullgamma) {
tmp <- lapply(1:(nlevs-1), function(i) t(model.matrix(ftmp[[i]], rhs)) %*% x)
- tmp[[nlevs]] <- matrix(colSums(lhs), nrow = 1, ncol = ncol(lhs))
+ tmp[[nlevs]] <- matrix(colSums(x), nrow = 1, ncol = ncol(x))
} else {
tmp <- lapply(1:nlevs, function(i) t(model.matrix(ftmp[[i]], rhs)) %*% x)
}
@@ -98,7 +98,7 @@ function(formula, data, index=c("renyi", "tsallis"), scales = 1,
wdivfun <- function(x) {
if (fullgamma) {
tmp <- lapply(1:(nlevs-1), function(i) t(model.matrix(ftmp[[i]], rhs)) %*% x)
- tmp[[nlevs]] <- matrix(colSums(lhs), nrow = 1, ncol = ncol(lhs))
+ tmp[[nlevs]] <- matrix(colSums(x), nrow = 1, ncol = ncol(x))
} else {
tmp <- lapply(1:nlevs, function(i) t(model.matrix(ftmp[[i]], rhs)) %*% x)
}
diff --git a/R/ordiellipse.R b/R/ordiellipse.R
index 0fdc52f..fe0164d 100644
--- a/R/ordiellipse.R
+++ b/R/ordiellipse.R
@@ -1,7 +1,7 @@
-"ordiellipse" <-
+`ordiellipse` <-
function (ord, groups, display = "sites", kind = c("sd", "se"),
conf, draw = c("lines", "polygon", "none"),
- w = weights(ord, display), col = NULL,
+ w = weights(ord, display), col = NULL, alpha = 127,
show.groups, label = FALSE, ...)
{
weights.default <- function(object, ...) NULL
@@ -19,7 +19,10 @@
w <- rep(1, nrow(pts))
if (is.null(w))
w <- rep(1, nrow(pts))
- if (!missing(show.groups)) {
+ ## make semitransparent fill
+ if (draw == "polygon" && !is.null(col))
+ col <- rgb(t(col2rgb(col)), alpha = alpha, maxColorValue = 255)
+ if (!missing(show.groups)) {
take <- groups %in% show.groups
pts <- pts[take, , drop = FALSE]
groups <- groups[take]
diff --git a/R/ordihull.R b/R/ordihull.R
index b46d000..58b12e8 100644
--- a/R/ordihull.R
+++ b/R/ordihull.R
@@ -1,9 +1,23 @@
-"ordihull" <-
+`ordihull` <-
function (ord, groups, display = "sites",
draw = c("lines", "polygon", "none"),
- show.groups, label = FALSE, ...)
+ col = NULL, alpha = 127, show.groups, label = FALSE, ...)
{
draw <- match.arg(draw)
+ ## Internal function to find the polygon centre
+ polycentre <- function(x) {
+ n <- nrow(x)
+ if (n < 4)
+ return(colMeans(x[-n, ]))
+ xy <- x[-n, 1] * x[-1, 2] - x[-1, 1] * x[-n, 2]
+ A <- sum(xy)/2
+ xc <- sum((x[-n, 1] + x[-1, 1]) * xy)/A/6
+ yc <- sum((x[-n, 2] + x[-1, 2]) * xy)/A/6
+ c(xc, yc)
+ }
+ ## Make semitransparent fill colour
+ if (draw == "polygon" && !is.null(col))
+ col <- rgb(t(col2rgb(col)), alpha = alpha, maxColorValue = 255)
pts <- scores(ord, display = display, ...)
if (!missing(show.groups)) {
take <- groups %in% show.groups
@@ -13,6 +27,8 @@
out <- seq(along = groups)
inds <- names(table(groups))
res <- list()
+ if (label)
+ cntrs <- names <- NULL
## Remove NA scores
kk <- complete.cases(pts)
for (is in inds) {
@@ -22,17 +38,25 @@
hpts <- chull(X)
hpts <- c(hpts, hpts[1])
if (draw == "lines")
- ordiArgAbsorber(X[hpts, ], FUN = lines, ...)
+ ordiArgAbsorber(X[hpts, ], FUN = lines,
+ col = if(is.null(col)) par("fg") else col, ...)
else if (draw == "polygon")
- ordiArgAbsorber(X[hpts,], FUN = polygon, ...)
+ ordiArgAbsorber(X[hpts,], FUN = polygon, col = col, ...)
if (label && draw != "none") {
- cntr <- colMeans(X)
- ordiArgAbsorber(cntr[1], cntr[2], labels = is,
- FUN = text, ...)
+ cntrs <- rbind(cntrs, polycentre(X[hpts,]))
+ names <- c(names, is)
}
res[[is]] <- X[hpts,]
}
}
+ if (label && draw != "none") {
+ if (draw == "lines")
+ ordiArgAbsorber(cntrs[,1], cntrs[,2], labels = names,
+ col = col, FUN = text, ...)
+ else
+ ordiArgAbsorber(cntrs, labels = names, col = NULL,
+ FUN = ordilabel, ...)
+ }
class(res) <- "ordihull"
invisible(res)
}
diff --git a/R/ordilabel.R b/R/ordilabel.R
index 7754727..f38f604 100644
--- a/R/ordilabel.R
+++ b/R/ordilabel.R
@@ -9,8 +9,8 @@
if (missing(labels))
labels <- rownames(x)
if (!missing(select)) {
- x <- x[select, , drop = FALSE]
- labels <- labels[select]
+ x <- .checkSelect(select, x)
+ labels <- .checkSelect(select, labels)
}
if (!missing(priority)) {
if (!missing(select))
diff --git a/R/ordiplot3d.R b/R/ordiplot3d.R
index 0748211..3f7ad32 100644
--- a/R/ordiplot3d.R
+++ b/R/ordiplot3d.R
@@ -7,8 +7,17 @@
if (missing(xlab)) xlab <- colnames(x)[1]
if (missing(ylab)) ylab <- colnames(x)[2]
if (missing(zlab)) zlab <- colnames(x)[3]
+ ### scatterplot3d does not allow setting equal aspect ratio. We
+ ### try to compensate this by setting equal limits for all axes
+ ### and hoping the graph is more or less square so that the lines
+ ### come correctly out.
+ rnge <- apply(x, 2, range)
+ scl <- c(-0.5, 0.5) * max(apply(rnge, 2, diff))
pl <- ordiArgAbsorber(x[, 1], x[, 2], x[, 3],
- xlab = xlab, ylab = ylab, zlab = zlab,
+ xlab = xlab, ylab = ylab, zlab = zlab,
+ xlim = mean(rnge[,1]) + scl,
+ ylim = mean(rnge[,2]) + scl,
+ zlim = mean(rnge[,3]) + scl,
FUN = "scatterplot3d", ...)
pl$points3d(range(x[, 1]), c(0, 0), c(0, 0), type = "l",
col = ax.col)
@@ -36,6 +45,37 @@
col = arr.col)
}
}
+ ## save the location of the origin
+ pl$origin <- matrix(unlist(pl$xyz.convert(0, 0, 0)), nrow=1)
+ ## Add function that flattens 3d envfit object so that it can be
+ ## projected on the created 3d graph
+ xyz2xy <- pl$xyz.convert
+ envfit.convert <- function(object) {
+ if (!is.null(object$vectors)) {
+ rn <- rownames(object$vectors$arrows)
+ arr <- object$vectors$arrows[, choices, drop = FALSE]
+ arr <- sapply(xyz2xy(arr), cbind)
+ if (!is.matrix(arr))
+ arr <- matrix(arr, ncol = 2)
+ arr <- sweep(arr, 2, pl$origin)
+ rownames(arr) <- rn
+ object$vectors$arrows <- arr
+ }
+ if (!is.null(object$factors)) {
+ rn <- rownames(object$factors$centroids)
+ object$factors$centroids <-
+ object$factors$centroids[ ,choices, drop = FALSE]
+ object$factors$centroids <-
+ sapply(xyz2xy(object$factors$centroids), cbind)
+ if (!is.matrix(object$factors$centroids))
+ object$factors$centroids <-
+ matrix(object$factors$centroids, ncol = 2)
+ rownames(object$factors$centroids) <- rn
+ }
+ object
+ }
+ pl$envfit.convert <- envfit.convert
+ ## save projected coordinates of points
tmp <- pl$xyz.convert(x)
pl$points <- cbind(tmp$x, tmp$y)
rownames(pl$points) <- rownames(x)
diff --git a/R/ordipointlabel.R b/R/ordipointlabel.R
index 884db39..eaffcd5 100644
--- a/R/ordipointlabel.R
+++ b/R/ordipointlabel.R
@@ -1,13 +1,23 @@
### Modelled after maptools:::pointLabel.
`ordipointlabel` <-
function(x, display = c("sites", "species"), choices = c(1,2), col=c(1,2),
- pch=c("o","+"), font = c(1,1), cex=c(0.8, 0.8), add = FALSE, ...)
+ pch=c("o","+"), font = c(1,1), cex=c(0.8, 0.8), add = FALSE,
+ select, ...)
{
xy <- list()
## Some 'scores' accept only one 'display': a workaround
for (nm in display)
xy[[nm]] <- scores(x, display = nm, choices = choices, ...)
##xy <- scores(x, display = display, choices = choices, ...)
+ ## remove `select`ed observations from scores as per text.cca
+ ## only useful if we are displaying only one set of scores
+ if(!missing(select)) {
+ if(isTRUE(all.equal(length(display), 1L))) {
+ xy[[1]] <- .checkSelect(select, xy[[1]])
+ } else {
+ warning("'select' does not apply when plotting more than one set of scores.\n'select' was ignored.")
+ }
+ }
if (length(display) > 1) {
col <- rep(col, sapply(xy, nrow))
pch <- rep(pch, sapply(xy, nrow))
diff --git a/R/plot.envfit.R b/R/plot.envfit.R
index 93b3df7..4622700 100644
--- a/R/plot.envfit.R
+++ b/R/plot.envfit.R
@@ -1,6 +1,6 @@
`plot.envfit` <-
function (x, choices = c(1, 2), arrow.mul, at = c(0, 0),
- axis = FALSE, p.max = NULL, col = "blue", add = TRUE, ...)
+ axis = FALSE, p.max = NULL, col = "blue", bg, add = TRUE, ...)
{
formals(arrows) <- c(formals(arrows), alist(... = ))
vect <- NULL
@@ -86,11 +86,20 @@
if (!is.null(vect)) {
arrows(at[1], at[2], vect[, 1], vect[, 2], len = 0.05,
col = col)
- text(vtext, rownames(x$vectors$arrows), col = col, ...)
+ if (missing(bg))
+ text(vtext, rownames(x$vectors$arrows), col = col, ...)
+ else
+ ordilabel(vtext, labels = rownames(x$vectors$arrows),
+ col = col, fill = bg, ...)
}
if (!is.null(x$factors)) {
- text(x$factors$centroids[, choices, drop = FALSE],
- rownames(x$factors$centroids), col = col, ...)
+ if (missing(bg))
+ text(x$factors$centroids[, choices, drop = FALSE],
+ rownames(x$factors$centroids), col = col, ...)
+ else
+ ordilabel(x$factors$centroids[, choices, drop = FALSE],
+ labels = rownames(x$factors$centroids),
+ col = col, fill = bg, ...)
}
if (axis && !is.null(vect)) {
axis(3, at = ax + at[1], labels = c(maxarr, 0, maxarr),
diff --git a/R/plot.prc.R b/R/plot.prc.R
index bd8aad6..a557374 100644
--- a/R/plot.prc.R
+++ b/R/plot.prc.R
@@ -10,12 +10,12 @@
on.exit(par(oldpar))
b <- t(coef(x))
xax <- rownames(b)
- if (missing(xlab))
+ if (missing(xlab))
xlab <- x$names[1]
if (missing(ylab))
ylab <- "Effect"
if (!missing(select))
- x$sp <- x$sp[select]
+ x$sp <- .checkSelect(select, x$sp)
if (missing(ylim))
ylim <- if (species)
range(b, x$sp, na.rm = TRUE)
diff --git a/R/points.cca.R b/R/points.cca.R
index b35391b..8462bf2 100644
--- a/R/points.cca.R
+++ b/R/points.cca.R
@@ -1,14 +1,14 @@
`points.cca` <-
- function (x, display = "sites", choices = c(1, 2), scaling = 2,
- arrow.mul, head.arrow = 0.05, select, const, ...)
+ function (x, display = "sites", choices = c(1, 2), scaling = 2,
+ arrow.mul, head.arrow = 0.05, select, const, ...)
{
formals(arrows) <- c(formals(arrows), alist(... = ))
- if (length(display) > 1)
+ if (length(display) > 1)
stop("Only one 'display' item can be added in one command.")
pts <- scores(x, choices = choices, display = display, scaling = scaling,
const)
- if (!missing(select))
- pts <- pts[select, , drop = FALSE]
+ if (!missing(select))
+ pts <- .checkSelect(select, pts)
if (display == "cn") {
cnam <- rownames(pts)
points(pts, ...)
@@ -16,7 +16,7 @@
const)
bnam <- rownames(pts)
pts <- pts[!(bnam %in% cnam), , drop = FALSE]
- if (nrow(pts) == 0)
+ if (nrow(pts) == 0)
return(invisible())
else display <- "bp"
}
@@ -25,12 +25,12 @@
arrow.mul <- ordiArrowMul(pts)
}
pts <- pts * arrow.mul
- arrows(0, 0, pts[, 1], pts[, 2], length = head.arrow,
+ arrows(0, 0, pts[, 1], pts[, 2], length = head.arrow,
...)
pts <- pts * 1.1
- axis(3, at = c(-arrow.mul, 0, arrow.mul), labels = rep("",
+ axis(3, at = c(-arrow.mul, 0, arrow.mul), labels = rep("",
3))
- axis(4, at = c(-arrow.mul, 0, arrow.mul), labels = c(-1,
+ axis(4, at = c(-arrow.mul, 0, arrow.mul), labels = c(-1,
0, 1))
return(invisible())
}
diff --git a/R/points.decorana.R b/R/points.decorana.R
index 68a7f20..9cf5630 100644
--- a/R/points.decorana.R
+++ b/R/points.decorana.R
@@ -5,7 +5,7 @@
display <- match.arg(display)
x <- scores(x, display = display, choices = choices, origin = origin, ...)
if (!missing(select))
- x <- x[select,,drop=FALSE]
+ x <- .checkSelect(select, x)
ordiArgAbsorber(x, FUN = points, ...)
invisible()
}
diff --git a/R/points.metaMDS.R b/R/points.metaMDS.R
index e67e473..bcd5b03 100644
--- a/R/points.metaMDS.R
+++ b/R/points.metaMDS.R
@@ -1,11 +1,11 @@
"points.metaMDS" <-
function (x, display = c("sites", "species"),
- choices = c(1, 2), shrink = FALSE, select, ...)
+ choices = c(1, 2), shrink = FALSE, select, ...)
{
display <- match.arg(display)
x <- scores(x, display = display, choices = choices, shrink = shrink)
if (!missing(select))
- x <- x[select,,drop=FALSE]
+ x <- .checkSelect(select, x)
points(x, ...)
invisible()
}
diff --git a/R/points.ordiplot.R b/R/points.ordiplot.R
index 4488f54..9d0c70b 100644
--- a/R/points.ordiplot.R
+++ b/R/points.ordiplot.R
@@ -1,9 +1,9 @@
"points.ordiplot" <-
- function (x, what, select, ...)
+ function (x, what, select, ...)
{
x <- scores(x, what)
if (!missing(select))
- x <- x[select,,drop=FALSE]
+ x <- .checkSelect(select, x)
points(x, ...)
invisible()
}
diff --git a/R/predict.cca.R b/R/predict.cca.R
index f829d9b..1d9e0db 100644
--- a/R/predict.cca.R
+++ b/R/predict.cca.R
@@ -1,4 +1,4 @@
-"predict.cca" <-
+`predict.cca` <-
function (object, newdata, type = c("response", "wa", "sp", "lc", "working"),
rank = "full", model = c("CCA", "CA"), scaling = FALSE, ...)
{
@@ -22,9 +22,13 @@
slam <- diag(sqrt(object[[model]]$eig[1:take]), nrow = take)
if (type %in% c("response", "working")) {
Xbar <- 0
- if (!missing(newdata))
- u <- predict(object, type = if(model == "CCA") "lc" else "wa",
- newdata = newdata, rank = take)
+ if (!missing(newdata)) {
+ if (NROW(u) == NROW(newdata))
+ u <- predict(object, type = if(model == "CCA") "lc" else "wa",
+ newdata = newdata, rank = take)
+ else
+ warning(gettextf("'newdata' ignored: it must have the same number of rows as the original community data with type = '%s'", type))
+ }
if (take > 0)
Xbar <- u %*% slam %*% t(v)
if (!is.null(object$pCCA))
diff --git a/R/print.adipart.R b/R/print.adipart.R
index 918b0f8..7278e56 100644
--- a/R/print.adipart.R
+++ b/R/print.adipart.R
@@ -3,7 +3,11 @@ function(x, ...)
{
n <- if (is.null(x$oecosimu$simulated))
0 else ncol(x$oecosimu$simulated)
- cat("adipart with", n, "simulations\n")
+ if (n > 0)
+ cat("adipart with", n, "simulations using method",
+ dQuote(x$oecosimu$method), "\n")
+ else
+ cat("adipart ")
att <- attributes(x)
att$names <- att$call <- att$class <- att$n.levels <- att$terms <- att$model <- NULL
cat("with", paste(names(att), att, collapse=", "))
diff --git a/R/print.metaMDS.R b/R/print.metaMDS.R
index 59777b0..55a5df0 100644
--- a/R/print.metaMDS.R
+++ b/R/print.metaMDS.R
@@ -17,11 +17,13 @@
cat(", ", c("weak", "strong")[x$ities], " ties", sep = "")
cat("\n")
}
- if (x$converged)
+ if (x$converged) {
cat("Two convergent solutions found after", x$tries,
"tries\n")
- else cat("No convergent solutions - best solution after",
- x$tries, "tries\n")
+ } else {
+ cat("No convergent solutions - best solution after",
+ x$tries, "tries\n")
+ }
z <- x$points
scal <- c(if (attr(z, "centre")) "centring",
if (attr(z, "pc")) "PC rotation",
diff --git a/R/rrarefy.R b/R/rrarefy.R
index f4072f6..2f46432 100644
--- a/R/rrarefy.R
+++ b/R/rrarefy.R
@@ -3,6 +3,8 @@
`rrarefy` <-
function(x, sample)
{
+ if (!identical(all.equal(x, round(x)), TRUE))
+ stop("function is meaningful only for integers (counts)")
x <- as.matrix(x)
if (ncol(x) == 1)
x <- t(x)
@@ -27,6 +29,8 @@
`drarefy` <-
function(x, sample)
{
+ if (!identical(all.equal(x, round(x)), TRUE))
+ stop("function accepts only integers (counts)")
if (length(sample) > 1 && length(sample) != nrow(x))
stop(gettextf(
"length of 'sample' and number of rows of 'x' do not match"))
diff --git a/R/simper.R b/R/simper.R
index 9393549..3dbc0d4 100644
--- a/R/simper.R
+++ b/R/simper.R
@@ -1,6 +1,8 @@
`simper` <-
function(comm, group, ...)
{
+ if (any(rowSums(comm, na.rm = TRUE) == 0))
+ warning("you have empty rows: results may be meaningless")
permutations <- 0
trace <- FALSE
comm <- as.matrix(comm)
@@ -140,4 +142,4 @@
if ((np <- attr(x, "permutations")) > 0)
cat("P-values based on", np, "permutations\n")
invisible(x)
-}
\ No newline at end of file
+}
diff --git a/R/text.cca.R b/R/text.cca.R
index de8c735..942ba79 100644
--- a/R/text.cca.R
+++ b/R/text.cca.R
@@ -1,16 +1,16 @@
`text.cca` <-
- function (x, display = "sites", labels, choices = c(1, 2), scaling = 2,
- arrow.mul, head.arrow = 0.05, select, const, ...)
+ function (x, display = "sites", labels, choices = c(1, 2), scaling = 2,
+ arrow.mul, head.arrow = 0.05, select, const, ...)
{
formals(arrows) <- c(formals(arrows), alist(... = ))
- if (length(display) > 1)
+ if (length(display) > 1)
stop("Only one 'display' item can be added in one command.")
pts <- scores(x, choices = choices, display = display, scaling = scaling,
const)
if (!missing(labels))
rownames(pts) <- labels
- if (!missing(select))
- pts <- pts[select, , drop = FALSE]
+ if (!missing(select))
+ pts <- .checkSelect(select, pts)
if (display == "cn") {
cnam <- rownames(pts)
text(pts, labels = cnam, ...)
@@ -18,7 +18,7 @@
const)
bnam <- rownames(pts)
pts <- pts[!(bnam %in% cnam), , drop = FALSE]
- if (nrow(pts) == 0)
+ if (nrow(pts) == 0)
return(invisible())
else display <- "bp"
}
@@ -27,12 +27,12 @@
arrow.mul <- ordiArrowMul(pts)
}
pts <- pts * arrow.mul
- arrows(0, 0, pts[, 1], pts[, 2], length = head.arrow,
+ arrows(0, 0, pts[, 1], pts[, 2], length = head.arrow,
...)
pts <- pts * 1.1
- axis(3, at = c(-arrow.mul, 0, arrow.mul), labels = rep("",
+ axis(3, at = c(-arrow.mul, 0, arrow.mul), labels = rep("",
3))
- axis(4, at = c(-arrow.mul, 0, arrow.mul), labels = c(-1,
+ axis(4, at = c(-arrow.mul, 0, arrow.mul), labels = c(-1,
0, 1))
}
text(pts, labels = rownames(pts), ...)
diff --git a/R/text.decorana.R b/R/text.decorana.R
index e94a518..446901a 100644
--- a/R/text.decorana.R
+++ b/R/text.decorana.R
@@ -10,7 +10,7 @@
if (!missing(labels))
rownames(x) <- labels
if (!missing(select))
- x <- x[select, , drop = FALSE]
+ x <- .checkSelect(select, x)
localText(x, rownames(x), ...)
invisible()
}
diff --git a/R/text.metaMDS.R b/R/text.metaMDS.R
index 942cc74..cf7d9e1 100644
--- a/R/text.metaMDS.R
+++ b/R/text.metaMDS.R
@@ -1,13 +1,13 @@
"text.metaMDS" <-
- function (x, display = c("sites", "species"), labels,
- choices = c(1, 2), shrink = FALSE, select, ...)
+ function (x, display = c("sites", "species"), labels,
+ choices = c(1, 2), shrink = FALSE, select, ...)
{
display <- match.arg(display)
x <- scores(x, display = display, choices = choices, shrink = shrink)
if (!missing(labels))
rownames(x) <- labels
- if (!missing(select))
- x <- x[select, , drop = FALSE]
+ if (!missing(select))
+ x <- .checkSelect(select, x)
text(x, labels = rownames(x), ...)
invisible()
}
diff --git a/R/text.ordiplot.R b/R/text.ordiplot.R
index 111bc1b..89307ab 100644
--- a/R/text.ordiplot.R
+++ b/R/text.ordiplot.R
@@ -1,11 +1,11 @@
"text.ordiplot" <-
- function (x, what, labels, select, ...)
+ function (x, what, labels, select, ...)
{
x <- scores(x, what)
if (!missing(labels))
rownames(x) <- labels
- if (!missing(select))
- x <- x[select, , drop = FALSE]
+ if (!missing(select))
+ x <- .checkSelect(select, x)
text(x, labels = rownames(x), ...)
invisible()
}
diff --git a/inst/ChangeLog b/inst/ChangeLog
index 4600996..83fdb8c 100644
--- a/inst/ChangeLog
+++ b/inst/ChangeLog
@@ -1,11 +1,60 @@
-$Date: 2012-03-03 16:57:09 +0200 (Sat, 03 Mar 2012) $
+$Date: 2012-06-17 21:05:31 +0300 (Sun, 17 Jun 2012) $
VEGAN RELEASE VERSIONS at http://cran.r-project.org/
-Version 2.0-3 (opened November 13, 2011)
+Version 2.0-4 (released June 18, 2012)
+
+ * merge r2215: plot.envfit() gains args 'bg' for background colour
+ of labels.
+ * cherry-pick from r2213: warn on empty rows in simper (picked
+ github revision cce42b3).
+ * merge r2206,7: check 'newdata' dims in predict(..., type =
+ "response"|"working") for CA results.
+ * merge r2195-7, 2204: bias adjusted betadisper.
+ * merge r2191-2193: standardise handling of 'select' arg in
+ those plotting functions that support it. Adds non-exported
+ function .checkSelect().
+ * merge r2182,2182,2199,2201: FAQ about data size in NMDS.
+ * merge r2178, 2180: ordipointlabel gains 'select' argument.
+ * merge r2173-2176, 2185: ordihull labels, semintransparent
+ colours in ordihull & ordiellipse.
+ * merge r2172,2179,2181,2184,2186,2187: metaMDS warns about too
+ good stress.
+ * merge r2170: bioenv accepts dissimilarities as input.
+ * merge r2167: warn about unequal aspect ratio in ordiplot3d.
+ * merge r2162: set equal axis scales for ordiplot3d.
+ * merge r2157:2160,2167,2168,2208: ordiplot3d returns
+ envfit.convert().
+ * merge r2156: betadisper example adapted for default spatial
+ median.
+ * merge r2150: monoMDS checks that the number of dissimilarities
+ is sufficient for the requested analysis. The decostand.Rd fix of
+ r2150 was not yet merged.
+ * merge r2149: drarefy & rrarefy check that input data are
+ integers.
+ * merge r2148 (partial): format references. However, scoverage()
+ was not merged yet, and its changes have not been merged.
+ * merge r2144: hiersimu and multipart do not assume constant
+ gamma. Similar change was made in r2132 to adipart.
+ * merge r2143: formula method for adipart/hiersimu/multipart.
+ NAMESPACE needed manual merge (edited patch from diff).
+ * merge r2139: clamtest coverage threshold fix.
+ * merge r2137: explain data transformation in pyrifos.Rd.
+ * merge r2135: print.adipart displays null model method.
+ * merge r2132: adipart bug fix: assumed constant gamma in
+ permutations.
+ * merge r2129: envfit failed with empty factor levels.
+ * merge r2128: anova(<prc-object>, by = ...) failed.
+ * merge r2127: more configurable msoplot.
+ * merge r2125: typo in anova.cca.Rd.
+ * merge r2123: r2121 for adonis.
+ * merge r2121: doc location/dispersion mix-up in simper, mrpp &
+ anosim.
+
+Version 2.0-3 (released March 3, 2012)
* merge r2115: simper fixes from github EDiLD/vegan pull request
- #6 by Eduard Szöcz (proportions instead of percentages etc.)
+ #6 by Eduard Szöcs (proportions instead of percentages etc.)
* merge r2113: tweak simper.Rd formatting.
* commit r2112: deactivate permutation tests in simper.
* merge r2110: centroids.cca fix for 2-level factors as the only
@@ -27,7 +76,7 @@ Version 2.0-3 (opened November 13, 2011)
* merge r2078, 2084: simper NAMESPACE.
* merge r2071,2: dimnames fix in indopower & expand example.
* merge r2068: broken url in renyi.Rd.
- * merge r2065: number of iterations is an arguent in nesteddisc.
+ * merge r2065: number of iterations is an argument in nesteddisc.
* merge r2060: adonis tells terms were added sequentially.
* mrege r2057: add .Rinstignore to silense R 2.15.0 checks.
* merge r2056: use inconsolata fonts in vignettes.
diff --git a/inst/NEWS.Rd b/inst/NEWS.Rd
index ad7b32c..adc48b5 100644
--- a/inst/NEWS.Rd
+++ b/inst/NEWS.Rd
@@ -2,6 +2,102 @@
\title{vegan News}
\encoding{UTF-8}
+\section{Changes in version 2.0-4}{
+
+ \subsection{BUG FIXES}{
+ \itemize{
+
+ \item \code{adipart} assumed constant gamma diversity in
+ simulations when assessing the \eqn{P}-value. This could give
+ biased results if the null model produces variable gamma
+ diversities and option \code{weights = "prop"} is used. The
+ default null model (\code{"r2dtable"}) and the default option
+ (\code{weights = "unif"}) were analysed correctly.
+
+ \item \code{anova(<prc-object>, by = "axis")} and other
+ \code{by} cases failed due to \file{NAMESPACE} issues.
+
+ \item \code{clamtest} wrongly used frequencies instead of the
+ counts when calculating sample coverage. No detectable
+ differences were produced when rerunning examples from Chazdon
+ et al. 2011 and \pkg{vegan} help page.
+
+ \item \code{envfit} failed with unused factor levels.
+
+ \item \code{predict} for \code{cca} results with \code{type =
+ "response"} or \code{type = "working"} failed with
+ \code{newdata} if the number of rows did not match with the
+ original data. Now the \code{newdata} is ignored if it has a
+ wrong number of rows. The number of rows must match because
+ the results in \code{cca} must be weighted by original row
+ totals. The problem did not concern \code{rda} or
+ \code{capscale} results which do not need row weights.
+ Reported by Glenn De'ath.
+
+ }
+ }% end bug fixes
+
+ \subsection{NEW FEATURES}{
+ \itemize{
+
+ \item Functions for diversity partitioning (\code{adipart},
+ \code{hiersimu} and \code{multipart}) have now \code{formula}
+ and \code{default} methods. The \code{formula} method is
+ identical to the previous functions, but the \code{default}
+ method can take two matrices as input.
+
+ Functions \code{adipart} and \code{multipart} can be used for
+ fast and easy overall partitioning to alpha, beta and gamma
+ diversities by omitting the argument describing the hierarchy.
+
+ \item The method in \code{betadisper} is biased with small
+ sample sizes. The effects of the bias are strongest with
+ unequal sample sizes. A bias adjusted version was developed by
+ Adrian Stier and Ben Bolker, and can be invoked with argument
+ \code{bias.adjust} (defaults to \code{FALSE}).
+
+ \item \code{bioenv} accepts dissimilarities (or square matrices
+ that can be interpreted as dissimilarities) as an alternative to
+ community data. This allows using other dissimilarities than
+ those available in \code{vegdist}.
+
+ \item \code{plot} function for \code{envfit} results gained new
+ argument \code{bg} that can be used to set background colour for
+ plotted labels.
+
+ \item \code{msoplot} is more configurable, and allows, for
+ instance, setting y-axis limits.
+
+ \item Hulls and ellipses are now filled using semitransparent
+ colours in \code{ordihull} and \code{ordiellipse}, and the
+ user can set the degree of transparency with a new argument
+ \code{alpha}. The filled shapes are used when these functions
+ are called with argument \code{draw = "polygon"}. Function
+ \code{ordihull} puts labels (with argument \code{label = TRUE})
+ now in the real polygon centre.
+
+ \item \code{ordiplot3d} returns function \code{envfit.convert}
+ and the projected location of the \code{origin}. Together
+ these can be used to add \code{envfit} results to existing
+ \code{ordiplot3d} plots.
+
+ Equal aspect ratio cannot be set exactly in \code{ordiplot3d}
+ because underlying core routines do not allow this. Now
+ \code{ordiplot3d} sets equal axis ranges, and the documents
+ urge users to verify that the aspect ratio is reasonably equal
+ and the graph looks like a cube. If the problems cannot be
+ solved in the future, \code{ordiplot3d} may be removed from
+ next releases of \pkg{vegan}.
+
+ \item Function \code{ordipointlabel} gained argument to
+ \code{select} only some of the items for plotting. The
+ argument can be used only with one set of points.
+
+ }
+ } % end new features
+
+}%end version 2.0-4
+
\section{Changes in version 2.0-3}{
\subsection{NEW FUNCTIONS}{
@@ -25,7 +121,7 @@
Bray-Curtis dissimilarity index to contributions by individual
species. The code was developed in
\href{https://github.com/jarioksa/vegan}{GitHub}
- by Eduard Szöcz (Uni Landau, Germany).
+ by Eduard Szöcs (Uni Landau, Germany).
}
} % end new functions
diff --git a/inst/doc/FAQ-vegan.pdf b/inst/doc/FAQ-vegan.pdf
index c290c23..2534c79 100644
Binary files a/inst/doc/FAQ-vegan.pdf and b/inst/doc/FAQ-vegan.pdf differ
diff --git a/inst/doc/FAQ-vegan.texi b/inst/doc/FAQ-vegan.texi
index 682e0c9..bcb66f6 100644
--- a/inst/doc/FAQ-vegan.texi
+++ b/inst/doc/FAQ-vegan.texi
@@ -8,7 +8,7 @@
@setfilename FAQ- at pkg{vegan}.info
@settitle @pkg{vegan} FAQ
@setchapternewpage on
- at set FAQ_YEAR 2011
+ at set FAQ_YEAR 2012
@afourpaper
@c %**end of header
@@ -16,7 +16,7 @@
@ifnottex
This document contains answers to some of the most frequently asked
questions about R package @pkg{vegan}.
-This is version of $Date: 2011-11-20 13:21:05 +0200 (Sun, 20 Nov 2011) $.
+This is version of $Date: 2012-05-27 18:15:38 +0300 (Sun, 27 May 2012) $.
@end ifnottex
@quotation
@@ -26,7 +26,7 @@ License. To view a copy of this license, visit
Creative Commons, 543 Howard Street, 5th Floor, San Francisco,
California, 94105, USA.
-Copyright @copyright{} 2008-2011 Jari Oksanen
+Copyright @copyright{} 2008-2012 Jari Oksanen
@end quotation
@end copying
@@ -40,7 +40,7 @@ Copyright @copyright{} 2008-2011 Jari Oksanen
@titlepage
@title @pkg{vegan} @acronym{FAQ}
@subtitle Frequently Asked Questions on R package @pkg{vegan}
- at subtitle Version of $Date: 2011-11-20 13:21:05 +0200 (Sun, 20 Nov 2011) $
+ at subtitle Version of $Date: 2012-05-27 18:15:38 +0300 (Sun, 27 May 2012) $
@author Jari Oksanen
@vskip 0pt plus 1fill
@@ -295,9 +295,10 @@ included contributions will be credited.
@menu
* I have only numeric and positive data but @pkg{vegan} still complaints::
-* Can you analyse binary or cover class data?::
+* Can I analyse binary or cover class data?::
* Why dissimilarities in @pkg{vegan} differ from other sources?::
* Why NMDS stress is sometimes 0.1 and sometimes 10?::
+* I get zero stress but no convergent solutions in @code{metaMDS}::
* Zero dissimilarities in isoMDS::
* How the RDA results are scaled?::
* cca fails with ``data.frame expected'' or ``"site.env" missing''::
@@ -315,7 +316,7 @@ included contributions will be credited.
* Can I zoom into an ordination plot?::
@end menu
- at node I have only numeric and positive data but @pkg{vegan} still complaints, Can you analyse binary or cover class data?, Ordination, Ordination
+ at node I have only numeric and positive data but @pkg{vegan} still complaints, Can I analyse binary or cover class data?, Ordination, Ordination
@comment node-name, next, previous, up
@section I have only numeric and positive data but @pkg{vegan} still complaints
@@ -328,8 +329,8 @@ were interpreted as data (check argument @code{header = TRUE} in reading
the data). Another common reason is that you had empty cells in your
input data, and these were interpreted as missing values.
- at node Can you analyse binary or cover class data?, Why dissimilarities in @pkg{vegan} differ from other sources?, I have only numeric and positive data but @pkg{vegan} still complaints, Ordination
- at section Can you analyse binary or cover class data?
+ at node Can I analyse binary or cover class data?, Why dissimilarities in @pkg{vegan} differ from other sources?, I have only numeric and positive data but @pkg{vegan} still complaints, Ordination
+ at section Can I analyse binary or cover class data?
Yes. Most @pkg{vegan} methods can handle binary data or cover abundance data.
Most statistical tests are based on permutation, and do not make
@@ -337,7 +338,7 @@ distributional assumptions. There are some methods (mainly in diversity
analysis) that need count data. These methods check that input data are
integers, but they may be fooled by cover class data.
- at node Why dissimilarities in @pkg{vegan} differ from other sources?, Why NMDS stress is sometimes 0.1 and sometimes 10?, Can you analyse binary or cover class data?, Ordination
+ at node Why dissimilarities in @pkg{vegan} differ from other sources?, Why NMDS stress is sometimes 0.1 and sometimes 10?, Can I analyse binary or cover class data?, Ordination
@section Why dissimilarities in @pkg{vegan} differ from other sources?
Most commonly the reason is that other software use presence--absence
@@ -351,7 +352,7 @@ name @code{"jaccard"} for the quantitative index, too.
Another reason may be that indices indeed are defined differently,
because people use same names for different indices.
- at node Why NMDS stress is sometimes 0.1 and sometimes 10?, Zero dissimilarities in isoMDS, Why dissimilarities in @pkg{vegan} differ from other sources?, Ordination
+ at node Why NMDS stress is sometimes 0.1 and sometimes 10?, I get zero stress but no convergent solutions in @code{metaMDS}, Why dissimilarities in @pkg{vegan} differ from other sources?, Ordination
@section Why @acronym{NMDS} stress is sometimes 0.1 and sometimes 10?
Stress is a proportional measure of badness of fit. The proportions can
@@ -363,7 +364,31 @@ also depend on the definition of stress, and the same @code{goodness} is
100 times higher in @code{isoMDS} than in @code{monoMDS}. Both of these
conventions are equally correct.
- at node Zero dissimilarities in isoMDS, How the RDA results are scaled?, Why NMDS stress is sometimes 0.1 and sometimes 10?, Ordination
+ at node I get zero stress but no convergent solutions in @code{metaMDS}, Zero dissimilarities in isoMDS, Why NMDS stress is sometimes 0.1 and sometimes 10?, Ordination
+ at section I get zero stress but no convergent solutions in @code{metaMDS}
+
+Most common reason is that you have too few observations for your
+ at acronym{NMDS}. For @code{n} observations (points) and @code{k}
+dimensions you need to estimate @code{n*k} parameters (ordination
+scores) using @code{n*(n-1)/2} dissimilarities. For @code{k} dimensions
+you must have @code{n > 2*k + 1}, or for two dimensions at least six
+points. In some degenerate situations you may need even a larger number
+of points. If you have a lower number of points, you can find an
+undefined number of perfect (stress is zero) but different solutions.
+Conventional wisdom due to Kruskal is that you should have @code{n > 4*k
++ 1} points for @code{k} dimensions. A typical symptom of insufficient
+data is that you have (nearly) zero stress but no two convergent
+solutions. In those cases you should reduce the number of dimensions
+(@code{k}) and with very small data sets you should not use @code{NMDS},
+but rely on metric methods.
+
+It seems that local and hybrid scaling with @code{monoMDS} have similar
+lower limits in practice (although theoretically they could differ).
+However, higher number of dimensions can be used in metric scaling, both
+with @code{monoMDS} and in principal coordinates analysis
+(@code{cmdscale} in @pkg{stats}, @code{wcmdscale} in @pkg{vegan}).
+
+ at node Zero dissimilarities in isoMDS, How the RDA results are scaled?, I get zero stress but no convergent solutions in @code{metaMDS}, Ordination
@section Zero dissimilarities in isoMDS
Function @code{metaMDS} uses function @code{monoMDS} as its default
diff --git a/inst/doc/NEWS.html b/inst/doc/NEWS.html
index 945506c..c4a17b7 100644
--- a/inst/doc/NEWS.html
+++ b/inst/doc/NEWS.html
@@ -8,6 +8,122 @@
<h2>vegan News</h2>
+<h3>Changes in version 2.0-4</h3>
+
+
+
+
+<h4>BUG FIXES</h4>
+
+
+
+<ul>
+<li> <p><code>adipart</code> assumed constant gamma diversity in
+simulations when assessing the <i>P</i>-value. This could give
+biased results if the null model produces variable gamma
+diversities and option <code>weights = "prop"</code> is used. The
+default null model (<code>"r2dtable"</code>) and the default option
+(<code>weights = "unif"</code>) were analysed correctly.
+</p>
+</li>
+<li> <p><code>anova(<prc-object>, by = "axis")</code> and other
+<code>by</code> cases failed due to ‘<span class="file">NAMESPACE</span>’ issues.
+</p>
+</li>
+<li> <p><code>clamtest</code> wrongly used frequencies instead of the
+counts when calculating sample coverage. No detectable
+differences were produced when rerunning examples from Chazdon
+et al. 2011 and <span class="pkg">vegan</span> help page.
+</p>
+</li>
+<li> <p><code>envfit</code> failed with unused factor levels.
+</p>
+</li>
+<li> <p><code>predict</code> for <code>cca</code> results with <code>type =
+ "response"</code> or <code>type = "working"</code> failed with
+<code>newdata</code> if the number of rows did not match with the
+original data. Now the <code>newdata</code> is ignored if it has a
+wrong number of rows. The number of rows must match because
+the results in <code>cca</code> must be weighted by original row
+totals. The problem did not concern <code>rda</code> or
+<code>capscale</code> results which do not need row weights.
+Reported by Glenn De'ath.
+</p>
+</li></ul>
+
+
+
+
+<h4>NEW FEATURES</h4>
+
+
+
+<ul>
+<li><p> Functions for diversity partitioning (<code>adipart</code>,
+<code>hiersimu</code> and <code>multipart</code>) have now <code>formula</code>
+and <code>default</code> methods. The <code>formula</code> method is
+identical to the previous functions, but the <code>default</code>
+method can take two matrices as input.
+</p>
+<p>Functions <code>adipart</code> and <code>multipart</code> can be used for
+fast and easy overall partitioning to alpha, beta and gamma
+diversities by omitting the argument describing the hierarchy.
+</p>
+</li>
+<li><p> The method in <code>betadisper</code> is biased with small
+sample sizes. The effects of the bias are strongest with
+unequal sample sizes. A bias adjusted version was developed by
+Adrian Stier and Ben Bolker, and can be invoked with argument
+<code>bias.adjust</code> (defaults to <code>FALSE</code>).
+</p>
+</li>
+<li> <p><code>bioenv</code> accepts dissimilarities (or square matrices
+that can be interpreted as dissimilarities) as an alternative to
+community data. This allows using other dissimilarities than
+those available in <code>vegdist</code>.
+</p>
+</li>
+<li> <p><code>plot</code> function for <code>envfit</code> results gained new
+argument <code>bg</code> that can be used to set background colour for
+plotted labels.
+</p>
+</li>
+<li> <p><code>msoplot</code> is more configurable, and allows, for
+instance, setting y-axis limits.
+</p>
+</li>
+<li><p> Hulls and ellipses are now filled using semitransparent
+colours in <code>ordihull</code> and <code>ordiellipse</code>, and the
+user can set the degree of transparency with a new argument
+<code>alpha</code>. The filled shapes are used when these functions
+are called with argument <code>draw = "polygon"</code>. Function
+<code>ordihull</code> puts labels (with argument <code>label = TRUE</code>)
+now in the real polygon centre.
+</p>
+</li>
+<li> <p><code>ordiplot3d</code> returns function <code>envfit.convert</code>
+and the projected location of the <code>origin</code>. Together
+these can be used to add <code>envfit</code> results to existing
+<code>ordiplot3d</code> plots.
+</p>
+<p>Equal aspect ratio cannot be set exactly in <code>ordiplot3d</code>
+because underlying core routines do not allow this. Now
+<code>ordiplot3d</code> sets equal axis ranges, and the documents
+urge users to verify that the aspect ratio is reasonably equal
+and the graph looks like a cube. If the problems cannot be
+solved in the future, <code>ordiplot3d</code> may be removed from
+next releases of <span class="pkg">vegan</span>.
+</p>
+</li>
+<li><p> Function <code>ordipointlabel</code> gained argument to
+<code>select</code> only some of the items for plotting. The
+argument can be used only with one set of points.
+</p>
+</li></ul>
+
+
+
+
<h3>Changes in version 2.0-3</h3>
@@ -38,9 +154,9 @@ two or more groups and decomposes the average between-group
Bray-Curtis dissimilarity index to contributions by individual
species. The code was developed in
<a href="https://github.com/jarioksa/vegan">GitHub</a>
-by Eduard Szöcz (Uni Landau, Germany).
+by Eduard Szöcs (Uni Landau, Germany).
</p>
-</ul>
+</li></ul>
@@ -72,7 +188,7 @@ requested axes was higher than the ordination object had. This
was reported as an error in <code>ordiplot</code> in
<a href="https://stat.ethz.ch/pipermail/r-sig-ecology/2012-February/002768.html">R-sig-ecology</a> mailing list.
</p>
-</ul>
+</li></ul>
@@ -113,7 +229,7 @@ data with high beta diversity and variable sampling
intensity. Thanks to consultation to Yong Cao (Univ Illinois,
USA).
</p>
-</ul>
+</li></ul>
@@ -155,7 +271,7 @@ following fixing of the first bug. In fixing both bugs, a
speed-up in the internal f.test() function is fully
realised. Reported by Nicholas Lewin-Koh.
</p>
-</ul>
+</li></ul>
@@ -175,7 +291,7 @@ coordinates to which the points were connected. Typically these
are class centroids of each point, but for constrained ordination
with no <code>groups</code> they are the LC scores.
</p>
-</ul>
+</li></ul>
@@ -216,7 +332,7 @@ follows Chase et al. (2011) <EM>Ecosphere</EM> 2:art24
[<a href="http://www.esajournals.org/doi/abs/10.1890/ES10-00117.1">doi:10.1890/ES10-00117.1</a>],
and was developed with the consultation of Brian Inouye.
</p>
-</ul>
+</li></ul>
@@ -255,7 +371,7 @@ changed to adapt to this change (<code>rda</code>, <code>capscale</code>,
results but you probably wish to upgrade <span class="pkg">vegan</span> to avoid
annoying warnings.
</p>
-</ul>
+</li></ul>
@@ -270,7 +386,7 @@ to optimize the statistic for tied column frequencies. Tracing
showed that in most cases an improved ordering was found rather
early in tries, and the results are equally good in most cases.
</p>
-</ul>
+</li></ul>
@@ -306,7 +422,7 @@ schemes. All <span class="pkg">vegan</span> permutation will gradually move to u
<span class="pkg">permute</span>, but currently only <code>betadisper</code> uses the new
feature.
</p>
-</ul>
+</li></ul>
@@ -362,7 +478,7 @@ directly in non-linear regression with <code>nls</code>. These functions
were implemented because they were found good for species-area
models by Dengler (<EM>J. Biogeogr.</EM> 36, 728-744; 2009).
</p>
-</ul>
+</li></ul>
@@ -404,7 +520,7 @@ levels in the grouping factor <code>pool</code>. Now also checks that
the length of the <code>pool</code> matches the number of
observations.
</p>
-</ul>
+</li></ul>
@@ -423,7 +539,7 @@ code was removed in favour of the <span class="pkg">permute</span> package. This
was not intended for normal use, but packages depending on that
code in <span class="pkg">vegan</span> should instead depend on <span class="pkg">permute</span>.
</p>
-</ul>
+</li></ul>
@@ -436,7 +552,7 @@ code in <span class="pkg">vegan</span> should instead depend on <span class="pkg
<li> <p><code>treeheight</code> uses much snappier code. The results
should be unchanged.
</p>
-</ul>
+</li></ul>
diff --git a/inst/doc/decision-vegan.Rnw b/inst/doc/decision-vegan.Rnw
index c080e68..6e2e642 100644
--- a/inst/doc/decision-vegan.Rnw
+++ b/inst/doc/decision-vegan.Rnw
@@ -21,7 +21,7 @@ another document.
\Keywords{nestdness, matrix temperature, community null models, scaling of PCA and RDA, WA
and LC scores}
%% hijack Address for version info
-\Address{$ $Id: decision-vegan.Rnw 1799 2011-09-07 12:06:12Z jarioksa $ $
+\Address{$ $Id: decision-vegan.Rnw 1709 2011-08-10 15:48:21Z jarioksa $ $
processed with vegan
\Sexpr{packageDescription("vegan", field="Version")}
in \Sexpr{R.version.string} on \today}
diff --git a/inst/doc/decision-vegan.pdf b/inst/doc/decision-vegan.pdf
index d9de7c2..099ab42 100644
Binary files a/inst/doc/decision-vegan.pdf and b/inst/doc/decision-vegan.pdf differ
diff --git a/inst/doc/decision-vegan.tex b/inst/doc/decision-vegan.tex
index 5d3b4fe..2d8d799 100644
--- a/inst/doc/decision-vegan.tex
+++ b/inst/doc/decision-vegan.tex
@@ -21,10 +21,10 @@ another document.
\Keywords{nestdness, matrix temperature, community null models, scaling of PCA and RDA, WA
and LC scores}
%% hijack Address for version info
-\Address{$ $Id: decision-vegan.Rnw 1799 2011-09-07 12:06:12Z jarioksa $ $
+\Address{$ $Id: decision-vegan.Rnw 1709 2011-08-10 15:48:21Z jarioksa $ $
processed with vegan
-2.0-3
-in R version 2.14.2 (2012-02-29) on \today}
+2.0-4
+in R Under development (unstable) (2012-06-18 r59572) on \today}
\Footername{About this version}
%% need no \usepackage{Sweave.sty}
@@ -500,17 +500,17 @@ Call: cca(formula = varespec[i, ] ~ Al + K, data = varechem)
Inertia Proportion Rank
Total 2.08320 1.00000
-Constrained 0.14532 0.06976 2
-Unconstrained 1.93788 0.93024 21
+Constrained 0.19245 0.09238 2
+Unconstrained 1.89075 0.90762 21
Inertia is mean squared contingency coefficient
Eigenvalues for constrained axes:
CCA1 CCA2
-0.10320 0.04212
+0.10480 0.08764
Eigenvalues for unconstrained axes:
- CA1 CA2 CA3 CA4 CA5 CA6 CA7 CA8
-0.4848 0.3479 0.2323 0.1846 0.1536 0.1198 0.1121 0.0821
+ CA1 CA2 CA3 CA4 CA5 CA6 CA7 CA8
+0.46635 0.33696 0.23103 0.18183 0.14526 0.12137 0.09830 0.08624
(Showed only 8 of all 21 unconstrained eigenvalues)
\end{Soutput}
\end{Schunk}
@@ -537,11 +537,11 @@ R> proc <- procrustes(scores(tmp1, dis="lc", choi=1:14), scores(tmp2, dis="lc",
R> max(residuals(proc))
\end{Sinput}
\begin{Soutput}
-[1] 3.1445e-14
+[1] 2.703843e-14
\end{Soutput}
\end{Schunk}
In \code{cca} the difference would be somewhat larger than now
-observed 3.1445e-14 because site
+observed 2.7038e-14 because site
weights used for environmental variables are shuffled with the species
data.
diff --git a/inst/doc/diversity-vegan.pdf b/inst/doc/diversity-vegan.pdf
index 7840da1..620a38e 100644
Binary files a/inst/doc/diversity-vegan.pdf and b/inst/doc/diversity-vegan.pdf differ
diff --git a/inst/doc/diversity-vegan.tex b/inst/doc/diversity-vegan.tex
index 51a1c81..4db4836 100644
--- a/inst/doc/diversity-vegan.tex
+++ b/inst/doc/diversity-vegan.tex
@@ -31,8 +31,8 @@
%% misuse next for scm data
\Address{$ $Id: diversity-vegan.Rnw 1801 2011-09-07 16:04:10Z jarioksa $ $
- processed with vegan 2.0-3
- in R version 2.14.2 (2012-02-29) on \today}
+ processed with vegan 2.0-4
+ in R Under development (unstable) (2012-06-18 r59572) on \today}
\Footername{About this version}
%% need no \usepackage{Sweave}
@@ -353,16 +353,16 @@ R> fish
\end{Sinput}
\begin{Soutput}
Fisher log series model
-No. of species: 80
+No. of species: 102
Estimate Std. Error
-alpha 27.171 3.6892
+alpha 44.064 5.5838
\end{Soutput}
\end{Schunk}
\begin{SCfigure}
\includegraphics{diversity-vegan-018}
\caption{Fisher's log-series fitted to one randomly selected site
- (40).}
+ (41).}
\label{fig:fisher}
\end{SCfigure}
We already saw $\alpha$ as a diversity index. Now we also obtained
@@ -380,7 +380,7 @@ R> confint(fish)
\end{Sinput}
\begin{Soutput}
2.5 % 97.5 %
-20.68319 35.23536
+34.21748 56.25208
\end{Soutput}
\end{Schunk}
@@ -404,7 +404,7 @@ the lower octave.
Function \code{prestondistr} directly
maximizes truncated log-normal likelihood without binning data, and it
is the recommended alternative. Log-normal models usually fit poorly
-to the BCI data, but here our random plot (number 40):
+to the BCI data, but here our random plot (number 41):
\begin{Schunk}
\begin{Sinput}
R> prestondistr(BCI[k,])
@@ -412,18 +412,15 @@ R> prestondistr(BCI[k,])
\begin{Soutput}
Preston lognormal model
Method: maximized likelihood to log2 abundances
-No. of species: 80
+No. of species: 102
mode width S0
- 0.6529285 1.9636727 20.3151885
+ 0.6954283 1.7260910 28.1654616
Frequencies by Octave
- 0 1 2 3 4 5
-Observed 15.00000 22.50000 22.00000 14.500000 1.000000 1.000000
-Fitted 19.22265 20.00034 16.05586 9.944927 4.752715 1.752484
- 6 7
-Observed 2.0000000 2.0000000
-Fitted 0.4985841 0.1094447
+ 0 1 2 3 4 5
+Observed 22.50000 32.00000 21.00000 13.5000 8.000000 5.000000
+Fitted 25.96983 27.73039 21.16784 11.5513 4.506289 1.256727
\end{Soutput}
\end{Schunk}
@@ -462,20 +459,20 @@ R> rad
\end{Sinput}
\begin{Soutput}
RAD models, family poisson
-No. of species 80, total abundance 489
-
- par1 par2 par3 Deviance AIC BIC
-Null 334.172 562.847 562.847
-Preemption 0.075747 286.805 517.480 519.862
-Lognormal 0.6452 1.5736 91.776 324.451 329.215
-Zipf 0.24984 -1.1192 45.387 278.062 282.826
-Mandelbrot 0.45728 -1.3027 0.74902 38.383 273.058 280.204
+No. of species 102, total abundance 402
+
+ par1 par2 par3 Deviance AIC BIC
+Null 59.9800 342.5388 342.5388
+Preemption 0.040337 47.8801 332.4389 335.0639
+Lognormal 0.80833 1.0772 24.2781 310.8369 316.0869
+Zipf 0.11928 -0.7903 36.6726 323.2314 328.4813
+Mandelbrot 2.3922 -1.5273 9.0795 7.0992 295.6580 303.5330
\end{Soutput}
\end{Schunk}
\begin{SCfigure}
\includegraphics{diversity-vegan-022}
\caption{Ranked abundance distribution models for a random plot
- (no. 40). The best model has the lowest \textsc{aic}.}
+ (no. 41). The best model has the lowest \textsc{aic}.}
\label{fig:rad}
\end{SCfigure}
@@ -780,10 +777,10 @@ R> s <- sample(nrow(BCI), 25)
R> specpool(BCI[s,])
\end{Sinput}
\begin{Soutput}
- Species chao chao.se jack1 jack1.se jack2 boot boot.se
-All 210 236.4706 12.69304 238.8 7.513188 251.4117 223.4318 4.261795
- n
-All 25
+ Species chao chao.se jack1 jack1.se jack2 boot
+All 204 219.5588 8.479327 226.08 6.505136 232.2517 214.9225
+ boot.se n
+All 3.946063 25
\end{Soutput}
\end{Schunk}
@@ -800,12 +797,12 @@ two of these methods:
R> estimateR(BCI[k,])
\end{Sinput}
\begin{Soutput}
- 40
-S.obs 80.000000
-S.chao1 107.187500
-se.chao1 14.491377
-S.ACE 106.546379
-se.ACE 4.898308
+ 41
+S.obs 102.000000
+S.chao1 151.500000
+se.chao1 21.334825
+S.ACE 161.646487
+se.ACE 6.839367
\end{Soutput}
\end{Schunk}
Chao's method is similar as above, but uses another, ``unbiased''
@@ -848,14 +845,14 @@ R> veiledspec(prestondistr(BCI[k,]))
\end{Sinput}
\begin{Soutput}
Extrapolated Observed Veiled
- 99.99537 80.00000 19.99537
+ 121.86261 102.00000 19.86261
\end{Soutput}
\begin{Sinput}
R> veiledspec(BCI[k,])
\end{Sinput}
\begin{Soutput}
Extrapolated Observed Veiled
- 109.7042 80.0000 29.7042
+ 146.08199 102.00000 44.08199
\end{Soutput}
\end{Schunk}
diff --git a/inst/doc/intro-vegan.Rnw b/inst/doc/intro-vegan.Rnw
index 511a049..15f3641 100644
--- a/inst/doc/intro-vegan.Rnw
+++ b/inst/doc/intro-vegan.Rnw
@@ -34,7 +34,7 @@
vector, fitted environmental surface, permutation tests}
%% misuse of the address field for revision data
-\Address{$ $Id: intro-vegan.Rnw 1799 2011-09-07 12:06:12Z jarioksa $ $
+\Address{$ $Id: intro-vegan.Rnw 1709 2011-08-10 15:48:21Z jarioksa $ $
processed with vegan
\Sexpr{packageDescription("vegan", field="Version")}
in \Sexpr{R.version.string} on \today}
diff --git a/inst/doc/intro-vegan.pdf b/inst/doc/intro-vegan.pdf
index 43ae188..a30de5e 100644
Binary files a/inst/doc/intro-vegan.pdf and b/inst/doc/intro-vegan.pdf differ
diff --git a/inst/doc/intro-vegan.tex b/inst/doc/intro-vegan.tex
index cfd875d..f1b8862 100644
--- a/inst/doc/intro-vegan.tex
+++ b/inst/doc/intro-vegan.tex
@@ -34,10 +34,10 @@
vector, fitted environmental surface, permutation tests}
%% misuse of the address field for revision data
-\Address{$ $Id: intro-vegan.Rnw 1799 2011-09-07 12:06:12Z jarioksa $ $
+\Address{$ $Id: intro-vegan.Rnw 1709 2011-08-10 15:48:21Z jarioksa $ $
processed with vegan
-2.0-3
-in R version 2.14.2 (2012-02-29) on \today}
+2.0-4
+in R Under development (unstable) (2012-06-18 r59572) on \today}
\Footername{About this version}
%% need no \usepackage{Sweave}
@@ -128,8 +128,8 @@ R> ord <- metaMDS(dune)
\end{Sinput}
\begin{Soutput}
Run 0 stress 0.1192691
-Run 1 stress 0.119271
-... procrustes: rmse 0.001287577 max resid 0.00370656
+Run 1 stress 0.11927
+... procrustes: rmse 0.001094789 max resid 0.003155725
*** Solution reached
\end{Soutput}
\begin{Sinput}
@@ -306,7 +306,7 @@ R> ord.fit
***VECTORS
NMDS1 NMDS2 r2 Pr(>r)
-A1 0.99055 0.13712 0.38 0.01499 *
+A1 0.99055 0.13712 0.38 0.01598 *
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
P values based on 1000 permutations.
@@ -322,7 +322,7 @@ ManagementSF 0.1490 -0.4656
Goodness of fit:
r2 Pr(>r)
-Management 0.4142 0.001998 **
+Management 0.4142 0.008991 **
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
P values based on 1000 permutations.
@@ -350,7 +350,7 @@ Link function: identity
Formula:
y ~ s(x1, x2, k = knots)
-<environment: 0x10323f0e8>
+<environment: 0x4501508>
Estimated degrees of freedom:
2 total = 3
@@ -496,7 +496,7 @@ Terms added sequentially (first to last)
Model: cca(formula = dune ~ A1 + Management, data = dune.env)
Df Chisq F N.Perm Pr(>F)
-A1 1 0.2248 2.5245 199 0.005 **
+A1 1 0.2248 2.5245 199 0.020 *
Management 3 0.5550 2.0780 199 0.005 **
Residual 15 1.3355
---
@@ -517,7 +517,7 @@ Marginal effects of terms
Model: cca(formula = dune ~ A1 + Management, data = dune.env)
Df Chisq F N.Perm Pr(>F)
-A1 1 0.1759 1.9761 1299 0.03308 *
+A1 1 0.1759 1.9761 1199 0.03333 *
Management 3 0.5550 2.0780 199 0.00500 **
Residual 15 1.3355
---
@@ -534,9 +534,9 @@ R> anova(ord, by="axis", perm=500)
Model: cca(formula = dune ~ A1 + Management, data = dune.env)
Df Chisq F N.Perm Pr(>F)
CCA1 1 0.3187 3.5801 199 0.005 **
-CCA2 1 0.2372 2.6640 199 0.005 **
-CCA3 1 0.1322 1.4845 199 0.115
-CCA4 1 0.0917 1.0297 99 0.420
+CCA2 1 0.2372 2.6640 199 0.010 **
+CCA3 1 0.1322 1.4845 299 0.100 .
+CCA4 1 0.0917 1.0297 99 0.380
Residual 15 1.3355
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
@@ -591,10 +591,10 @@ Permutation test for cca under reduced model
Terms added sequentially (first to last)
Model: cca(formula = dune ~ A1 + Management + Condition(Moisture), data = dune.env)
- Df Chisq F N.Perm Pr(>F)
-A1 1 0.1154 1.4190 99 0.09 .
-Management 3 0.3954 1.6205 99 0.04 *
-Residual 12 0.9761
+ Df Chisq F N.Perm Pr(>F)
+A1 1 0.1154 1.4190 99 0.10 .
+Management 3 0.3954 1.6205 99 0.01 **
+Residual 12 0.9761
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
\end{Soutput}
@@ -613,7 +613,7 @@ Permutations stratified within 'Moisture'
Model: cca(formula = dune ~ A1 + Management + Condition(Moisture), data = dune.env)
Df Chisq F N.Perm Pr(>F)
-A1 1 0.1154 1.4190 99 0.21
+A1 1 0.1154 1.4190 99 0.26
Management 3 0.3954 1.6205 99 0.01 **
Residual 12 0.9761
---
diff --git a/man/adipart.Rd b/man/adipart.Rd
index 03a07c7..3a0f775 100644
--- a/man/adipart.Rd
+++ b/man/adipart.Rd
@@ -1,7 +1,12 @@
\encoding{UTF-8}
\name{adipart}
\alias{adipart}
+\alias{adipart.default}
+\alias{adipart.formula}
+\alias{print.adipart}
\alias{hiersimu}
+\alias{hiersimu.default}
+\alias{hiersimu.formula}
\alias{print.hiersimu}
\title{Additive Diversity Partitioning and Hierarchical Null Model Testing}
\description{
@@ -11,12 +16,25 @@ In hierarchical null model testing, a statistic returned by a function is evalua
according to a nested hierarchical sampling design (\code{hiersimu}).
}
\usage{
-adipart(formula, data, index=c("richness", "shannon", "simpson"),
+adipart(...)
+\method{adipart}{default}(y, x, index=c("richness", "shannon", "simpson"),
weights=c("unif", "prop"), relative = FALSE, nsimul=99, ...)
-hiersimu(formula, data, FUN, location = c("mean", "median"),
+\method{adipart}{formula}(formula, data, index=c("richness", "shannon", "simpson"),
+ weights=c("unif", "prop"), relative = FALSE, nsimul=99, ...)
+
+hiersimu(...)
+\method{hiersimu}{default}(y, x, FUN, location = c("mean", "median"),
+ relative = FALSE, drop.highest = FALSE, nsimul=99, ...)
+\method{hiersimu}{formula}(formula, data, FUN, location = c("mean", "median"),
relative = FALSE, drop.highest = FALSE, nsimul=99, ...)
}
\arguments{
+ \item{y}{A community matrix.}
+ \item{x}{A matrix with same number of rows as in \code{y}, columns
+ coding the levels of sampling hierarchy. The number of groups within
+ the hierarchy must decrease from left to right. If \code{x} is missing,
+ two levels are assumed: each row is a group in the first level, and
+ all rows are in the same group in the second level.}
\item{formula}{A two sided model formula in the form \code{y ~ x}, where \code{y}
is the community data matrix with samples as rows and species as column. Right
hand side (\code{x}) must contain factors referring to levels of sampling hierarchy,
@@ -124,10 +142,12 @@ plot(mite.xy, main="l2", col=as.numeric(levsm$l2)+1)
plot(mite.xy, main="l3", col=as.numeric(levsm$l3)+1)
par(mfrow=c(1,1))
## Additive diversity partitioning
-adipart(mite ~., levsm, index="richness", nsimul=19)
+adipart(mite, index="richness", nsimul=19)
+adipart(mite ~ ., levsm, index="richness", nsimul=19)
## Hierarchical null model testing
## diversity analysis (similar to adipart)
-hiersimu(mite ~., levsm, diversity, relative=TRUE, nsimul=19)
+hiersimu(mite, FUN=diversity, relative=TRUE, nsimul=19)
+hiersimu(mite ~., levsm, FUN=diversity, relative=TRUE, nsimul=19)
## Hierarchical testing with the Morisita index
morfun <- function(x) dispindmorisita(x)$imst
hiersimu(mite ~., levsm, morfun, drop.highest=TRUE, nsimul=19)
diff --git a/man/adonis.Rd b/man/adonis.Rd
index ed7cfea..899497f 100644
--- a/man/adonis.Rd
+++ b/man/adonis.Rd
@@ -137,6 +137,18 @@ overview of rules.
side of the formula.}
\item{terms}{The \code{\link{terms}} component of the model.}
}
+
+\note{Anderson (2001, Fig. 4) warns that the method may confound
+ location and dispersion effects: significant differences may be caused
+ by different within-group variation (dispersion) instead of different
+ mean values of the groups (see Warton et al. 2012 for a general
+ analysis). However, it seems that \code{adonis} is less sensitive to
+ dispersion effects than some of its alternatives (\code{link{anosim}},
+ \code{\link{mrpp}}). Function \code{\link{betadisper}} is a sister
+ function to \code{adonis} to study the differences in dispersion
+ within the same geometric framework.
+}
+
\references{
Anderson, M.J. 2001. A new method for non-parametric multivariate
analysis of variance. \emph{Austral Ecology}, \strong{26}: 32--46.
@@ -157,6 +169,10 @@ McArdle, B.H. and M.J. Anderson. 2001. Fitting multivariate models to
community data: A comment on distance-based redundancy
analysis. \emph{Ecology}, \strong{82}: 290--297.
+Warton, D.I., Wright, T.W., Wang, Y. 2012. Distance-based multivariate
+analyses confound location and dispersion effects. \emph{Methods in
+Ecology and Evolution}, 3, 89--101.
+
Zapala, M.A. and N.J. Schork. 2006. Multivariate regression analysis of
distance matrices for testing associations between gene expression
patterns and related variables. \emph{Proceedings of the National Academy of
diff --git a/man/anosim.Rd b/man/anosim.Rd
index 462a3e7..3fb0217 100644
--- a/man/anosim.Rd
+++ b/man/anosim.Rd
@@ -79,14 +79,23 @@ anosim(dat, grouping, permutations = 999, distance = "bray", strata)
}
\references{
Clarke, K. R. (1993). Non-parametric multivariate analysis of changes
- in community structure. \emph{Australian Journal of Ecology} 18, 117-143.
+ in community structure. \emph{Australian Journal of Ecology} 18,
+ 117--143.
+
+ Warton, D.I., Wright, T.W., Wang, Y. 2012. Distance-based multivariate
+ analyses confound location and dispersion effects. \emph{Methods in
+ Ecology and Evolution}, 3, 89--101
+
}
\author{Jari Oksanen, with a help from Peter R. Minchin.}
\note{
- I don't quite trust this method. Somebody should study its
- performance carefully. The function returns a lot of information
- to ease further scrutiny. Most \code{anosim} models could be analysed
- with \code{\link{adonis}} which seems to be a more robust alternative.
+
+ The \code{anosim} function can confound the differences between groups
+ and dispersion within groups and the results can be difficult to
+ interpret (cf. Warton et al. 2012). The function returns a lot of
+ information to ease studying its performance. Most \code{anosim}
+ models could be analysed with \code{\link{adonis}} which seems to be a
+ more robust alternative.
}
diff --git a/man/anova.cca.Rd b/man/anova.cca.Rd
index 44b13d8..353d6b9 100644
--- a/man/anova.cca.Rd
+++ b/man/anova.cca.Rd
@@ -91,7 +91,7 @@ permutest(x, ...)
respective ranks. If there are no conditions (\dQuote{partial} terms), the
sum of all eigenvalues remains constant, so that pseudo-\eqn{F} and
eigenvalues would give equal results. In partial CCA/RDA/CAP, the
- effect of conditioning variables (\dQuote{covariables} is removed before
+ effect of conditioning variables (\dQuote{covariables}) is removed before
permutation, and these residuals are added to the non-permuted fitted
values of partial CCA (fitted values of \code{X ~ Z}). Consequently,
the total Chi-square is not fixed, and test based on pseudo-\eqn{F}
diff --git a/man/betadisper.Rd b/man/betadisper.Rd
index 8e7e295..b6fd06a 100644
--- a/man/betadisper.Rd
+++ b/man/betadisper.Rd
@@ -1,3 +1,4 @@
+\encoding{UTF-8}
\name{betadisper}
\alias{betadisper}
\alias{scores.betadisper}
@@ -25,7 +26,7 @@
Tukey's 'Honest Significant Difference' method.
}
\usage{
-betadisper(d, group, type = c("median","centroid"))
+betadisper(d, group, type = c("median","centroid"), bias.adjust = FALSE)
\method{anova}{betadisper}(object, \dots)
@@ -38,7 +39,7 @@ betadisper(d, group, type = c("median","centroid"))
\method{boxplot}{betadisper}(x, ylab = "Distance to centroid", ...)
\method{TukeyHSD}{betadisper}(x, which = "group", ordered = FALSE,
- conf.level = 0.95, \ldots)
+ conf.level = 0.95, \dots)
}
\arguments{
@@ -50,7 +51,8 @@ betadisper(d, group, type = c("median","centroid"))
\code{\link[base]{as.factor}}. Can consist of a factor with a single
level (i.e.~one group).}
\item{type}{the type of analysis to perform. Use the spatial median or
- the group centroid? The spatial median is now the default.}
+ the group centroid? The spatial median is now the default.}
+ \item{bias.adjust}{logical: adjust for small sample bias in beta diversity estimates?}
\item{display}{character; partial match to access scores for
\code{"sites"} or \code{"species"}.}
\item{object, x}{an object of class \code{"betadisper"}, the result of a
@@ -133,6 +135,14 @@ betadisper(d, group, type = c("median","centroid"))
One additional use of these functions is in assessing beta diversity
(Anderson \emph{et al} 2006). Function \code{\link{betadiver}}
provides some popular dissimilarity measures for this purpose.
+
+ As noted in passing by Anderson (2001) and in a related
+ context by O'Neill (2000), estimates of dispersion around a
+ central location (median or centroid) that is calculated from the same data
+ will be biased downward. This bias matters most when comparing diversity
+ among treatments with small, unequal numbers of samples. Setting
+ \code{bias.adjust=TRUE} when using \code{betadisper} imposes a
+ \eqn{\sqrt{n/(n-1)}}{sqrt(n/(n-1))} correction (Stier et al. 2012).
}
\value{
The \code{anova} method returns an object of class \code{"anova"}
@@ -184,14 +194,25 @@ betadisper(d, group, type = c("median","centroid"))
error rates.
}
\references{
+ Anderson, M. J. (2001) A new method for non-parametric multivariate
+ analysis of variance. \emph{Austral Ecology} \strong{26}, 32--46.
+
Anderson, M.J. (2006) Distance-based tests for homogeneity of
- multivariate dispersions. \emph{Biometrics} \strong{62(1)}, 245--253.
+ multivariate dispersions. \emph{Biometrics} \strong{62}, 245--253.
Anderson, M.J., Ellingsen, K.E. & McArdle, B.H. (2006) Multivariate
dispersion as a measure of beta diversity. \emph{Ecology Letters}
- \strong{9(6)}, 683--693.
+ \strong{9}, 683--693.
+
+ O'Neill, M.E. (2000) A Weighted Least Squares Approach to Levene's
+ Test of Homogeneity of Variance. \emph{Australian & New Zealand Journal of
+ Statistics} \strong{42}, 81-–100.
+
+ Stier, A.C., Geange, S.W., Hanson, K.M., & Bolker, B.M. (2012) Predator
+ density and timing of arrival affect reef fish community assembly. Ms.
+ in revision, \emph{Oikos}.
}
-\author{Gavin L. Simpson}
+\author{Gavin L. Simpson; bias correction by Adrian Stier and Ben Bolker.}
\seealso{\code{\link{permutest.betadisper}}, \code{\link[stats]{anova.lm}},
\code{\link{scores}}, \code{\link[graphics]{boxplot}},
\code{\link{TukeyHSD}}. Further measure of beta diversity
@@ -230,6 +251,7 @@ plot(mod, axes = c(3,1))
boxplot(mod)
## simulate missing values in 'd' and 'group'
+## using spatial medians
groups[c(2,20)] <- NA
dis[c(2, 20)] <- NA
mod2 <- betadisper(dis, groups) ## warnings
@@ -240,14 +262,18 @@ plot(mod2)
boxplot(mod2)
plot(TukeyHSD(mod2))
-## Using spatial median
-mod3 <- betadisper(dis, groups, type = "median")
+## Using group centroids
+mod3 <- betadisper(dis, groups, type = "centroid")
mod3
permutest(mod3, control = permControl(nperm = 100))
anova(mod3)
plot(mod3)
boxplot(mod3)
plot(TukeyHSD(mod3))
+
+## try out bias correction; compare with mod3
+(mod3B <- betadisper(dis, groups, type = "median", bias.adjust=TRUE))
+
}
\keyword{methods}
\keyword{multivariate}
diff --git a/man/bioenv.Rd b/man/bioenv.Rd
index 9e90ac1..a23b1d7 100644
--- a/man/bioenv.Rd
+++ b/man/bioenv.Rd
@@ -18,11 +18,12 @@
}
\arguments{
- \item{comm}{Community data frame. }
+ \item{comm}{Community data frame or a dissimilarity object or a square
+ matrix that can be interpreted as dissimilarities. }
\item{env}{Data frame of continuous environmental variables. }
\item{method}{The correlation method used in \code{\link{cor}}.}
- \item{index}{The dissimilarity index used for community data in
- \code{\link{vegdist}}. }
+ \item{index}{The dissimilarity index used for community data (\code{comm})
+ in \code{\link{vegdist}}. This is ignored if \code{comm} are dissimilarities.}
\item{upto}{Maximum number of parameters in studied subsets.}
\item{formula, data}{Model \code{\link{formula}} and data.}
\item{trace}{Trace the advance of calculations }
diff --git a/man/decostand.Rd b/man/decostand.Rd
index 4bf9c9a..f543802 100644
--- a/man/decostand.Rd
+++ b/man/decostand.Rd
@@ -99,11 +99,11 @@ wisconsin(x)
Legendre, P. & Gallagher, E.D. (2001) Ecologically meaningful
transformations for ordination of species data. \emph{Oecologia}
- \strong{129}; 271--280.
+ \strong{129}, 271--280.
Oksanen, J. (1983) Ordination of boreal heath-like vegetation with
principal component analysis, correspondence analysis and
- multidimensional scaling. \emph{Vegetatio} \strong{52}; 181--189.
+ multidimensional scaling. \emph{Vegetatio} \strong{52}, 181--189.
}
\examples{
diff --git a/man/envfit.Rd b/man/envfit.Rd
index baf0cb3..da04ecc 100644
--- a/man/envfit.Rd
+++ b/man/envfit.Rd
@@ -19,7 +19,7 @@
display = "sites", w = weights(ord), na.rm = FALSE, ...)
\method{envfit}{formula}(formula, data, ...)
\method{plot}{envfit}(x, choices = c(1,2), arrow.mul, at = c(0,0), axis = FALSE,
- p.max = NULL, col = "blue", add = TRUE, ...)
+ p.max = NULL, col = "blue", bg, add = TRUE, ...)
\method{scores}{envfit}(x, display, choices, ...)
vectorfit(X, P, permutations = 0, strata, w, ...)
factorfit(X, P, permutations = 0, strata, w, ...)
@@ -56,6 +56,9 @@ factorfit(X, P, permutations = 0, strata, w, ...)
variables. You must calculate \eqn{P} values with setting
\code{permutations} to use this option. }
\item{col}{Colour in plotting.}
+ \item{bg}{Background colour for labels. If \code{bg} is set, the
+ labels are displayed with \code{\link{ordilabel}} instead of
+ \code{text}. See Examples for using semitransparent background.}
\item{add}{Results added to an existing ordination plot.}
\item{strata}{An integer vector or factor specifying the strata for
permutation. If supplied, observations are permuted only within the
@@ -195,7 +198,9 @@ plot(ord, type="p")
fit <- envfit(ord, varechem, perm = 999, display = "lc")
plot(fit, p.max = 0.05, col = "red")
## Class variables, formula interface, and displaying the
-## inter-class variability with `ordispider'
+## inter-class variability with `ordispider', and semitransparent
+## white background for labels (semitransparent colours are not
+## supported by all graphics devices)
data(dune)
data(dune.env)
attach(dune.env)
@@ -204,7 +209,7 @@ fit <- envfit(ord ~ Moisture + A1, dune.env, perm = 0)
plot(ord, type = "n")
ordispider(ord, Moisture, col="skyblue")
points(ord, display = "sites", col = as.numeric(Moisture), pch=16)
-plot(fit, cex=1.2, axis=TRUE)
+plot(fit, cex=1.2, axis=TRUE, bg = rgb(1, 1, 1, 0.5))
}
\keyword{multivariate }
\keyword{aplot}
diff --git a/man/metaMDS.Rd b/man/metaMDS.Rd
index c751dfc..ecddf2e 100644
--- a/man/metaMDS.Rd
+++ b/man/metaMDS.Rd
@@ -54,7 +54,9 @@ metaMDSredist(object, ...)
In the latter case all other stages are skipped except random
starts and centring and pc rotation of axes. }
\item{distance}{Dissimilarity index used in \code{\link{vegdist}}.}
- \item{k}{Number of dimensions in \code{\link[MASS]{isoMDS}}.}
+ \item{k}{Number of dimensions. NB., the number of points \eqn{n}
+ should be \eqn{n > 2k + 1}{n > 2*k + 1}, and preferably higher in
+ non-metric MDS.}
\item{trymax}{Maximum number of random starts in search of stable
solution.}
diff --git a/man/monoMDS.Rd b/man/monoMDS.Rd
index b33b467..6926395 100644
--- a/man/monoMDS.Rd
+++ b/man/monoMDS.Rd
@@ -26,7 +26,10 @@ monoMDS(dist, y, k = 2, model = c("global", "local", "linear", "hybrid"),
\item{dist}{Input dissimilarities.}
\item{y}{Starting configuration. A random configuration will be
generated if this is missing.}
- \item{k}{Number of dimensions.}
+
+ \item{k}{Number of dimensions. NB., the number of points \eqn{n}
+ should be \eqn{n > 2k + 1}{n > 2*k + 1}, and preferably higher in
+ non-metric MDS.}
\item{model}{MDS model: \code{"global"} is normal non-metric MDS
with a monotone regression, \code{"local"} is non-metric MDS with
diff --git a/man/mrpp.Rd b/man/mrpp.Rd
index 7990f7d..85344a4 100644
--- a/man/mrpp.Rd
+++ b/man/mrpp.Rd
@@ -49,71 +49,74 @@ meandist(dist, grouping, ...)
\item{\dots}{Further arguments passed to functions.}
}
-\details{ Multiple Response Permutation Procedure (MRPP) provides a test
-of whether there is a significant difference between two or more groups
-of sampling units. This difference may be one of location (differences
-in mean) or one of spread (differences in within-group
-distance). Function \code{mrpp} operates on a \code{data.frame} matrix
-where rows are observations and responses data matrix. The response(s)
-may be uni- or multivariate. The method is philosophically and
-mathematically allied with analysis of variance, in that it compares
-dissimilarities within and among groups. If two groups of sampling units
-are really different (e.g. in their species composition), then average
-of the within-group compositional dissimilarities ought to be less than
-the average of the dissimilarities between two random collection of
-sampling units drawn from the entire population.
-
-The mrpp statistic \eqn{\delta} is the overall weighted mean of
-within-group means of the pairwise dissimilarities among sampling
-units. The choice of group weights is currently not clear. The
-\code{mrpp} function offers three choices: (1) group size (\eqn{n}), (2) a
-degrees-of-freedom analogue (\eqn{n-1}), and (3) a weight that is the number
-of unique distances calculated among \eqn{n} sampling units (\eqn{n(n-1)/2}).
-
-The \code{mrpp} algorithm first calculates all pairwise distances in the
-entire dataset, then calculates \eqn{\delta}. It then permutes the
-sampling units and their associated pairwise distances, and recalculates
-\eqn{\delta} based on the permuted data. It repeats the permutation
-step \code{permutations} times. The significance test is the
-fraction of permuted deltas that are less than the observed delta, with
-a small sample correction. The function also calculates the
-change-corrected within-group agreement
-\eqn{A = 1 -\delta/E(\delta)}, where \eqn{E(\delta)} is the expected
-\eqn{\delta} assessed as the average of dissimilarities.
-
-If the first argument \code{dat} can be interpreted as dissimilarities,
-they will be used directly. In other cases the function treats
-\code{dat} as observations, and uses \code{\link{vegdist}} to find the
-dissimilarities. The default \code{distance} is Euclidean as in the
-traditional use of the method, but other dissimilarities in
-\code{\link{vegdist}} also are available.
-
-Function \code{meandist} calculates a matrix of mean within-cluster
-dissimilarities (diagonal) and between-cluster dissimilarities
-(off-diagonal elements), and an attribute \code{n} of \code{grouping}
-counts. Function \code{summary} finds the within-class, between-class
-and overall means of these dissimilarities, and the MRPP statistics with
-all \code{weight.type} options and the Classification Strength, CS (Van
-Sickle and Hughes, 2000). CS is defined for dissimiliraties as
-\eqn{\bar{B} - \bar{W}}{Bbar-Wbar}, where \eqn{\bar{B}}{Bbar} is the
-mean between cluster dissimilarity and \eqn{\bar{W}}{Wbar} is the mean
-within cluster dissimilarity with \code{weight.type = 1}. The function
-does not perform significance tests for these statistics, but you must
-use \code{mrpp} with appropriate \code{weight.type}. There is currently
-no significance test for CS, but \code{mrpp} with \code{weight.type = 1}
-gives the correct test for \eqn{\bar{W}}{Wbar} and a good approximation
-for CS. Function \code{plot} draws a dendrogram or a histogram of the
-result matrix based on the within-group and between group
-dissimilarities. The dendrogram is found with the method given in the
-\code{cluster} argument using function \code{\link{hclust}}. The
-terminal segments hang to within-cluster dissimilarity. If some of the
-clusters are more heterogeneous than the combined class, the leaf
-segment are reversed. The histograms are based on dissimilarites, but
-ore otherwise similar to those of Van Sickle and Hughes (2000):
-horizontal line is drawn at the level of mean between-cluster
-dissimilarity and vertical lines connect within-cluster dissimilarities
-to this line.
-}
+\details{
+
+ Multiple Response Permutation Procedure (MRPP) provides a test of
+ whether there is a significant difference between two or more groups
+ of sampling units. This difference may be one of location (differences
+ in mean) or one of spread (differences in within-group distance;
+ cf. Warton et al. 2012). Function \code{mrpp} operates on a
+ \code{data.frame} matrix where rows are observations and responses
+ data matrix. The response(s) may be uni- or multivariate. The method
+ is philosophically and mathematically allied with analysis of
+ variance, in that it compares dissimilarities within and among
+ groups. If two groups of sampling units are really different (e.g. in
+ their species composition), then average of the within-group
+ compositional dissimilarities ought to be less than the average of the
+ dissimilarities between two random collection of sampling units drawn
+ from the entire population.
+
+ The mrpp statistic \eqn{\delta} is the overall weighted mean of
+ within-group means of the pairwise dissimilarities among sampling
+ units. The choice of group weights is currently not clear. The
+ \code{mrpp} function offers three choices: (1) group size (\eqn{n}),
+ (2) a degrees-of-freedom analogue (\eqn{n-1}), and (3) a weight that
+ is the number of unique distances calculated among \eqn{n} sampling
+ units (\eqn{n(n-1)/2}).
+
+ The \code{mrpp} algorithm first calculates all pairwise distances in
+ the entire dataset, then calculates \eqn{\delta}. It then permutes the
+ sampling units and their associated pairwise distances, and
+ recalculates \eqn{\delta} based on the permuted data. It repeats the
+ permutation step \code{permutations} times. The significance test is
+ the fraction of permuted deltas that are less than the observed delta,
+ with a small sample correction. The function also calculates the
+ change-corrected within-group agreement \eqn{A = 1 -\delta/E(\delta)},
+ where \eqn{E(\delta)} is the expected \eqn{\delta} assessed as the
+ average of dissimilarities.
+
+ If the first argument \code{dat} can be interpreted as
+ dissimilarities, they will be used directly. In other cases the
+ function treats \code{dat} as observations, and uses
+ \code{\link{vegdist}} to find the dissimilarities. The default
+ \code{distance} is Euclidean as in the traditional use of the method,
+ but other dissimilarities in \code{\link{vegdist}} also are available.
+
+ Function \code{meandist} calculates a matrix of mean within-cluster
+ dissimilarities (diagonal) and between-cluster dissimilarities
+ (off-diagonal elements), and an attribute \code{n} of \code{grouping}
+ counts. Function \code{summary} finds the within-class, between-class
+ and overall means of these dissimilarities, and the MRPP statistics
+ with all \code{weight.type} options and the Classification Strength,
+ CS (Van Sickle and Hughes, 2000). CS is defined for dissimiliraties as
+ \eqn{\bar{B} - \bar{W}}{Bbar-Wbar}, where \eqn{\bar{B}}{Bbar} is the
+ mean between cluster dissimilarity and \eqn{\bar{W}}{Wbar} is the mean
+ within cluster dissimilarity with \code{weight.type = 1}. The function
+ does not perform significance tests for these statistics, but you must
+ use \code{mrpp} with appropriate \code{weight.type}. There is
+ currently no significance test for CS, but \code{mrpp} with
+ \code{weight.type = 1} gives the correct test for \eqn{\bar{W}}{Wbar}
+ and a good approximation for CS. Function \code{plot} draws a
+ dendrogram or a histogram of the result matrix based on the
+ within-group and between group dissimilarities. The dendrogram is
+ found with the method given in the \code{cluster} argument using
+ function \code{\link{hclust}}. The terminal segments hang to
+ within-cluster dissimilarity. If some of the clusters are more
+ heterogeneous than the combined class, the leaf segment are reversed.
+ The histograms are based on dissimilarites, but ore otherwise similar
+ to those of Van Sickle and Hughes (2000): horizontal line is drawn at
+ the level of mean between-cluster dissimilarity and vertical lines
+ connect within-cluster dissimilarities to this line. }
\value{
The function returns a list of class mrpp with following items:
@@ -142,7 +145,6 @@ The function returns a list of class mrpp with following items:
B. McCune and J. B. Grace. 2002. \emph{Analysis of Ecological
Communities.} MjM Software Design, Gleneden Beach, Oregon, USA.
-
P. W. Mielke and K. J. Berry. 2001. \emph{Permutation Methods: A
Distance Function Approach.} Springer Series in
Statistics. Springer.
@@ -151,6 +153,9 @@ The function returns a list of class mrpp with following items:
ecoregions, catchments, and geographic clusters of aquatic vertebrates
in Oregon. \emph{J. N. Am. Benthol. Soc.} 19:370--384.
+ Warton, D.I., Wright, T.W., Wang, Y. 2012. Distance-based multivariate
+ analyses confound location and dispersion effects. \emph{Methods in
+ Ecology and Evolution}, 3, 89--101
}
\author{
diff --git a/man/mso.Rd b/man/mso.Rd
index c4b9200..a21405f 100644
--- a/man/mso.Rd
+++ b/man/mso.Rd
@@ -14,7 +14,7 @@ of cca or rda results}
\usage{
mso(object.cca, object.xy, grain = 1, round.up = FALSE, permutations = FALSE)
-msoplot(x, alpha = 0.05, explained = FALSE, ...)
+msoplot(x, alpha = 0.05, explained = FALSE, ylim = NULL, ...)
}
\arguments{
\item{object.cca}{ An object of class cca, created by the \code{\link{cca}} or
@@ -39,6 +39,7 @@ msoplot(x, alpha = 0.05, explained = FALSE, ...)
classes.}
\item{explained}{ If false, suppresses the plotting of the variogram
of explained variance.}
+ \item{ylim}{Limits for y-axis.}
\item{\dots}{Other arguments passed to functions.}
}
\details{
diff --git a/man/multipart.Rd b/man/multipart.Rd
index 762839a..aaf540a 100644
--- a/man/multipart.Rd
+++ b/man/multipart.Rd
@@ -1,6 +1,9 @@
\encoding{UTF-8}
\name{multipart}
\alias{multipart}
+\alias{multipart.default}
+\alias{multipart.formula}
+\alias{print.multipart}
\title{Multiplicative Diversity Partitioning}
\description{
@@ -8,10 +11,19 @@ In multiplicative diversity partitioning, mean values of alpha diversity at lowe
hierarchy are compared to the total diversity in the entire data set or the pooled samples (gamma diversity).
}
\usage{
-multipart(formula, data, index=c("renyi", "tsallis"), scales = 1,
+multipart(...)
+\method{multipart}{default}(y, x, index=c("renyi", "tsallis"), scales = 1,
+ global = FALSE, relative = FALSE, nsimul=99, ...)
+\method{multipart}{formula}(formula, data, index=c("renyi", "tsallis"), scales = 1,
global = FALSE, relative = FALSE, nsimul=99, ...)
}
\arguments{
+ \item{y}{A community matrix.}
+ \item{x}{A matrix with same number of rows as in \code{y}, columns
+ coding the levels of sampling hierarchy. The number of groups within
+ the hierarchy must decrease from left to right. If \code{x} is missing,
+ two levels are assumed: each row is a group in the first level, and
+ all rows are in the same group in the second level.}
\item{formula}{A two sided model formula in the form \code{y ~ x}, where \code{y}
is the community data matrix with samples as rows and species as column. Right
hand side (\code{x}) must contain factors referring to levels of sampling hierarchy,
@@ -101,6 +113,7 @@ levsm <- data.frame(
l3=cutter(mite.xy$y, cut = seq(0, 10, by = 5)),
l4=cutter(mite.xy$y, cut = seq(0, 10, by = 10)))
## Multiplicative diversity partitioning
+multipart(mite, levsm, index="renyi", scales=1, nsimul=19)
multipart(mite ~ ., levsm, index="renyi", scales=1, nsimul=19)
multipart(mite ~ ., levsm, index="renyi", scales=1, nsimul=19, relative=TRUE)
multipart(mite ~ ., levsm, index="renyi", scales=1, nsimul=19, global=TRUE)
diff --git a/man/ordihull.Rd b/man/ordihull.Rd
index 0efb8c7..e269604 100644
--- a/man/ordihull.Rd
+++ b/man/ordihull.Rd
@@ -19,10 +19,10 @@
\usage{
ordihull(ord, groups, display = "sites", draw = c("lines","polygon", "none"),
- show.groups, label = FALSE, ...)
+ col = NULL, alpha = 127, show.groups, label = FALSE, ...)
ordiellipse(ord, groups, display="sites", kind = c("sd","se"), conf,
draw = c("lines","polygon", "none"), w = weights(ord, display),
- col = NULL, show.groups, label = FALSE, ...)
+ col = NULL, alpha = 127, show.groups, label = FALSE, ...)
ordispider(ord, groups, display="sites", w = weights(ord, display),
show.groups, label = FALSE, ...)
ordicluster(ord, cluster, prune = 0, display = "sites",
@@ -43,6 +43,20 @@ ordicluster(ord, cluster, prune = 0, display = "sites",
non-transparent. With \code{none} nothing is drawn, but the
function returns the \code{\link{invisible}} plotting data.}
+ \item{col}{Colour of hull or ellipse lines (if \code{draw = "lines"})
+ or their fills (if \code{draw = "polygon"}) in \code{ordihull} and
+ \code{ordiellipse}. When \code{draw = "polygon"}, the colour of
+ bordering lines can be set with argument \code{border} of the
+ \code{\link{polygon}} function. For other functions the effect
+ depends on the underlining functions this argument is passed to.}
+
+ \item{alpha}{Transparency of the fill \code{col}our with \code{draw
+ = "polygon"} in \code{ordihull} and \code{ordiellipse}. The
+ argument takes precedence over possible transparency definitions
+ of the colour. The value must be in range \eqn{0...255}, and low
+ values are more transparent. Transparency is not available in all
+ graphics devices or file formats.}
+
\item{show.groups}{Show only given groups. This can be a vector, or
\code{TRUE} if you want to show items for which condition is
\code{TRUE}. This argument makes it possible to use different
@@ -69,10 +83,6 @@ ordicluster(ord, cluster, prune = 0, display = "sites",
\item{cluster}{Result of hierarchic cluster analysis, such as
\code{\link{hclust}} or \code{\link[cluster]{agnes}}.}
- \item{col}{Colour of ellipses or ellipse fills in
- \code{ordiellipse}. For other functions the effect depends on the
- underlining functions this argument is passed to.}
-
\item{prune}{Number of upper level hierarchies removed from the
dendrogram. If \code{prune} \eqn{>0}, dendrogram will be
disconnected.}
@@ -139,10 +149,8 @@ ordicluster(ord, cluster, prune = 0, display = "sites",
returns a list of covariance matrices and scales used in drawing the
ellipses. These result objects have a \code{summary} method that
returns the coordinates of the centres of the ellipses or hulls and
- their surface areas in user units. The centres of the hulls may
- differ from the location of the \code{label} which is the centre of
- the points instead of the centre of the polygon. With \code{draw =
- "none"} only the result object is returned and nothing is drawn.
+ their surface areas in user units. With \code{draw = "none"} only
+ the result object is returned and nothing is drawn.
}
@@ -178,7 +186,8 @@ plot(mod, type = "p", display="sites")
ordicluster(mod, hclust(vegdist(dune)), prune=3, col = "blue")
plot(mod, type="n", display = "sites")
text(mod, display="sites", labels = as.character(Management))
-pl <- ordiellipse(mod, Management, kind="se", conf=0.95, lwd=2, col="blue")
+pl <- ordiellipse(mod, Management, kind="se", conf=0.95, lwd=2, draw = "polygon",
+ col="skyblue", border = "blue")
summary(pl)
}
\keyword{aplot }
diff --git a/man/ordiplot3d.Rd b/man/ordiplot3d.Rd
index 2328892..64c956b 100644
--- a/man/ordiplot3d.Rd
+++ b/man/ordiplot3d.Rd
@@ -129,16 +129,19 @@ orglspider(object, groups, display = "sites", w = weights(object, display),
Function \code{ordiplot3d} returns invisibly an object of class
\code{"ordiplot3d"} inheriting from \code{\link{ordiplot}}. The
return object will contain the coordinates projected onto two
- dimensions for \code{"points"}, and possibly for the heads of
- \code{"arrows"} and \code{"centroids"} of environmental
- variables. Functions like \code{\link{identify.ordiplot}},
+ dimensions for \code{points}, and the projected coordinates of
+ \code{origin}, and possibly the projected coordinates of the heads
+ of \code{arrows} and \code{centroids} of environmental variables.
+ Functions like \code{\link{identify.ordiplot}},
\code{\link{points.ordiplot}}, \code{\link{text.ordiplot}} can use
this result, as well as \code{\link{ordihull}} and other functions
- documented with the latter. In addition, the result will contain the
- object returned by \code{\link[scatterplot3d]{scatterplot3d}},
- including function \code{xyz.convert} which projects
- three-dimensional coordinates onto the plane used in the current
- plot (see Examples).
+ documented with the latter. The result will also contain the object
+ returned by \code{\link[scatterplot3d]{scatterplot3d}}, including
+ function \code{xyz.convert} which projects three-dimensional
+ coordinates onto the plane used in the current plot (see
+ Examples). In addition, there is a function \code{envfit.convert}
+ that projects a three-dimensional \code{\link{envfit}} object to the
+ current plot.
Function \code{ordirgl} returns nothing.
@@ -155,6 +158,20 @@ orglspider(object, groups, display = "sites", w = weights(object, display),
that \code{\link[rgl]{rgl.texts}} does not always position the text
like supposed, and it may be safe to verify text location with
corresponding points.
+
+ Function \code{ordiplot3d} is based on
+ \code{\link[scatterplot3d]{scatterplot3d}} which does not allow
+ exactly setting equal aspect ratio for axes. The function tries to
+ circumvent this by setting equal plotting ranges for all axes so that
+ the plot should be a cube. Depending on the dimensions of plotting
+ device, this may fail, and the user should verify that the axes are
+ approximately equal.
+
+ Please note that \code{\link[scatterplot3d]{scatterplot3d}} sets
+ internally some graphical parameters (such as \code{mar} for margins)
+ and does not honour default settings. It is advisable to study
+ carefully the documentation and examples of
+ \code{\link[scatterplot3d]{scatterplot3d}}.
}
\note{The user interface of \pkg{rgl} changed in version 0.65, but
@@ -191,6 +208,17 @@ text(pl, "centroids", col="blue", pos=1, cex = 1)
### Add species using xyz.convert function returned by ordiplot3d
sp <- scores(ord, choices=1:3, display="species", scaling=3)
text(pl$xyz.convert(sp), rownames(sp), cex=0.7, xpd=TRUE)
+### Two ways of adding fitted variables to ordination plots
+ord <- cca(dune)
+ef <- envfit(ord ~ Moisture + A1, dune.env, choices = 1:3)
+### 1. use argument 'envfit'
+ordiplot3d(ord, envfit = ef)
+### 2. use returned envfit.convert function for better user control
+pl3 <- ordiplot3d(ord)
+plot(pl3$envfit.convert(ef), at = pl3$origin)
+### envfit.convert() also handles different 'choices' of axes
+pl3 <- ordiplot3d(ord, choices = c(1,3,2))
+plot(pl3$envfit.convert(ef), at = pl3$origin)
### ordirgl
ordirgl(ord, size=2)
ordirgl(ord, display = "species", type = "t")
diff --git a/man/ordipointlabel.Rd b/man/ordipointlabel.Rd
index 77ceacc..8f6c0db 100644
--- a/man/ordipointlabel.Rd
+++ b/man/ordipointlabel.Rd
@@ -12,7 +12,7 @@
\usage{
ordipointlabel(x, display = c("sites", "species"), choices = c(1, 2),
col = c(1, 2), pch = c("o", "+"), font = c(1, 1),
- cex = c(0.8, 0.8), add = FALSE, ...)
+ cex = c(0.8, 0.8), add = FALSE, select, ...)
}
\arguments{
@@ -24,6 +24,12 @@ ordipointlabel(x, display = c("sites", "species"), choices = c(1, 2),
plot. These should be vectors of the same length as the number of
items in \code{display}.}
\item{add}{ Add to an existing plot. }
+ \item{select}{Items to be displayed. This can either be a logical
+ vector which is \code{TRUE} for displayed items or a vector of indices
+ of displayed items. \code{select} is only used if a single set of
+ scores is being plotted (i.e. \code{length(display) == 1}),
+ otherwise it is ignored and a warning issued. If a logical vector is
+ used, it must have the same length as the scores plotted.}
\item{\dots}{Other arguments passed to \code{\link{points}} and
\code{\link{text}}.}
}
diff --git a/man/predict.cca.Rd b/man/predict.cca.Rd
index 1f1bfaf..cf124ad 100644
--- a/man/predict.cca.Rd
+++ b/man/predict.cca.Rd
@@ -39,16 +39,22 @@
\code{\link{rda}}, \code{\link{capscale}} or \code{\link{decorana}}. }
\item{model}{Show constrained (\code{"CCA"}) or unconstrained
(\code{"CA"}) results. For \code{\link{capscale}} this can also be
- \code{"Imaginary"} for imaginary components with negative eigenvalues. }
+ \code{"Imaginary"} for imaginary components with negative
+ eigenvalues. }
+
\item{newdata}{New data frame to be used in prediction or in
- calibration. Usually this a new community data frame, but for
- \code{predict.cca} \code{type = "lc"} and for constrained component
- with \code{type} \code{"response"} and \code{"working"} it must be
- an environment data frame, If the original model had row or column
- names, then new data must contain rows or columns with the same
- names (row names for species scores, column names for \code{"wa"}
- scores and constraint names of \code{"lc"} scores). In other cases
- the rows or columns must match directly. }
+ calibration. Usually this a new community data frame, but with
+ \code{type = "lc"} and for constrained component with \code{type =
+ "response"} and \code{type = "working"} it must be an environment
+ data frame. The \code{newdata} must have the same number of rows as
+ the original community data for a \code{\link{cca}} result with
+ \code{type = "response"} or \code{type = "working"}. If the
+ original model had row or column names, then new data must contain
+ rows or columns with the same names (row names for species scores,
+ column names for \code{"wa"} scores and constraint names of
+ \code{"lc"} scores). In other cases the rows or columns must match
+ directly. }
+
\item{type}{The type of prediction, fitted values or residuals:
\code{"response"} scales results so that the same ordination gives
the same results, and \code{"working"} gives the values used
@@ -112,7 +118,11 @@
residual or unconstrained component is desired. With these types, the
function uses \code{newdata} to find new \code{"lc"} (constrained) or
\code{"wa"} scores (unconstrained) and then finding the response or
- working data from these new row scores and species scores.
+ working data from these new row scores and species scores. The
+ original site (row) and species (column) weights are used for
+ \code{type = "response"} and \code{type = "working"} in correspondence
+ analysis (\code{\link{cca}}) and therefore the number of rows must
+ match in the original data and \code{newdata}.
If a completely new data frame is created, extreme care is needed
defining variables similarly as in the original model, in particular
diff --git a/man/pyrifos.Rd b/man/pyrifos.Rd
index 07af153..fe756c9 100644
--- a/man/pyrifos.Rd
+++ b/man/pyrifos.Rd
@@ -10,7 +10,7 @@
}
\usage{data(pyrifos)}
\format{
- A data frame with 132 observations on the log-transformed abundances
+ A data frame with 132 observations on the log-transformed (\code{log(10*x + 1)}) abundances
of 178 species. There are only twelve sites (ditches, mesocosms), but
these were studied repeatedly in eleven occasions. The treatment
levels, treatment times, or ditch ID's are not in the data frame, but
diff --git a/man/simper.Rd b/man/simper.Rd
index 06d24a4..fb49641 100644
--- a/man/simper.Rd
+++ b/man/simper.Rd
@@ -52,6 +52,15 @@ simper(comm, group, ...)
the data frames also include the cumulative contributions and
are ordered by species contribution.
+ The results of \code{simper} can be very difficult to interpret. The
+ method very badly confounds the mean between group differences and
+ within group variation, and seems to single out variable species
+ instead of distinctive species (Warton et al. 2012). Even if you make
+ groups that are copies of each other, the method will single out
+ species with high contribution, but these are not contributions
+ to non-existing between-group differences but to within-group
+ variation in species abundance.
+
}
\value{
@@ -81,6 +90,10 @@ summary(sim)
Clarke, K.R. 1993. Non-parametric multivariate analyses of changes
in community structure. \emph{Australian Journal of Ecology}, 18,
117–143.
+
+ Warton, D.I., Wright, T.W., Wang, Y. 2012. Distance-based multivariate
+ analyses confound location and dispersion effects. \emph{Methods in
+ Ecology and Evolution}, 3, 89--101.
}
\keyword{multivariate}
--
Community Ecology Package for R
More information about the debian-med-commit
mailing list