[med-svn] [r-cran-vegan] 03/07: Imported Upstream version 2.2-1
Charles Plessy
plessy at moszumanska.debian.org
Mon Jun 1 05:26:39 UTC 2015
This is an automated email from the git hooks/post-receive script.
plessy pushed a commit to branch master
in repository r-cran-vegan.
commit dbf766187db25b395acddf11d0119ad7938d90cb
Author: Charles Plessy <plessy at debian.org>
Date: Mon Jun 1 14:11:51 2015 +0900
Imported Upstream version 2.2-1
---
DESCRIPTION | 8 +-
MD5 | 137 +++++++++---------
NAMESPACE | 7 +-
R/adonis.R | 2 +-
R/alias.cca.R | 2 +
R/anosim.R | 9 +-
R/as.hclust.spantree.R | 4 +-
R/as.mlm.R | 7 +-
R/bioenv.default.R | 3 +-
R/biplot.rda.R | 11 +-
R/coef.cca.R | 10 +-
R/coef.rda.R | 6 +-
R/cophenetic.spantree.R | 6 +-
R/estaccumR.R | 38 +++--
R/estimateR.default.R | 31 ++--
R/fitted.capscale.R | 2 +
R/fitted.cca.R | 2 +
R/fitted.rda.R | 2 +
R/intersetcor.R | 2 +
R/lines.spantree.R | 7 +-
R/linestack.R | 36 +++--
R/mantel.R | 2 +-
R/mantel.partial.R | 2 +-
R/metaMDSiter.R | 2 +-
R/mrpp.R | 2 +-
R/oecosimu.R | 2 +-
R/ordiareatest.R | 2 +-
R/orditkplot.R | 275 ++++++++++++++++++------------------
R/permutest.betadisper.R | 5 +-
R/permutest.cca.R | 2 +-
R/plot.spantree.R | 17 ++-
R/poolaccum.R | 14 +-
R/print.mantel.correlog.R | 2 +-
R/renyiaccum.R | 6 +-
R/simper.R | 44 +++---
R/spantree.R | 4 +-
R/specaccum.R | 12 +-
R/specpool.R | 2 +-
R/tolerance.cca.R | 6 +-
R/tsallisaccum.R | 10 +-
R/vegandocs.R | 2 +-
R/vif.cca.R | 2 +
README.md | 7 -
inst/ChangeLog | 11 ++
inst/NEWS.Rd | 66 +++++++++
inst/doc/FAQ-vegan.pdf | Bin 147419 -> 147419 bytes
inst/doc/NEWS.html | 82 +++++++++++
inst/doc/decision-vegan.pdf | Bin 342552 -> 342270 bytes
inst/doc/diversity-vegan.R | 50 +++----
inst/doc/diversity-vegan.Rnw | 245 ++++++++++++++++++++------------
inst/doc/diversity-vegan.pdf | Bin 360242 -> 365631 bytes
inst/doc/intro-vegan.pdf | Bin 234792 -> 234860 bytes
man/betadisper.Rd | 8 +-
man/isomap.Rd | 19 +--
man/kendall.global.Rd | 2 +-
man/linestack.Rd | 31 +++-
man/monoMDS.Rd | 2 +-
man/pcnm.Rd | 2 +-
man/renyi.Rd | 6 +-
man/specaccum.Rd | 7 +-
man/specpool.Rd | 11 +-
man/tsallis.Rd | 8 +-
man/vegandocs.Rd | 5 +-
vignettes/FAQ-vegan.pdf | Bin 147419 -> 147419 bytes
vignettes/NEWS.html | 82 +++++++++++
vignettes/decision-vegan.tex | 18 +--
vignettes/diversity-vegan.Rnw | 245 ++++++++++++++++++++------------
vignettes/diversity-vegan.tex | 321 +++++++++++++++++++++++++-----------------
vignettes/intro-vegan.tex | 57 ++++----
vignettes/vegan.bib | 20 ++-
70 files changed, 1302 insertions(+), 750 deletions(-)
diff --git a/DESCRIPTION b/DESCRIPTION
index a999149..1d4968c 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -1,7 +1,7 @@
Package: vegan
Title: Community Ecology Package
-Version: 2.2-0
-Date: 2014-11-12
+Version: 2.2-1
+Date: 2015-01-12
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
@@ -14,7 +14,7 @@ Description: Ordination methods, diversity analysis and other
License: GPL-2
BugReports: https://github.com/vegandevs/vegan/issues
URL: http://cran.r-project.org, https://github.com/vegandevs/vegan
-Packaged: 2014-11-17 08:25:36 UTC; jarioksa
NeedsCompilation: yes
+Packaged: 2015-01-12 11:19:50 UTC; jarioksa
Repository: CRAN
-Date/Publication: 2014-11-17 11:35:34
+Date/Publication: 2015-01-12 14:18:14
diff --git a/MD5 b/MD5
index c2d57cc..f131969 100644
--- a/MD5
+++ b/MD5
@@ -1,5 +1,5 @@
-f278a514c9adc73ccbd6d250ac171282 *DESCRIPTION
-f4bdaf8740b3d2e8c19c45fe667d1605 *NAMESPACE
+375c32e428aa92db6e2fe820c28e0768 *DESCRIPTION
+11e6529b62c1da1ec84e7af867361ef9 *NAMESPACE
4b8531b446af54510e5fb31f841aed2f *R/AIC.radfit.R
4065e45e7c774b85d8cdf2150affdf18 *R/CCorA.R
6924fe815d768f3b11c25d5f03250524 *R/MDSrotate.R
@@ -15,9 +15,9 @@ d80688d78aba3cd9367ffaaaec6ec252 *R/TukeyHSD.betadisper.R
3fea698281bc0b4c3a5ad26f4d44d0e2 *R/adipart.R
4ec343c3350530e56f917aaffad7f8bc *R/adipart.default.R
05387ee9e552fcec123b4b922e837eaa *R/adipart.formula.R
-581487cf45ae5cb305e54471caa69302 *R/adonis.R
-38726b7dad817378b3fc41094c11595a *R/alias.cca.R
-bc6deb19c3d02f60350485ac221964c3 *R/anosim.R
+e681e6c2fc31d29b4120e51517fdfea9 *R/adonis.R
+fa709efe7fb59234727895d3bbb77419 *R/alias.cca.R
+602cdb75069e4880a5d8c3b6049a984b *R/anosim.R
a4f23289c4a5eab2a3587292b306d497 *R/anova.betadisper.R
68e6eb427d128f411b19e19bb15f4c6c *R/anova.cca.R
208e400508ab4e1e26de5f78e993de3a *R/anova.ccabyterm.R
@@ -25,10 +25,10 @@ a4f23289c4a5eab2a3587292b306d497 *R/anova.betadisper.R
97cbe54d0f4f7adee7a20b6c982d1ecf *R/anova.ccanull.R
7fab08bcc596df60a22c4b04c8507121 *R/anova.prc.R
6fb2bf929aed44ef41bfd4dfc6e010cc *R/as.fisher.R
-3dfd3650a9e487189fea183bc28d8138 *R/as.hclust.spantree.R
+66c29064fff4854203ab2cd50e661558 *R/as.hclust.spantree.R
eee49f0fce625a3b8266b82f05c86aac *R/as.mcmc.oecosimu.R
cfaa7dc7d3f45c29e59e83326f1371d4 *R/as.mcmc.permat.R
-ee820c6d748d3aaa26d7412ea11128aa *R/as.mlm.R
+71fe13d6613d600ccb8b5894a55b87a3 *R/as.mlm.R
340f6a922578c8965803c63e08c5abbf *R/as.mlm.cca.R
ec4c60b2bae11116b56946b136a78ed0 *R/as.mlm.rda.R
a7f01bd69394d5554cf10279a2690080 *R/as.preston.R
@@ -40,10 +40,10 @@ fbec6d133dea10372ce082c7035a8ab2 *R/beals.R
0228981546980ab73c8346a0292fa98d *R/betadiver.R
46ae3f75a0b483fecab589637d72a307 *R/bgdispersal.R
4603ea944d470a9e284cb6cab6d75529 *R/bioenv.R
-b845b8eee0b89eb699958270eb09109f *R/bioenv.default.R
+aa7920b32b33a496be06fcd6d3a0d460 *R/bioenv.default.R
abe03a297a6200d9b48b38c6d92333aa *R/bioenv.formula.R
4dbe9f135fadbba3f6939d64a5bb0e29 *R/biplot.CCorA.R
-bbad1330ec2d53c3a28b0881af3fd3e1 *R/biplot.rda.R
+a214c5bd1447e18f3b6118f850c1a7c3 *R/biplot.rda.R
0999bb90f22b72fade2ca6adbd01758f *R/boxplot.betadisper.R
dd03c1ef27bc56d056dc761fd7ecd153 *R/boxplot.specaccum.R
cbf54233db3c2839101f98e02eb538dd *R/bstick.R
@@ -64,13 +64,13 @@ e01e3acecdb9ac8d9195937e9879d126 *R/cca.formula.R
6102056b628e02085c3bfe779a67c633 *R/centroids.cca.R
c66d8fbe69ccca94f2ee8f777ff16ae2 *R/checkSelect.R
6faf5d12f3e1abb40c0f8d2cfeabc4b4 *R/clamtest.R
-365fa22c822e835218740e858d256526 *R/coef.cca.R
+6ee5070eb4ec1a82e1dd59db5328fa41 *R/coef.cca.R
8ed92f141523fe0cc4c3bb51807b8b07 *R/coef.radfit.R
-ea10763445cb76b219d18bb274109df5 *R/coef.rda.R
+6b212de1ac255f3d8157fd8f8801aeca *R/coef.rda.R
855938510011daed294a819e40c7dfb8 *R/commsim.R
397c7044d52639a5a0ce2557638de486 *R/confint.MOStest.R
d8351b54b16d7327adb545d86fcdac5e *R/contribdiv.R
-d0f10f160ac99ba936824a49c608868a *R/cophenetic.spantree.R
+e0449c3666763adaef0b70a5fffc864c *R/cophenetic.spantree.R
edee3aaced61290b219985d0ce69155c *R/coverscale.R
61f5010b6412918cc9e25bc1a8fdd9d6 *R/decorana.R
c22bdcfe87e2bf710db3b301d880a54a *R/decostand.R
@@ -88,10 +88,10 @@ be739eb24b369efbdaefa03537a5418c *R/eigenvals.R
17a62527ee103c09bfba0c851ab12560 *R/envfit.R
abdc99957cd34d0c5f79ca1d9dd68c68 *R/envfit.default.R
1ef64854841e194d35484feffe7914e5 *R/envfit.formula.R
-f443552fe39ec3d6a259f953f4c3af1b *R/estaccumR.R
+f76323e8a2b239aec6cc9930bcb712b5 *R/estaccumR.R
81098475867f802dea0565fe426c9fc5 *R/estimateR.R
cf0a0bf7116ef7a21e090d0c1a76f8d0 *R/estimateR.data.frame.R
-7fb3e05576a36e717f03a84513858e07 *R/estimateR.default.R
+4563aebce4d1808042d81a6a1bf174b7 *R/estimateR.default.R
1df3194c88598964282c114cb8db5513 *R/estimateR.matrix.R
8a07a85be771af60a831d8b4ed3c8973 *R/eventstar.R
5ad3db71edac392b0513ccb96700af0d *R/extractAIC.cca.R
@@ -100,11 +100,11 @@ cf0a0bf7116ef7a21e090d0c1a76f8d0 *R/estimateR.data.frame.R
ee8330855e6a7bc2350047d76b2209a4 *R/fisher.alpha.R
2776f68ef40e177303c3b73163036969 *R/fisherfit.R
672a4769b413f4f035de3f2c7d03f0ac *R/fitspecaccum.R
-1db8e420fdd54103774d745d356333b8 *R/fitted.capscale.R
-8fc0cd4954e2976b71fe4995291d2fab *R/fitted.cca.R
+55db9d51c5dcefafff9b772b6862e565 *R/fitted.capscale.R
+ee2e3daa463fb46ffce01206f8b44fa5 *R/fitted.cca.R
0080b65cfd48bac5e53961b8e12682e5 *R/fitted.procrustes.R
892cc9bf94b232f6a5c2936ea4f63592 *R/fitted.radfit.R
-30ff7806ee2f3e93b436fa3d1c00fedf *R/fitted.rda.R
+4fa5eb43fa72a6e09773888ba01d4668 *R/fitted.rda.R
c716cff48e68d6b1d74eaefde86f4cd8 *R/gdispweight.R
76b1ffb784bab6671ebaa51c3b4bdb0b *R/getPermuteMatrix.R
57c9a7ccff6a9c066b2aba3475f2330b *R/goodness.R
@@ -122,7 +122,7 @@ d02fc9c672a9b2c4a31065702a3381be *R/humpfit.R
9e731fa2cfb821bbe7ed62336d5fa3b3 *R/indpower.R
6d30d57bbf47d448d0c267964ad7233a *R/inertcomp.R
bf423cb7cf07abc3a4c64229bcc8fc14 *R/initMDS.R
-8de3472b9c7eb28d00cf34b9a7d95587 *R/intersetcor.R
+e999e62071e5f5432881f40fbbb6d4c6 *R/intersetcor.R
c63972a171f76f92652feeb2daf30e82 *R/isomap.R
1e167e69edcee4aa651d97bef81b31e9 *R/isomapdist.R
5abdcd58cf3811e482543d5207114331 *R/kendall.global.R
@@ -133,22 +133,22 @@ f1d30acca998f0fe17e8363203f1b920 *R/lines.permat.R
eb4e11e71eeefa6ec64e4a2580b8af75 *R/lines.prestonfit.R
a5d9b7fa31477efc0a1ff76a62988a8e *R/lines.procrustes.R
39604c069428cda7c9d2ed199ac4e28a *R/lines.radline.R
-f58c42977c7b03c9d2252295068b8846 *R/lines.spantree.R
-e0f782c5a0cb558189b5b15a5bea072f *R/linestack.R
+9a9366b4e132861f1671e5617930b012 *R/lines.spantree.R
+f92ed9f1da4790e02a3fcfc1c199a539 *R/linestack.R
1dcc7e0504b5468a3bb2253924901e50 *R/make.cepnames.R
7e0f2ff685a61a5fdb261024cea5cd8b *R/make.commsim.R
-0bfeef9d6d58fe17761a3773d64421a6 *R/mantel.R
+e4f3f842eee5e4812bdb47325aaf7396 *R/mantel.R
fdb2f4786b31866197c80d827584edaf *R/mantel.correlog.R
-e13a7bd7ffb0d1ca7efd9ff0bb535a78 *R/mantel.partial.R
+963b77f33ee9c5152c358309a94cdddf *R/mantel.partial.R
e054f13ad65a7f2616561c73557b412b *R/meandist.R
57cb748570098b7e5a5aedbddb39fb84 *R/metaMDS.R
26b26e400ead4cf3de31d7eab29c6984 *R/metaMDSdist.R
-6137e51d39b4efadaf2057a0e01faf60 *R/metaMDSiter.R
+0b5c1f0bdf937223613e4c6b6e74764e *R/metaMDSiter.R
f63315501ad2f3a96dee9ee27a867131 *R/metaMDSredist.R
928df675822d321e4533ba2b7cf0c79f *R/model.frame.cca.R
9406148bd2cfa3e74b83adfe24858c46 *R/model.matrix.cca.R
f746e66be6ac3ccc3be9cb4b4b375b4d *R/monoMDS.R
-9f185582be24868f96f963fbe82b517e *R/mrpp.R
+8ccc51e88b6adf2d4aca1d192db65a6c *R/mrpp.R
e145ba6b52ae375dc42b40e98e8b6594 *R/mso.R
7e428f1adfdae287a1d64a79c6f2c3bc *R/msoplot.R
7c219818ce5841e957db47f16986080b *R/multipart.R
@@ -163,7 +163,7 @@ f5e79cb1c2dc1fcabb6e6b5cb4dc0828 *R/nestedbetasor.R
74b2723851155de631716fa479f8ea38 *R/no.shared.R
47973ff187f68836a19d20ea37c60868 *R/nobs.R
9c89764ae10460148c1dcf9d25e05649 *R/nullmodel.R
-f57e69420b80ad432c9975ebf4f22b4d *R/oecosimu.R
+8909039c4fbff936278af7fc0506e406 *R/oecosimu.R
7b3988a207ecfe1ea574c5857ffcd2a3 *R/orderingKM.R
e3d108eed97633040fa22c2b384e19e4 *R/ordiArgAbsorber.R
871e2f900809d12e1b0522b303eb7057 *R/ordiArrowMul.R
@@ -173,7 +173,7 @@ da71b576fb9908051a545375e14a80e0 *R/ordiGetData.R
b78b985ccd7179b59e031bce191354da *R/ordiParseFormula.R
cccb6afc19bd7feaa3cf2e98fdbb79d4 *R/ordiR2step.R
7757339f5b8899cb54f13da274abda66 *R/ordiTerminfo.R
-9f40021fd5598605d692e9f5a46e1321 *R/ordiareatest.R
+005172ab8025d892cc93829b6933e95f *R/ordiareatest.R
e06d56a6e7d47767b9e71a73cbd3a80b *R/ordiarrows.R
85f3047b80ab9a2ea57dd7935d07b583 *R/ordicloud.R
793f91b9bf7c35f335949121d6f317c9 *R/ordicluster.R
@@ -191,7 +191,7 @@ e57a2b904e572829a5fd97f5b6576644 *R/ordiresids.R
1de439b5ffaf18640e08fadcaf7193ee *R/ordisplom.R
189eb9be55c6527f693925348b63c87d *R/ordistep.R
a6108f550b749db7139b143cc9e36c9c *R/ordisurf.R
-023ff6234cccb988d4bccd2e79b15f64 *R/orditkplot.R
+3bb58cf44b13c19c240dc7a584d49716 *R/orditkplot.R
bc3671e5b7a30e2849d3b59f65783c97 *R/orditorp.R
5a99010a09cd4a018b02d397be8cc4ec *R/ordixyplot.R
9fe401c201c03826754ec5613f6ecd71 *R/panel.ordi.R
@@ -202,8 +202,8 @@ b5b164724f3872370bff36ef767f8efb *R/permatfull.R
eeeaf4245033bd2a4ce822c919e42c6e *R/permatswap.R
b60a2bc00daa5f58ca92af05c6f663f5 *R/permustats.R
3d6a5ecd5feab93db30c063fd144d422 *R/permuted.index.R
-7a9689a09ce451f9cd5b9e785b5135c3 *R/permutest.betadisper.R
-3b0cdb459acd47452c382848581450e4 *R/permutest.cca.R
+94bae01fad2ee6f0380de55ffb90918a *R/permutest.betadisper.R
+2838084b8e5c948096ee5774d966bb8d *R/permutest.cca.R
b4e77b98f86c4b567d687b64e3aa8812 *R/persp.renyiaccum.R
b499c6eea710aa0c65a580dba30f2914 *R/persp.tsallisaccum.R
f7c8d52c791489d956a7fd833913f242 *R/plot.MOStest.R
@@ -238,7 +238,7 @@ af0dac1922ddd4eac1090ba1dd5b1089 *R/plot.radfit.frame.R
360dec911e8d4e772f888d89b8e0f6f7 *R/plot.radline.R
08f6b41506125e27b37a08b3bb730ffb *R/plot.renyi.R
20893b15e8b9db8b2282fef8c63299fa *R/plot.renyiaccum.R
-bb3dd7a884bc2ab1fad9acf47e5f33c2 *R/plot.spantree.R
+7cc22df38f8c928da73cd37c93e596f3 *R/plot.spantree.R
3951c0261856fbcdaff54d2e82bd8e11 *R/plot.specaccum.R
abc96c8853871035d494dfa9086d4d6e *R/plot.taxondive.R
6104fadf391072e78a8f2825ac41ceb2 *R/plot.varpart.R
@@ -251,7 +251,7 @@ a54bcddf1b7a44ee1f86ae4eaccb7179 *R/points.ordiplot.R
e352171f478eb27cf4a875cc3a1693fc *R/points.orditkplot.R
7409704e2e94cd051524e8c5af3bdcb4 *R/points.procrustes.R
80d9cee7ff1fa7ee8cb18850711a14b2 *R/points.radline.R
-41958351c903818c06bc056e71b0e828 *R/poolaccum.R
+06defcf59464ba92af271dca87943029 *R/poolaccum.R
91aa7fd2fbd99f8e325932d59886dac7 *R/postMDS.R
f9dcd972e5c81ce936c9ec5b296d484c *R/prc.R
32a52d09ade017e52d96eb56c05904c3 *R/predict.cca.R
@@ -281,7 +281,7 @@ b5358d1ce788e2c98813f59ef70f75c2 *R/print.fisherfit.R
6da316510cb840a6a9dd8d31d0e205af *R/print.humpfit.R
b31dbaa6493fdda1f865f95b3e889aab *R/print.isomap.R
d143e7c29760fed50528e5d791d36c8c *R/print.mantel.R
-4ff15a5ea43e997154944c7612bf3d56 *R/print.mantel.correlog.R
+242e2fa83b09f32abaa044dad385e45b *R/print.mantel.correlog.R
9d6b6102e251f155c0b9af98d37a5f49 *R/print.metaMDS.R
f221ea2ab4e8903ca1ae735038bfba04 *R/print.monoMDS.R
9e3feb49d153002226a102c025f6a72c *R/print.mrpp.R
@@ -343,7 +343,7 @@ d9a219ae6f3e6155ae76bc59d3e14d30 *R/raupcrick.R
90b562e8a94febce8430a344392a2943 *R/rda.formula.R
f87845cb9a96298b61aadc899f995b3f *R/read.cep.R
ef65ea5fb624aef7e34284d932503876 *R/renyi.R
-9bebccc25480b88b522d723c1d644bbb *R/renyiaccum.R
+a36c4cc88624a9e45103f656f9eaa491 *R/renyiaccum.R
90a897e14094cc1eba66c5f59a5bb79c *R/residuals.cca.R
38df11064481bc21f8555152cfd3d115 *R/residuals.procrustes.R
4ffd3879dcf18d0bdef8ffc8bf5b8ad3 *R/rrarefy.R
@@ -366,15 +366,15 @@ f146575a3f60358567dfed56e8cbb2cd *R/scores.ordiplot.R
3fe910b739d447ba5026f077cb0c670d *R/screeplot.prcomp.R
66d8c6dfecb51ca1afdf309926c00d08 *R/screeplot.princomp.R
95f15a952493d1965e59006be7f0b8d1 *R/showvarparts.R
-dffa3bb2eddc1944323febbd8a31ed89 *R/simper.R
+f77b038c96449c8ea1964bde35b6792d *R/simper.R
b35ee7d9cdc86eecefb5dcf478fc8abf *R/simpleRDA2.R
6670475eff913b3586560d4b2ec65149 *R/simulate.nullmodel.R
a5e793142ae74276a02e761cfe255f22 *R/simulate.rda.R
9f235c650efc4217a3cc88996b627e1d *R/spandepth.R
-3bb1adac8b593f81ebf4c2146ee112b9 *R/spantree.R
-3653508b2e2ae2575c2e86af246df42a *R/specaccum.R
+f4554cf72cc501fad09662c612b1c34c *R/spantree.R
+e566cf94049dea30df9100e2d523daa2 *R/specaccum.R
3c94a17c2602903234a65cb244053130 *R/specnumber.R
-41c068dce4a7a6146686614e647c8a96 *R/specpool.R
+5c1e01f3022cc628895666a5e3b35074 *R/specpool.R
77cc19684e9ceb27500ca7f802923328 *R/specpool2vect.R
2cf0545588fb2bb86185f71c21bda1c5 *R/spenvcor.R
33d884aae53dcc5fa80d9e9ffae4515e *R/stepacross.R
@@ -409,12 +409,12 @@ c2c3f2005758d438c6f2815ab2495d5d *R/tabasco.R
974bdc93cd9b352d30debf3e93111136 *R/text.ordiplot.R
846003f5f9de23241805042ac459ed1d *R/text.orditkplot.R
0fc7a75cf414d76cc751cc33ed5d6384 *R/tolerance.R
-f9d58b5156b1961cc1e338a596b7a36d *R/tolerance.cca.R
+a0c720c309192c5264b12685c490051d *R/tolerance.cca.R
7b45ffae615add899174090372c90188 *R/treedist.R
1400038a7df6468da830bc75782d3873 *R/treedive.R
cf0f2cbf17bbd944d455f71918ab88eb *R/treeheight.R
26fffea5380da4106dfe1f97681524cd *R/tsallis.R
-29175d8b46c44e66add86564d73218a3 *R/tsallisaccum.R
+0093be881d1f7a8f7aa592bcc7f42a08 *R/tsallisaccum.R
78a5b5292f78b0fd84b943dceddceb97 *R/update.nullmodel.R
a0682e3051c01f8f5823b158c018d18f *R/varpart.R
8d09b6b6390c2866234763beae855cf3 *R/varpart2.R
@@ -425,11 +425,11 @@ a0682e3051c01f8f5823b158c018d18f *R/varpart.R
593e3e9774284bfc0362a5c0b0b2fbcc *R/vegan-deprecated.R
129a1cf5e913a365ffd679b63378811b *R/veganCovEllipse.R
5656cc97f30992a5e02dba21b2846485 *R/veganMahatrans.R
-a3b54cd895f7ef425d2827501f03a1ff *R/vegandocs.R
+bd27a53ddee749358d854ed5daef715c *R/vegandocs.R
0f163ee6f1ede80946907518f7cd52ea *R/vegdist.R
b0194270cdab1ba7f2b190a7077f78c5 *R/vegemite.R
5d6047d7f63f04ae9ff40179c534aa0b *R/veiledspec.R
-1f6deab4b61a9be48be43e80703cd4b6 *R/vif.cca.R
+4d0f113e697fb166ba912ac34b40b3dc *R/vif.cca.R
322254f8bc3b02f7a971058cbdfa9edd *R/wascores.R
860e4de36a01011c639b9eafd909b673 *R/wcmdscale.R
ecfd48e2f4df6bcd683a87203dd80e12 *R/weights.cca.R
@@ -437,7 +437,6 @@ ecfd48e2f4df6bcd683a87203dd80e12 *R/weights.cca.R
73babeed9df14635d99b1a619a1286e4 *R/weights.rda.R
4138f57726620d493f218e5e3da0013c *R/wisconsin.R
17cbf4b5c186fe577cf361f0254df1d6 *R/zzz.R
-fd211597259383a5219e578e7c63bd1e *README.md
28cb7a9da307b57fc09d0281f336bb40 *build/vignette.rds
0f283f2be37fdfec65ec6e5b0146889c *data/BCI.rda
412ea5cf443401fe54f0b14c14c45806 *data/dune.env.rda
@@ -452,20 +451,20 @@ c51905bd025ccea2737527b6fca4a081 *data/mite.pcnm.rda
ee3c343418d7cf2e435028adf93205f1 *data/sipoo.rda
f87df84297865b5faf31e232e97a0f94 *data/varechem.rda
7136b8666250a538d60c88869390a085 *data/varespec.rda
-d157d49a41a6136c8149caf411fa4916 *inst/ChangeLog
-c4c282c929c236c076808d5a65d56cdf *inst/NEWS.Rd
+1fb35aec7042529e18e4673818fecf7f *inst/ChangeLog
+ef2cd15c9225fd09be13a1fb2e115e24 *inst/NEWS.Rd
9abfab8b05c34dd283379a7d87500ffb *inst/ONEWS
-9e43d1d42c1676c304078899396cccd7 *inst/doc/FAQ-vegan.pdf
-051443e01135d5f8b06127cf4efd120a *inst/doc/NEWS.html
+144c7ffd9edaf154b9bae0ba9bead321 *inst/doc/FAQ-vegan.pdf
+a14c58230a10efe58ff7b20921b2a844 *inst/doc/NEWS.html
e3e19be6e4226ef4b943c5dd46c3e161 *inst/doc/decision-vegan.R
09c81618a5a91cbfc5e8c3d969dc63fd *inst/doc/decision-vegan.Rnw
-e8ac356ccf0904c3189aad62d093d8d8 *inst/doc/decision-vegan.pdf
-91c198ab4bae32c5bab4b770b9dd3f42 *inst/doc/diversity-vegan.R
-9008f797d0ed0ee26368e148c6138c52 *inst/doc/diversity-vegan.Rnw
-64b54e4da74903f72a2bc4f0d16007c4 *inst/doc/diversity-vegan.pdf
+6c5a0c5460362dedc23fb14ff003ee94 *inst/doc/decision-vegan.pdf
+41fae44349a8a602825bddba8750102d *inst/doc/diversity-vegan.R
+06cfa11a83ca0330979d500549f2415a *inst/doc/diversity-vegan.Rnw
+7b552818d472135e5cc960a25fbefd71 *inst/doc/diversity-vegan.pdf
42c6873fda4c73ed0ccdeddef41563b2 *inst/doc/intro-vegan.R
ddee3279ac0982a3da0bcf9fc10947ac *inst/doc/intro-vegan.Rnw
-5b01bd1f1d4ce30257785815ddf710bf *inst/doc/intro-vegan.pdf
+7c6f0e044a27edb1dc95dc79b2a26b20 *inst/doc/intro-vegan.pdf
a1c35ea488b715441cd2269eb6998945 *inst/doc/partitioning.pdf
5037564d03aeac297d52c412762ffed8 *man/BCI.Rd
d4d97e3b71561f61bd9f1f0686a57434 *man/CCorA.Rd
@@ -480,7 +479,7 @@ caf191d6c5c1e618e11cb8d7441407b4 *man/adonis.Rd
193d8a15c966cc0d5d9a71008a29eca7 *man/anova.cca.Rd
c57af27fa11dadcd48981fcf42b2d221 *man/as.mlm.Rd
8e3718248ff8d48e724654ab17caa2e2 *man/beals.Rd
-de6584621a76810c11f7ae392a24c261 *man/betadisper.Rd
+f17b3ca5ef9b2e18cce9688b806e59f6 *man/betadisper.Rd
1336f0afb69a05bee9f6e7706d81d038 *man/betadiver.Rd
b04c2fae35dba2d97cb248814d5e2fe9 *man/bgdispersal.Rd
860b9c7f2325f500c27f3c903831efae *man/bioenv.Rd
@@ -510,16 +509,16 @@ d2cf422a3d7702ac6293fcd3ff046afc *man/eventstar.Rd
afc00cd6ac8f9b56bffbbb77e369057d *man/goodness.metaMDS.Rd
81f6bbc59aedfa21953278c285c250bf *man/humpfit.Rd
c8fea575af3da292987d4f8c4aa831b0 *man/indpower.Rd
-2b1c8ca24c00022de093f85a8645d419 *man/isomap.Rd
-5f2c36639ab3e98a5fbb03bb8c8adda9 *man/kendall.global.Rd
-e473a6d2589993b85fc1176866fdde78 *man/linestack.Rd
+4e59bd79cf1c24f62d511ee3175a83ff *man/isomap.Rd
+1455f24df0b577f7f65a28c5826081d2 *man/kendall.global.Rd
+6e4d92733c15b69cace0349288d61cc6 *man/linestack.Rd
59ce2773a5d92535708137747a52f358 *man/make.cepnames.Rd
f8d6f3bd27a07dc00c6779405652ec07 *man/mantel.Rd
85d798177d90587416f9ca88e2f445c9 *man/mantel.correlog.Rd
e598d23fdc8a162bb793a3aa774559b9 *man/metaMDS.Rd
4cfb02239809fa03b28e10ec8e8c9c6b *man/mite.Rd
c50bd45c9e8c6e892d2dd8f7fe5f0bd9 *man/model.matrix.cca.Rd
-fef80c85e48be18dc8c62566da0c14b1 *man/monoMDS.Rd
+a53ce6074ce0cc6e627955be31d5664f *man/monoMDS.Rd
b897a6552d7524c853e91f9d8b972cb6 *man/mrpp.Rd
181ca1c040aff6f79fca96d4c0b9708c *man/mso.Rd
10d5049f8819e378f7f95fdb3858e6e7 *man/multipart.Rd
@@ -538,7 +537,7 @@ da0b3d8e0681a5ddc2bea83fd1796048 *man/ordistep.Rd
3887cd29dd4adc986e6cf6618136da95 *man/orditkplot.Rd
8785cc44c56d1b24fbcbde8de9e325d5 *man/orditorp.Rd
d971701b3c6f89b3a6b358a3966a43d2 *man/ordixyplot.Rd
-1d1d238c33b95eddfa4b497da9ba4c57 *man/pcnm.Rd
+e8a307f119251e6651dacf18c182f73f *man/pcnm.Rd
d3fd306546c43339ad7d8fd985a28801 *man/permatfull.Rd
1abd9ac0457eb66698e2a33e33115adf *man/permustats.Rd
4a2ed8481b1f6805d343e83fda91e0ed *man/permutations.Rd
@@ -552,7 +551,7 @@ f61f64cc1be643149fd02f08a0cd7f9f *man/radfit.Rd
8b12fb04530537414e03e1a6fbccda7c *man/rankindex.Rd
915c6ea3098d6ac9c3de6249606b2fe9 *man/raupcrick.Rd
2867f5f71a47da498cbadf9aaa01b2b6 *man/read.cep.Rd
-0a09dd95ccf94b90d99a713f8b810bca *man/renyi.Rd
+87cf4ea35d498647e8848f487041add7 *man/renyi.Rd
eec06fd5cfdddadb56bca849f88b38f0 *man/reorder.hclust.Rd
5c25a88ca55fabce5783509c706faad5 *man/scores.Rd
8104fd642b527f76e159580e3d317fcf *man/screeplot.cca.Rd
@@ -560,21 +559,21 @@ fa4c03b6622b3cba08b633393560b70a *man/simper.Rd
621f8a2810727ab3523fc0bd69a56dca *man/simulate.rda.Rd
b34910fa6ed6c9bfbd90a7f7443a135f *man/sipoo.Rd
37121fc0a195e97b3b1287678d175bab *man/spantree.Rd
-a998a73ff2783a45fce220dc18924174 *man/specaccum.Rd
-ff2fecf2a0726ffc824a1a626e462f3a *man/specpool.Rd
+c4f5b6bac0a924e4238713584e34da4e *man/specaccum.Rd
+300a45ac7b4b61992707bb60658fa915 *man/specpool.Rd
5b9e51c85395f80f8504954e4175f877 *man/stepacross.Rd
812fedada0ae3582c28f4f91bbcedc09 *man/stressplot.wcmdscale.Rd
0aac5f5c8f58fc8fe1cb6c0ba819b196 *man/taxondive.Rd
85f77fcf89b48586502c00baef8e5561 *man/tolerance.Rd
a4b37297402220dee75997c4f49a729c *man/treedive.Rd
-fb3bbb6521943417c9ee47bab463b189 *man/tsallis.Rd
+14cc64af5f8a8c5965563a2b03c408f2 *man/tsallis.Rd
033dd7d7917185cea81e4d7afcd59df9 *man/varechem.Rd
e7717c542e5c0372ca2ff71bcc26d8b0 *man/varpart.Rd
0e0e4db86ab5afa92f6d5a921c5e14ff *man/vegan-defunct.Rd
76c332552a660a95a4e652c251187da9 *man/vegan-deprecated.Rd
8e32395af09dfb764c821b9f61416f23 *man/vegan-internal.Rd
1798f9f9db805ac6e3a71c953eae8364 *man/vegan-package.Rd
-18a565c35d567fb3fd1666462dfa6ed2 *man/vegandocs.Rd
+36d1ea9c9bb748b484fd12d07627bf55 *man/vegandocs.Rd
ad48b24429d673e1af3120d0cf6c3eb3 *man/vegdist.Rd
a2cc1d837017b4de0b4bec617e29533d *man/vegemite.Rd
c3209a8eff0fe638d3a43b25ea5bec16 *man/wascores.Rd
@@ -589,15 +588,15 @@ a42c4629717137858295a1eb6f3e89de *src/nestedness.c
31bdbe9b08340e1662a62cf6e61ade6a *src/pnpoly.c
b9b647fcf8a3e59e10b9351fae60ec06 *src/stepacross.c
36ea09c9a6553010e786f0e787185d60 *src/vegdist.c
-9e43d1d42c1676c304078899396cccd7 *vignettes/FAQ-vegan.pdf
+144c7ffd9edaf154b9bae0ba9bead321 *vignettes/FAQ-vegan.pdf
f36ab9880f86e1026f7c76c387b46d7b *vignettes/FAQ-vegan.texi
45ce50de9edf3aeacd8d11d1483f764c *vignettes/Makefile
-051443e01135d5f8b06127cf4efd120a *vignettes/NEWS.html
+a14c58230a10efe58ff7b20921b2a844 *vignettes/NEWS.html
09c81618a5a91cbfc5e8c3d969dc63fd *vignettes/decision-vegan.Rnw
-19bdb0e4c22aa8eb40337a0b78d1dd22 *vignettes/decision-vegan.tex
-9008f797d0ed0ee26368e148c6138c52 *vignettes/diversity-vegan.Rnw
-3ab6c7357c26930e8bf7501ada9038d4 *vignettes/diversity-vegan.tex
+952d0350cd75c9fb4818d125acdad074 *vignettes/decision-vegan.tex
+06cfa11a83ca0330979d500549f2415a *vignettes/diversity-vegan.Rnw
+71a3401230e3e0696fdc2565986a98d4 *vignettes/diversity-vegan.tex
ddee3279ac0982a3da0bcf9fc10947ac *vignettes/intro-vegan.Rnw
-0ab415a068116fb1417c809c53f83b94 *vignettes/intro-vegan.tex
-5b5c916bf21a82d716bef6ac87716b43 *vignettes/vegan.bib
+85c994d79f03bc728bbffcfd809ac724 *vignettes/intro-vegan.tex
+2004d867a35c1fb405934004d121fa9a *vignettes/vegan.bib
fd58fa43e5e36d0ddcddd26dac1c7e31 *vignettes/vegan.sty
diff --git a/NAMESPACE b/NAMESPACE
index e5c2072..55f449b 100644
--- a/NAMESPACE
+++ b/NAMESPACE
@@ -76,12 +76,12 @@ import(permute)
importFrom(utils, head, tail, str)
importFrom(tools, Rd2txt, startDynamicHelp)
import(lattice)
-import(parallel)
-import(tcltk)
+importFrom(parallel, mclapply, makeCluster, stopCluster, clusterEvalQ,
+ parApply, parLapply, parSapply, parRapply, parCapply)
importFrom(MASS, isoMDS, sammon, Shepard, mvrnorm)
importFrom(cluster, daisy)
## 's' must be imported in mgcv < 1.8-0 (not needed later)
-importFrom(mgcv, gam, s, te)
+importFrom(mgcv, gam, s, te, predict.gam, summary.gam)
## Registration of S3 methods defined in vegan
# adipart: vegan
S3method(adipart, default)
@@ -123,6 +123,7 @@ S3method(bioenv, default)
S3method(bioenv, formula)
# biplot: stats
S3method(biplot, CCorA)
+S3method(biplot, cca)
S3method(biplot, rda)
# boxplot: graphics
S3method(boxplot, betadisper)
diff --git a/R/adonis.R b/R/adonis.R
index 4ad79e3..87aa426 100644
--- a/R/adonis.R
+++ b/R/adonis.R
@@ -100,7 +100,7 @@
if (is.null(parallel))
parallel <- 1
hasClus <- inherits(parallel, "cluster")
- isParal <- (hasClus || parallel > 1) && require(parallel)
+ isParal <- hasClus || parallel > 1
isMulticore <- .Platform$OS.type == "unix" && !hasClus
if (isParal && !isMulticore && !hasClus) {
parallel <- makeCluster(parallel)
diff --git a/R/alias.cca.R b/R/alias.cca.R
index 3673f33..c17104b 100644
--- a/R/alias.cca.R
+++ b/R/alias.cca.R
@@ -1,6 +1,8 @@
`alias.cca` <-
function (object, names.only = FALSE, ...)
{
+ if (is.null(object$CCA$alias))
+ stop("no constrained component, 'alias' cannot be applied")
if (names.only)
return(object$CCA$alias)
CompPatt <- function(x, ...) {
diff --git a/R/anosim.R b/R/anosim.R
index e976191..cf1fcd5 100644
--- a/R/anosim.R
+++ b/R/anosim.R
@@ -46,11 +46,12 @@
if (is.null(parallel))
parallel <- 1
hasClus <- inherits(parallel, "cluster")
- if ((hasClus || parallel > 1) && require(parallel)) {
+ if (hasClus || parallel > 1) {
if(.Platform$OS.type == "unix" && !hasClus) {
- perm <- unlist(mclapply(1:permutations, function(i, ...)
- ptest(permat[i,]),
- mc.cores = parallel))
+ perm <- unlist(mclapply(1:permutations,
+ function(i, ...)
+ ptest(permat[i,]),
+ mc.cores = parallel))
} else {
if (!hasClus) {
parallel <- makeCluster(parallel)
diff --git a/R/as.hclust.spantree.R b/R/as.hclust.spantree.R
index 65d3ebc..e2f111a 100644
--- a/R/as.hclust.spantree.R
+++ b/R/as.hclust.spantree.R
@@ -12,7 +12,9 @@
{
## Order by the lengths of spanning tree links
o <- order(x$dist)
- npoints <- length(o) + 1
+ npoints <- x$n
+ if(npoints < 2)
+ stop("needs at least two points")
## Ordered indices of dads and kids
dad <- (2:npoints)[o]
kid <- x$kid[o]
diff --git a/R/as.mlm.R b/R/as.mlm.R
index 0e8c8b5..e47f8a2 100644
--- a/R/as.mlm.R
+++ b/R/as.mlm.R
@@ -1,3 +1,6 @@
`as.mlm` <-
-function(x) UseMethod("as.mlm")
-
+function(x) {
+ if (is.null(x$CCA))
+ stop("'as.mlm' can be used only for constrained ordination")
+ UseMethod("as.mlm")
+}
diff --git a/R/bioenv.default.R b/R/bioenv.default.R
index c321395..bc684fe 100644
--- a/R/bioenv.default.R
+++ b/R/bioenv.default.R
@@ -72,10 +72,11 @@ function (comm, env, method = "spearman", index = "bray", upto = ncol(env),
if (is.null(parallel))
parallel <- 1
hasClus <- inherits(parallel, "cluster")
- isParal <- (hasClus || parallel > 1) && require(parallel)
+ isParal <- hasClus || parallel > 1
isMulticore <- .Platform$OS.type == "unix" && !hasClus
if (isParal && !isMulticore && !hasClus) {
parallel <- makeCluster(parallel)
+ on.exit(stopCluster(parallel))
}
## get the number of clusters
if (inherits(parallel, "cluster"))
diff --git a/R/biplot.rda.R b/R/biplot.rda.R
index 09e20e8..4badb1d 100644
--- a/R/biplot.rda.R
+++ b/R/biplot.rda.R
@@ -3,7 +3,16 @@
## draws pca biplots with species as arrows
##
-biplot.rda <- function(x, choices = c(1, 2), scaling = 2,
+`biplot.cca` <-
+ function(x, ...)
+{
+ if (!inherits(x, "rda"))
+ stop("biplot can be used only with linear ordination (e.g., PCA)")
+ else
+ NextMethod("biplot", x, ...)
+}
+
+`biplot.rda` <- function(x, choices = c(1, 2), scaling = 2,
display = c("sites", "species"),
type, xlim, ylim, col = c(1,2), const, ...) {
if(!inherits(x, "rda"))
diff --git a/R/coef.cca.R b/R/coef.cca.R
index ac28b97..1cb7c76 100644
--- a/R/coef.cca.R
+++ b/R/coef.cca.R
@@ -1,9 +1,11 @@
"coef.cca" <-
function (object, ...)
{
- Q <- object$CCA$QR
- u <- object$CCA$u
- u <- sweep(u, 1, sqrt(object$rowsum), "*")
- qr.coef(Q, u)
+ if(is.null(object$CCA))
+ stop("unconstrained models do not have coefficients")
+ Q <- object$CCA$QR
+ u <- object$CCA$u
+ u <- sweep(u, 1, sqrt(object$rowsum), "*")
+ qr.coef(Q, u)
}
diff --git a/R/coef.rda.R b/R/coef.rda.R
index 20057f7..6de2ed0 100644
--- a/R/coef.rda.R
+++ b/R/coef.rda.R
@@ -1,7 +1,9 @@
"coef.rda" <-
function (object, ...)
{
- Q <- object$CCA$QR
- qr.coef(Q, object$CCA$u)
+ if(is.null(object$CCA))
+ stop("unconstrained models do not have coefficients")
+ Q <- object$CCA$QR
+ qr.coef(Q, object$CCA$u)
}
diff --git a/R/cophenetic.spantree.R b/R/cophenetic.spantree.R
index 12c2cb3..0ec7584 100644
--- a/R/cophenetic.spantree.R
+++ b/R/cophenetic.spantree.R
@@ -1,8 +1,10 @@
-"cophenetic.spantree" <-
+`cophenetic.spantree` <-
function(x)
{
- n <- length(x$kid) + 1
+ n <- x$n
mat <- matrix(NA, nrow=n, ncol=n)
+ if (n < 2)
+ return(as.dist(mat))
ind <- apply(cbind(2:n, x$kid), 1, sort)
ind <- t(ind[2:1,])
mat[ind] <- x$dist
diff --git a/R/estaccumR.R b/R/estaccumR.R
index 2ce2afa..15ac462 100644
--- a/R/estaccumR.R
+++ b/R/estaccumR.R
@@ -1,21 +1,43 @@
##" Individual based accumulation model. Similar to poolaccum but uses
##estimateR. Inherits from "poolaccum" class and uses its methods.
`estaccumR` <-
- function(x, permutations = 100)
+ function(x, permutations = 100, parallel = getOption("mc.cores"))
{
n <- nrow(x)
N <- seq_len(n)
- S <- chao <- ace <- matrix(0, nrow = n, ncol = permutations)
- for (i in 1:permutations) {
- take <- sample(n)
- tmp <- estimateR(apply(x[take,], 2, cumsum))
- S[,i] <- tmp[1,]
- chao[,i] <- tmp[2,]
- ace[, i] <- tmp[4,]
+ estFun <- function(idx) {
+ estimateR(apply(x[idx,], 2, cumsum))[c(1,2,4),]
}
+ permat <- getPermuteMatrix(permutations, n)
+ nperm <- nrow(permat)
+ ## parallel processing
+ if (is.null(parallel))
+ parallel <- 1
+ hasClus <- inherits(parallel, "cluster")
+ if (hasClus || parallel > 1) {
+ if(.Platform$OS.type == "unix" && !hasClus) {
+ tmp <- mclapply(1:nperm, function(i)
+ estFun(permat[i,]),
+ mc.cores = parallel)
+ } else {
+ if (!hasClus) {
+ parallel <- makeCluster(parallel)
+ }
+ tmp <- parLapply(parallel, 1:nperm, function(i) estFun(permat[i,]))
+ if (!hasClus)
+ stopCluster(parallel)
+ }
+ } else {
+ tmp <- lapply(1:permutations, function(i) estFun(permat[i,]))
+ }
+
+ S <- sapply(tmp, function(x) x[1,])
+ chao <- sapply(tmp, function(x) x[2,])
+ ace <- sapply(tmp, function(x) x[3,])
means <- cbind(N = N, S = rowMeans(S), Chao = rowMeans(chao),
ACE = rowMeans(ace))
out <- list(S = S, chao = chao, ace = ace, N = N, means = means)
+ attr(out, "control") <- attr(permat, "control")
class(out) <- c("estaccumR", "poolaccum")
out
}
diff --git a/R/estimateR.default.R b/R/estimateR.default.R
index 5205a46..c265f92 100644
--- a/R/estimateR.default.R
+++ b/R/estimateR.default.R
@@ -55,15 +55,26 @@
##else
## S.Chao1 <- S.obs
Deriv.Ch1 <- gradF(a, i)
- ##if (a[2] > 0)
- ## sd.Chao1 <- sqrt(a[2] * (SSC * (SSC * (G^4/4 + G^3) + G^2/2)))
- ##else if (a[1] > 0)
- sd.Chao1 <-
- sqrt(SSC*(a[1]*(a[1]-1)/2/(a[2]+1) +
- SSC*(a[1]*(2*a[1]-1)^2/4/(a[2]+1)^2 +
- a[1]^2*a[2]*(a[1]-1)^2/4/(a[2]+1)^4)))
- ##else
- ## sd.Chao1 <- 0
+
+ ## The commonly used variance estimator is wrong for bias-reduced
+ ## Chao estimate. It is based on the variance estimator of basic
+ ## Chao estimate, but replaces the basic terms with corresponding
+ ## terms in the bias-reduced estimate. The following is directly
+ ## derived from the bias-reduced estimate.
+
+ ## The commonly used one (for instance, in EstimateS):
+ ##sd.Chao1 <-
+ ## sqrt(SSC*(a[1]*(a[1]-1)/2/(a[2]+1) +
+ ## SSC*(a[1]*(2*a[1]-1)^2/4/(a[2]+1)^2 +
+ ## a[1]^2*a[2]*(a[1]-1)^2/4/(a[2]+1)^4)))
+
+ sd.Chao1 <- (a[1]*((-a[2]^2+(-2*a[2]-a[1])*a[1])*a[1] +
+ (-1+(-4+(-5-2*a[2])*a[2])*a[2] +
+ (-2+(-1+(2*a[2]+2)*a[2])*a[2] +
+ (4+(6+4*a[2])*a[2] + a[1]*a[2])*a[1])*a[1])*S.Chao1))/
+ 4/(a[2]+1)^4/S.Chao1
+ sd.Chao1 <- sqrt(sd.Chao1)
+
C.ace <- 1 - a[1]/N.rare
i <- 1:length(a)
thing <- i * (i - 1) * a
@@ -72,7 +83,7 @@
S.ACE <- S.abund + S.rare/C.ace + max(Gam, 0) * a[1]/C.ace
sd.ACE <- sqrt(sum(Deriv.Ch1 %*% t(Deriv.Ch1) * (diag(a) -
a %*% t(a)/S.ACE)))
- out <- list(S.obs = S.obs, S.chao1 = S.Chao1, se.chao1 = sd.Chao1,
+ out <- list(S.obs = S.obs, S.chao1 = S.Chao1, se.chao1 = sd.Chao1,
S.ACE = S.ACE, se.ACE = sd.ACE)
out <- unlist(out)
out
diff --git a/R/fitted.capscale.R b/R/fitted.capscale.R
index f8b5610..f59ed72 100644
--- a/R/fitted.capscale.R
+++ b/R/fitted.capscale.R
@@ -3,6 +3,8 @@
type = c("response", "working"), ...)
{
model <- match.arg(model)
+ if (is.null(object[[model]]))
+ stop("component ", model, " does not exist")
type <- match.arg(type)
## Return scaled eigenvalues
U <- switch(model,
diff --git a/R/fitted.cca.R b/R/fitted.cca.R
index 3118fcb..1d746ee 100644
--- a/R/fitted.cca.R
+++ b/R/fitted.cca.R
@@ -4,6 +4,8 @@
{
type <- match.arg(type)
model <- match.arg(model)
+ if (is.null(object[[model]]))
+ stop("component ", model, " does not exist")
gtot <- object$grand.total
rc <- object$rowsum %o% object$colsum
if (model == "pCCA")
diff --git a/R/fitted.rda.R b/R/fitted.rda.R
index 3968a96..a4825d8 100644
--- a/R/fitted.rda.R
+++ b/R/fitted.rda.R
@@ -3,6 +3,8 @@
{
type <- match.arg(type)
model <- match.arg(model)
+ if (is.null(object[[model]]))
+ stop("component ", model, " does not exist")
if (model == "pCCA")
Xbar <- object$pCCA$Fit
else
diff --git a/R/intersetcor.R b/R/intersetcor.R
index 6c22cf3..88fb403 100644
--- a/R/intersetcor.R
+++ b/R/intersetcor.R
@@ -2,6 +2,8 @@ intersetcor <- function(object)
{
if (!inherits(object, "cca"))
stop("can be used only with objects inheriting from 'cca'")
+ if (is.null(object$CCA))
+ stop("can be used only with constrained ordination")
wa <- object$CCA$wa
if (!inherits(object, "rda")) { # is CCA
w <- object$rowsum
diff --git a/R/lines.spantree.R b/R/lines.spantree.R
index 0e0c556..6909fa7 100644
--- a/R/lines.spantree.R
+++ b/R/lines.spantree.R
@@ -1,9 +1,10 @@
-"lines.spantree" <-
+`lines.spantree` <-
function (x, ord, display = "sites", ...)
{
ord <- scores(ord, display = display, ...)
tree <- x$kid
- ordiArgAbsorber(ord[-1, 1], ord[-1, 2], ord[tree, 1], ord[tree, 2],
- FUN = segments, ...)
+ if (x$n > 1)
+ ordiArgAbsorber(ord[-1, 1], ord[-1, 2], ord[tree, 1], ord[tree, 2],
+ FUN = segments, ...)
invisible()
}
diff --git a/R/linestack.R b/R/linestack.R
index 98708b6..26dc436 100644
--- a/R/linestack.R
+++ b/R/linestack.R
@@ -1,23 +1,30 @@
"linestack" <-
- function (x, labels, cex = 0.8, side = "right", hoff = 2, air = 1.1,
- at = 0, add = FALSE, axis = FALSE, ...)
+ function (x, labels, cex = 0.8, side = "right", hoff = 2, air = 1.1,
+ at = 0, add = FALSE, axis = FALSE, ...)
{
- if (!missing(labels) && length(labels == 1) && pmatch(labels,
- c("right", "left"), nomatch = FALSE)) {
+ x <- drop(x)
+ n <- length(x)
+ misslab <- missing(labels)
+ if (misslab) {
+ labels <- names(x)
+ }
+ nlab <- length(labels)
+ if (!misslab && nlab == 1L && pmatch(labels, c("right", "left"), nomatch = FALSE)) {
side <- labels
labels <- NULL
warning("argument 'label' is deprecated: use 'side'")
}
+ if (!misslab && n != nlab) {
+ msg <- paste("Wrong number of supplied 'labels'.\nExpected:",
+ n, "Got:", nlab, sep = " ")
+ stop(msg)
+ }
side <- match.arg(side, c("right", "left"))
- x <- drop(x)
- if (!missing(labels) && !is.null(labels))
- names(x) <- labels
- else if (is.null(names(x)))
- names(x) <- rep("", length(x))
op <- par(xpd = TRUE)
+ on.exit(par(op))
ord <- order(x)
x <- x[ord]
- n <- length(x)
+ labels <- labels[ord]
pos <- numeric(n)
if (!add) {
plot(pos, x, type = "n", axes = FALSE, xlab = "", ylab = "", ...)
@@ -38,19 +45,18 @@
}
segments(at, x[1], at, x[n])
if (side == "right") {
- text(at + hoff, pos, names(x), pos = 4, cex = cex, offset = 0.2,
+ text(at + hoff, pos, labels, pos = 4, cex = cex, offset = 0.2,
...)
segments(at, x, at + hoff, pos)
}
else if (side == "left") {
- text(at - hoff, pos, names(x), pos = 2, cex = cex, offset = 0.2,
+ text(at - hoff, pos, labels, pos = 2, cex = cex, offset = 0.2,
...)
segments(at, x, at - hoff, pos)
}
- if (axis)
- axis(if (side == "right")
+ if (axis)
+ axis(if (side == "right")
2
else 4, pos = at, las = 2)
- par(op)
invisible(pos[order(ord)])
}
diff --git a/R/mantel.R b/R/mantel.R
index a7ce767..37de3e0 100644
--- a/R/mantel.R
+++ b/R/mantel.R
@@ -37,7 +37,7 @@
if (is.null(parallel))
parallel <- 1
hasClus <- inherits(parallel, "cluster")
- if ((hasClus || parallel > 1) && require(parallel)) {
+ if (hasClus || parallel > 1) {
if(.Platform$OS.type == "unix" && !hasClus) {
perm <- do.call(rbind,
mclapply(1:permutations,
diff --git a/R/mantel.partial.R b/R/mantel.partial.R
index 3097cea..04d9617 100644
--- a/R/mantel.partial.R
+++ b/R/mantel.partial.R
@@ -45,7 +45,7 @@
if (is.null(parallel))
parallel <- 1
hasClus <- inherits(parallel, "cluster")
- if ((hasClus || parallel > 1) && require(parallel)) {
+ if (hasClus || parallel > 1) {
if(.Platform$OS.type == "unix" && !hasClus) {
perm <- do.call(rbind,
mclapply(1:permutations,
diff --git a/R/metaMDSiter.R b/R/metaMDSiter.R
index 72a3437..b54044a 100644
--- a/R/metaMDSiter.R
+++ b/R/metaMDSiter.R
@@ -74,7 +74,7 @@
if (is.null(parallel))
parallel <- 1
hasClus <- inherits(parallel, "cluster")
- isParal <- (hasClus || parallel > 1) && require(parallel)
+ isParal <- hasClus || parallel > 1
isMulticore <- .Platform$OS.type == "unix" && !hasClus
if (isParal && !isMulticore && !hasClus) {
parallel <- makeCluster(parallel)
diff --git a/R/mrpp.R b/R/mrpp.R
index 7e9e3b2..1b420ea 100644
--- a/R/mrpp.R
+++ b/R/mrpp.R
@@ -52,7 +52,7 @@
if (is.null(parallel))
parallel <- 1
hasClus <- inherits(parallel, "cluster")
- if ((hasClus || parallel > 1) && require(parallel)) {
+ if (hasClus || parallel > 1) {
if(.Platform$OS.type == "unix" && !hasClus) {
m.ds <- unlist(mclapply(1:permutations, function(i, ...)
mrpp.perms(perms[,i], dmat, indls, w),
diff --git a/R/oecosimu.R b/R/oecosimu.R
index 49171f3..5c26ea8 100644
--- a/R/oecosimu.R
+++ b/R/oecosimu.R
@@ -90,7 +90,7 @@
if (is.null(parallel))
parallel <- 1
hasClus <- inherits(parallel, "cluster")
- if ((hasClus || parallel > 1) && require(parallel)) {
+ if (hasClus || parallel > 1) {
if(.Platform$OS.type == "unix" && !hasClus) {
for (i in seq_len(nbatch)) {
## simulate if no simmat_in
diff --git a/R/ordiareatest.R b/R/ordiareatest.R
index d57d9cd..36919e0 100644
--- a/R/ordiareatest.R
+++ b/R/ordiareatest.R
@@ -30,7 +30,7 @@
if (is.null(parallel))
parallel <- 1
hasClus <- inherits(parallel, "cluster")
- if ((hasClus || parallel > 1) && require(parallel)) {
+ if (hasClus || parallel > 1) {
if(.Platform$OS.type == "unix" && !hasClus) {
areas <- do.call(cbind,
mclapply(1:permutations,
diff --git a/R/orditkplot.R b/R/orditkplot.R
index a29ac08..bdae5ef 100644
--- a/R/orditkplot.R
+++ b/R/orditkplot.R
@@ -8,12 +8,12 @@
{
if (!capabilities("tcltk"))
stop("Your R has no capability for Tcl/Tk")
- require(tcltk) || stop("requires package tcltk")
+ requireNamespace("tcltk") || stop("requires package tcltk")
############################
### Check and sanitize input
###########################
-
+
## Graphical parameters and constants, and save some for later plotting
p <- par()
sparnam <- c("bg","cex", "cex.axis","cex.lab","col", "col.axis", "col.lab",
@@ -36,7 +36,7 @@
}
savepar <- p[sparnam]
PPI <- 72 # Points per Inch
- p2p <- as.numeric(tclvalue(tcl("tk", "scaling"))) # Pixel per point
+ p2p <- as.numeric(tcltk::tclvalue(tcltk::tcl("tk", "scaling"))) # Pixel per point
DIAM <- 2.7 # diam of plotting symbol
## Plotting symbol diam
diam <- round(pcex * DIAM * p2p, 1)
@@ -47,7 +47,7 @@
x <- gsub("transparent", "", x)
x[is.na(x)] <- ""
x
- }
+ }
p$bg <- sanecol(p$bg)
p$fg <- sanecol(p$fg)
p$col <- sanecol(p$col)
@@ -86,13 +86,13 @@
"0" = Point(x, y, 22, col, fill = "", diam),
"1" = Point(x, y, 21, col, fill = "", diam),
"2" = Point(x, y, 24, col, fill = "", diam),
- "3" = {tkcreate(can, "line",
+ "3" = {tcltk::tkcreate(can, "line",
x, y+SQ*diam, x, y-SQ*diam, fill=col)
- tkcreate(can, "line",
+ tcltk::tkcreate(can, "line",
x+SQ*diam, y, x-SQ*diam, y, fill=col)},
- "4" = {tkcreate(can, "line",
+ "4" = {tcltk::tkcreate(can, "line",
x-diam, y-diam, x+diam, y+diam, fill=col)
- tkcreate(can, "line",
+ tcltk::tkcreate(can, "line",
x-diam, y+diam, x+diam, y-diam, fill=col)},
"5" = Point(x, y, 23, col, fill = "", diam),
"6" = Point(x, y, 25, col, fill = "", diam),
@@ -110,9 +110,9 @@
Point(x, y, 0, col, fill, diam)},
"13" = {Point(x, y, 4, col, fill, diam)
Point(x, y, 1, col, fill, diam)},
- "14" = {tkcreate(can, "line", x-diam, y-diam, x, y+diam,
+ "14" = {tcltk::tkcreate(can, "line", x-diam, y-diam, x, y+diam,
fill = col)
- tkcreate(can, "line", x+diam, y-diam, x, y+diam,
+ tcltk::tkcreate(can, "line", x+diam, y-diam, x, y+diam,
fill = col)
Point(x, y, 0, col, fill, diam)},
"15" = Point(x, y, 22, col = col, fill = col, diam),
@@ -121,22 +121,22 @@
"18" = Point(x, y, 23, col = col, fill = col, diam/SQ),
"19" = Point(x, y, 21, col = col, fill = col, diam),
"20" = Point(x, y, 21, col = col, fill = col, diam/2),
- "21" = tkcreate(can, "oval", x-diam, y-diam,
+ "21" = tcltk::tkcreate(can, "oval", x-diam, y-diam,
x+diam, y+diam, outline = col, fill = fill),
- "22" = tkcreate(can, "rectangle", x-diam, y-diam,
+ "22" = tcltk::tkcreate(can, "rectangle", x-diam, y-diam,
x+diam, y+diam, outline = col, fill = fill),
- "23" = tkcreate(can, "polygon", x, y+SQ*diam,
+ "23" = tcltk::tkcreate(can, "polygon", x, y+SQ*diam,
x+SQ*diam, y, x, y-SQ*diam, x-SQ*diam, y,
outline = col, fill = fill),
- "24" = tkcreate(can, "polygon", x, y-SQ*diam,
+ "24" = tcltk::tkcreate(can, "polygon", x, y-SQ*diam,
x+sqrt(6)/2*diam, y+SQ/2*diam, x-sqrt(6)/2*diam, y+SQ/2*diam,
outline = col, fill = fill),
- "25" = tkcreate(can, "polygon", x, y+SQ*diam,
+ "25" = tcltk::tkcreate(can, "polygon", x, y+SQ*diam,
x+sqrt(6)/2*diam, y-SQ/2*diam, x-sqrt(6)/2*diam, y-SQ/2*diam,
outline = col, fill = fill),
"o" = Point(x, y, 1, col, fill, diam),
## default: text with dummy location of the label
- {tkcreate(can, "text",
+ {tcltk::tkcreate(can, "text",
x, y, text = as.character(pch), fill = col)
Point(x, y, 21, col="", fill="", diam)}
)
@@ -147,31 +147,33 @@
############################
## toplevel
- w <- tktoplevel()
- tktitle(w) <- deparse(match.call())
+ w <- tcltk::tktoplevel()
+ tcltk::tktitle(w) <- deparse(match.call())
## Max dim of windows (depends on screen)
- YSCR <- as.numeric(tkwinfo("screenheight", w)) - 150
- XSCR <- as.numeric(tkwinfo("screenwidth", w))
+ YSCR <- as.numeric(tcltk::tkwinfo("screenheight", w)) - 150
+ XSCR <- as.numeric(tcltk::tkwinfo("screenwidth", w))
################################
### Buttons and button functions
################################
## Buttons
- buts <- tkframe(w)
+ buts <- tcltk::tkframe(w)
## Copy current canvas to EPS using the standard Tcl/Tk utility
- cp2eps <- tkbutton(buts, text="Copy to EPS",
- command=function() tkpostscript(can, x=0, y=0,
- height=height, width=width,
- file=tkgetSaveFile(filetypes="{{EPS file} {.eps}}")))
- dismiss <- tkbutton(buts, text="Dismiss", command=function() tkdestroy(w))
+ cp2eps <- tcltk::tkbutton(buts, text="Copy to EPS",
+ command=function() tcltk::tkpostscript(can, x=0, y=0,
+ height=height, width=width,
+ file=tcltk::tkgetSaveFile(
+ filetypes="{{EPS file} {.eps}}")))
+ dismiss <- tcltk::tkbutton(buts, text="Dismiss",
+ command=function() tcltk::tkdestroy(w))
## Dump current plot to an "orditkplot" object (internally)
ordDump <- function() {
xy <- matrix(0, nrow=nrow(sco), ncol=2)
rownames(xy) <- rownames(sco)
colnames(xy) <- colnames(sco)
for(nm in names(pola)) {
- xy[as.numeric(tclvalue(id[[nm]])),] <- xy2usr(nm)
+ xy[as.numeric(tcltk::tclvalue(id[[nm]])),] <- xy2usr(nm)
}
curdim <- round(c(width, height) /PPI/p2p, 2)
## Sanitize colours for R plot
@@ -191,37 +193,37 @@
dim = curdim)
class(xy) <- "orditkplot"
xy
- }
+ }
## Button to dump "orditkplot" object to the R session
pDump <- function() {
xy <- ordDump()
- dumpVar <- tclVar("")
- tt <- tktoplevel()
- tktitle(tt) <- "R Dump"
- entryDump <- tkentry(tt, width=20, textvariable=dumpVar)
- tkgrid(tklabel(tt, text="Enter name for an R object"))
- tkgrid(entryDump, pady="5m")
+ dumpVar <- tcltk::tclVar("")
+ tt <- tcltk::tktoplevel()
+ tcltk::tktitle(tt) <- "R Dump"
+ entryDump <- tcltk::tkentry(tt, width=20, textvariable=dumpVar)
+ tcltk::tkgrid(tcltk::tklabel(tt, text="Enter name for an R object"))
+ tcltk::tkgrid(entryDump, pady="5m")
isDone <- function() {
- dumpName <- tclvalue(dumpVar)
+ dumpName <- tcltk::tclvalue(dumpVar)
if (exists(dumpName, envir=.GlobalEnv)) {
- ok <- tkmessageBox(message=paste(sQuote(dumpName),
+ ok <- tcltk::tkmessageBox(message=paste(sQuote(dumpName),
"exists.\nOK to overwrite?"),
icon="warning", type="okcancel",
default="ok")
- if(tclvalue(ok) == "ok") {
+ if(tcltk::tclvalue(ok) == "ok") {
assign(dumpName, xy, envir=.GlobalEnv)
- tkdestroy(tt)
+ tcltk::tkdestroy(tt)
}
}
else {
assign(dumpName, xy, envir=.GlobalEnv)
- tkdestroy(tt)
+ tcltk::tkdestroy(tt)
}
}
- tkbind(entryDump, "<Return>", isDone)
- tkfocus(tt)
+ tcltk::tkbind(entryDump, "<Return>", isDone)
+ tcltk::tkfocus(tt)
}
- dump <- tkbutton(buts, text="Dump to R", command=pDump)
+ dump <- tcltk::tkbutton(buts, text="Dump to R", command=pDump)
## Button to write current "orditkplot" object to a graphical device
devDump <- function() {
xy <- ordDump()
@@ -242,10 +244,10 @@
if (!isTRUE(unname(capabilities("tiff"))))
falt["tiff"] <- FALSE
ftypes <- ftypes[falt]
- fname <- tkgetSaveFile(filetypes=ftypes)
- if(tclvalue(fname) == "")
+ fname <- tcltk::tkgetSaveFile(filetypes=ftypes)
+ if(tcltk::tclvalue(fname) == "")
return(NULL)
- fname <- tclvalue(fname)
+ fname <- tcltk::tclvalue(fname)
ftype <- unlist(strsplit(fname, "\\."))
ftype <- ftype[length(ftype)]
if (ftype == "jpeg")
@@ -254,7 +256,7 @@
ftype <- "tiff"
mess <- "is not a supported type: file not produced. Supported types are"
if (!(ftype %in% names(ftypes))) {
- tkmessageBox(message=paste(sQuote(ftype), mess, paste(names(ftypes),
+ tcltk::tkmessageBox(message=paste(sQuote(ftype), mess, paste(names(ftypes),
collapse=", ")), icon="warning")
return(NULL)
}
@@ -272,19 +274,19 @@
plot.orditkplot(xy)
dev.off()
}
- export <- tkbutton(buts, text="Export plot", command=devDump)
+ export <- tcltk::tkbutton(buts, text="Export plot", command=devDump)
##########
### Canvas
##########
-
+
## Make canvas
sco <- try(scores(x, display=display, choices = choices, ...),
silent = TRUE)
if (inherits(sco, "try-error")) {
- tkmessageBox(message=paste("No ordination scores were found in",
+ tcltk::tkmessageBox(message=paste("No ordination scores were found in",
sQuote(deparse(substitute(x)))), icon="error")
- tkdestroy(w)
+ tcltk::tkdestroy(w)
stop("argument x did not contain ordination scores")
}
if (!missing(labels))
@@ -325,13 +327,13 @@
ylim <- range(sco[,2], na.rm = TRUE)
xpretty <- pretty(xlim)
ypretty <- pretty(ylim)
- ## Extend ranges by 4%
+ ## Extend ranges by 4%
xrange <- c(-0.04, 0.04) * diff(xlim) + xlim
xpretty <- xpretty[xpretty >= xrange[1] & xpretty <= xrange[2]]
yrange <- c(-0.04, 0.04) * diff(ylim) + ylim
ypretty <- ypretty[ypretty >= yrange[1] & ypretty <= yrange[2]]
## Canvas like they were in the default devices when I last checked
- if (missing(width))
+ if (missing(width))
width <- p$din[1]
width <- width * PPI * p2p
## Margin row width also varies with platform and devices
@@ -350,11 +352,11 @@
}
## User coordinates of an item
xy2usr <- function(item) {
- xy <- as.numeric(tkcoords(can, item))
- x <- xy[1]
- y <- xy[2]
- x <- xrange[1] + (x - mar[2])/xincr
- y <- yrange[2] - (y - mar[3])/yincr
+ xy <- as.numeric(tcltk::tkcoords(can, item))
+ x <- xy[1]
+ y <- xy[2]
+ x <- xrange[1] + (x - mar[2])/xincr
+ y <- yrange[2] - (y - mar[3])/yincr
c(x,y)
}
## Canvas x or y to user coordinates
@@ -368,49 +370,51 @@
height <- round((diff(yrange)/diff(xrange)) * xusr)
height <- height + mar[1] + mar[3]
## Canvas, finally
- can <- tkcanvas(w, relief="sunken", width=width, height=min(height,YSCR),
+ can <- tcltk::tkcanvas(w, relief="sunken", width=width, height=min(height,YSCR),
scrollregion=c(0,0,width,height))
if (p$bg != "")
- tkconfigure(can, bg=p$bg)
- yscr <- tkscrollbar(w, command = function(...) tkyview(can, ...))
- tkconfigure(can, yscrollcommand = function(...) tkset(yscr, ...))
+ tcltk::tkconfigure(can, bg=p$bg)
+ yscr <- tcltk::tkscrollbar(w, command =
+ function(...) tcltk::tkyview(can, ...))
+ tcltk::tkconfigure(can, yscrollcommand =
+ function(...) tcltk::tkset(yscr, ...))
## Pack it up
- tkpack(buts, side="bottom", fill="x", pady="2m")
- tkpack(can, side="left", fill="x")
- tkpack(yscr, side="right", fill="y")
- tkgrid(cp2eps, export, dump, dismiss, sticky="s")
+ tcltk::tkpack(buts, side="bottom", fill="x", pady="2m")
+ tcltk::tkpack(can, side="left", fill="x")
+ tcltk::tkpack(yscr, side="right", fill="y")
+ tcltk::tkgrid(cp2eps, export, dump, dismiss, sticky="s")
## Box
x0 <- usr2xy(c(xrange[1], yrange[1]))
x1 <- usr2xy(c(xrange[2], yrange[2]))
- tkcreate(can, "rectangle", x0[1], x0[2], x1[1], x1[2], outline = p$fg,
+ tcltk::tkcreate(can, "rectangle", x0[1], x0[2], x1[1], x1[2], outline = p$fg,
width = p$lwd)
## Axes and ticks
tl <- -p$tcl * rpix # -p$tcl * p$ps * p2p
axoff <- p$mgp[3] * rpix
tmp <- xpretty
- for (i in 1:length(tmp)) {
+ for (i in seq_along(tmp)) {
x0 <- usr2xy(c(xpretty[1], yrange[1]))
x1 <- usr2xy(c(xpretty[length(xpretty)], yrange[1]))
- tkcreate(can, "line", x0[1], x0[2]+axoff, x1[1], x1[2]+axoff,
+ tcltk::tkcreate(can, "line", x0[1], x0[2]+axoff, x1[1], x1[2]+axoff,
fill=p$fg)
xx <- usr2xy(c(tmp[i], yrange[1]))
- tkcreate(can, "line", xx[1], xx[2] + axoff, xx[1], xx[2]+tl+axoff,
- fill=p$fg)
- tkcreate(can, "text", xx[1], xx[2] + rpix * p$mgp[2], anchor="n",
+ tcltk::tkcreate(can, "line", xx[1], xx[2] + axoff, xx[1],
+ xx[2]+tl+axoff, fill=p$fg)
+ tcltk::tkcreate(can, "text", xx[1], xx[2] + rpix * p$mgp[2], anchor="n",
text=as.character(tmp[i]), fill=p$col.axis, font=fnt.axis)
}
xx <- usr2xy(c(mean(xrange), yrange[1]))
- tkcreate(can, "text", xx[1], xx[2] + rpix * p$mgp[1],
+ tcltk::tkcreate(can, "text", xx[1], xx[2] + rpix * p$mgp[1],
text=colnames(sco)[1], fill=p$col.lab, anchor="n", font=fnt.lab)
tmp <- ypretty
- for (i in 1:length(tmp)) {
+ for (i in seq_along(tmp)) {
x0 <- usr2xy(c(xrange[1], tmp[1]))
x1 <- usr2xy(c(xrange[1], tmp[length(tmp)]))
- tkcreate(can, "line", x0[1]-axoff, x0[2], x1[1]-axoff, x1[2])
+ tcltk::tkcreate(can, "line", x0[1]-axoff, x0[2], x1[1]-axoff, x1[2])
yy <- usr2xy(c(xrange[1], tmp[i]))
- tkcreate(can, "line", yy[1]-axoff, yy[2], yy[1]-tl-axoff, yy[2],
+ tcltk::tkcreate(can, "line", yy[1]-axoff, yy[2], yy[1]-tl-axoff, yy[2],
fill=p$fg )
- tkcreate(can, "text", yy[1] - rpix * p$mgp[2] , yy[2], anchor="e",
+ tcltk::tkcreate(can, "text", yy[1] - rpix * p$mgp[2] , yy[2], anchor="e",
text=as.character(tmp[i]), fill = p$col.axis, font=fnt.axis)
}
## Points and labels
@@ -425,19 +429,19 @@
lsco <- sco
laboff <- round(p2p * p$ps/2 + diam + 1)
}
- pola <- tclArray() # points
- labtext <- tclArray() # text
- id <- tclArray() # index
+ pola <- tcltk::tclArray() # points
+ labtext <- tcltk::tclArray() # text
+ id <- tcltk::tclArray() # index
for (i in 1:nrow(sco)) {
xy <- usr2xy(sco[i,])
item <- Point(xy[1], xy[2], pch = pch[i], col = pcol[i],
fill = pbg[i], diam = diam[i])
xy <- usr2xy(lsco[i,])
fnt <- c(labfam[i], labsize[i], saneslant(labfnt[i]))
- lab <- tkcreate(can, "text", xy[1], xy[2]-laboff[i], text=labs[i],
+ lab <- tcltk::tkcreate(can, "text", xy[1], xy[2]-laboff[i], text=labs[i],
fill = tcol[i], font=fnt)
- tkaddtag(can, "point", "withtag", item)
- tkaddtag(can, "label", "withtag", lab)
+ tcltk::tkaddtag(can, "point", "withtag", item)
+ tcltk::tkaddtag(can, "label", "withtag", lab)
pola[[lab]] <- item
labtext[[lab]] <- labs[i]
id[[lab]] <- i
@@ -446,29 +450,30 @@
##############################
### Mouse operations on canvas
##############################
-
+
## Plotting and Moving
## Mouse enters a label
pEnter <- function() {
- tkdelete(can, "box")
- hbox <- tkcreate(can, "rectangle", tkbbox(can, "current"),
+ tcltk::tkdelete(can, "box")
+ hbox <- tcltk::tkcreate(can, "rectangle",
+ tcltk::tkbbox(can, "current"),
outline = "red", fill = "yellow")
- tkaddtag(can, "box", "withtag", hbox)
- tkitemraise(can, "current")
+ tcltk::tkaddtag(can, "box", "withtag", hbox)
+ tcltk::tkitemraise(can, "current")
}
## Mouse leaves a label
pLeave <- function() {
- tkdelete(can, "box")
+ tcltk::tkdelete(can, "box")
}
## Select label
pDown <- function(x, y) {
x <- as.numeric(x)
y <- as.numeric(y)
- tkdtag(can, "selected")
- tkaddtag(can, "selected", "withtag", "current")
- tkitemraise(can, "current")
- p <- as.numeric(tkcoords(can,
- pola[[tkfind(can, "withtag", "current")]]))
+ tcltk::tkdtag(can, "selected")
+ tcltk::tkaddtag(can, "selected", "withtag", "current")
+ tcltk::tkitemraise(can, "current")
+ p <- as.numeric(tcltk::tkcoords(can,
+ pola[[tcltk::tkfind(can, "withtag", "current")]]))
.pX <<- (p[1]+p[3])/2
.pY <<- (p[2]+p[4])/2
.lastX <<- x
@@ -478,40 +483,41 @@
pMove <- function(x, y) {
x <- as.numeric(x)
y <- as.numeric(y)
- tkmove(can, "selected", x - .lastX, y - .lastY)
- tkdelete(can, "ptr")
- tkdelete(can, "box")
+ tcltk::tkmove(can, "selected", x - .lastX, y - .lastY)
+ tcltk::tkdelete(can, "ptr")
+ tcltk::tkdelete(can, "box")
.lastX <<- x
.lastY <<- y
## xadj,yadj: adjust for canvas scrolling
- xadj <- as.numeric(tkcanvasx(can, 0))
- yadj <- as.numeric(tkcanvasy(can, 0))
- hbox <- tkcreate(can, "rectangle", tkbbox(can, "selected"),
- outline = "red")
- tkaddtag(can, "box", "withtag", hbox)
- conn <- tkcreate(can, "line", .lastX + xadj, .lastY+yadj,
+ xadj <- as.numeric(tcltk::tkcanvasx(can, 0))
+ yadj <- as.numeric(tcltk::tkcanvasy(can, 0))
+ hbox <- tcltk::tkcreate(can, "rectangle",
+ tcltk::tkbbox(can, "selected"),
+ outline = "red")
+ tcltk::tkaddtag(can, "box", "withtag", hbox)
+ conn <- tcltk::tkcreate(can, "line", .lastX + xadj, .lastY+yadj,
.pX, .pY, fill="red")
- tkaddtag(can, "ptr", "withtag", conn)
+ tcltk::tkaddtag(can, "ptr", "withtag", conn)
}
## Edit label
pEdit <- function() {
- tkdtag(can, "selected")
- tkaddtag(can, "selected", "withtag", "current")
- tkitemraise(can, "current")
- click <- tkfind(can, "withtag", "current")
- txt <- tclVar(labtext[[click]])
+ tcltk::tkdtag(can, "selected")
+ tcltk::tkaddtag(can, "selected", "withtag", "current")
+ tcltk::tkitemraise(can, "current")
+ click <- tcltk::tkfind(can, "withtag", "current")
+ txt <- tcltk::tclVar(labtext[[click]])
i <- as.numeric(id[[click]])
- tt <- tktoplevel()
- labEd <- tkentry(tt, width=20, textvariable=txt)
- tkgrid(tklabel(tt, text = "Edit label"))
- tkgrid(labEd, pady="5m", padx="5m")
+ tt <- tcltk::tktoplevel()
+ labEd <- tcltk::tkentry(tt, width=20, textvariable=txt)
+ tcltk::tkgrid(tcltk::tklabel(tt, text = "Edit label"))
+ tcltk::tkgrid(labEd, pady="5m", padx="5m")
isDone <- function() {
- txt <- tclvalue(txt)
- tkitemconfigure(can, click, text = txt)
+ txt <- tcltk::tclvalue(txt)
+ tcltk::tkitemconfigure(can, click, text = txt)
rownames(sco)[i] <<- txt
- tkdestroy(tt)
+ tcltk::tkdestroy(tt)
}
- tkbind(labEd, "<Return>", isDone)
+ tcltk::tkbind(labEd, "<Return>", isDone)
}
## Zooming: draw rectangle and take its user coordinates
## Rectangle: first corner
@@ -519,7 +525,7 @@
x <- as.numeric(x)
y <- as.numeric(y)
## yadj here and below adjusts for canvas scrolling
- yadj <- as.numeric(tkcanvasy(can, 0))
+ yadj <- as.numeric(tcltk::tkcanvasy(can, 0))
.pX <<- x
.pY <<- y + yadj
}
@@ -527,13 +533,13 @@
pRect <- function(x, y) {
x <- as.numeric(x)
y <- as.numeric(y)
- tkdelete(can, "box")
- yadj <- as.numeric(tkcanvasy(can, 0))
+ tcltk::tkdelete(can, "box")
+ yadj <- as.numeric(tcltk::tkcanvasy(can, 0))
.lastX <<- x
.lastY <<- y + yadj
- rect <- tkcreate(can, "rectangle", .pX, .pY, .lastX, .lastY,
+ rect <- tcltk::tkcreate(can, "rectangle", .pX, .pY, .lastX, .lastY,
outline="blue")
- tkaddtag(can, "box", "withtag", rect)
+ tcltk::tkaddtag(can, "box", "withtag", rect)
}
## Redraw ordiktplot with new xlim and ylim
pZoom <- function() {
@@ -555,20 +561,21 @@
.pY <- 0
## Mouse bindings:
## Moving a label
- tkitembind(can, "label", "<Any-Enter>", pEnter)
- tkitembind(can, "label", "<Any-Leave>", pLeave)
- tkitembind(can, "label", "<1>", pDown)
- tkitembind(can, "label", "<ButtonRelease-1>",
- function() {tkdtag(can, "selected"); tkdelete(can, "ptr")})
- tkitembind(can, "label", "<B1-Motion>", pMove)
+ tcltk::tkitembind(can, "label", "<Any-Enter>", pEnter)
+ tcltk::tkitembind(can, "label", "<Any-Leave>", pLeave)
+ tcltk::tkitembind(can, "label", "<1>", pDown)
+ tcltk::tkitembind(can, "label", "<ButtonRelease-1>",
+ function() {tcltk::tkdtag(can, "selected")
+ tcltk::tkdelete(can, "ptr")})
+ tcltk::tkitembind(can, "label", "<B1-Motion>", pMove)
## Edit labels
- tkitembind(can, "label", "<Double-Button-1>", pEdit)
+ tcltk::tkitembind(can, "label", "<Double-Button-1>", pEdit)
## Zoom (with one-button mouse)
- tkbind(can, "<Shift-Button-1>", pRect0)
- tkbind(can, "<Shift-B1-Motion>", pRect)
- tkbind(can, "<Shift-ButtonRelease>", pZoom)
+ tcltk::tkbind(can, "<Shift-Button-1>", pRect0)
+ tcltk::tkbind(can, "<Shift-B1-Motion>", pRect)
+ tcltk::tkbind(can, "<Shift-ButtonRelease>", pZoom)
## Zoom (with right button)
- tkbind(can, "<Button-3>", pRect0)
- tkbind(can, "<B3-Motion>", pRect)
- tkbind(can, "<ButtonRelease-3>", pZoom)
+ tcltk::tkbind(can, "<Button-3>", pRect0)
+ tcltk::tkbind(can, "<B3-Motion>", pRect)
+ tcltk::tkbind(can, "<ButtonRelease-3>", pZoom)
}
diff --git a/R/permutest.betadisper.R b/R/permutest.betadisper.R
index cf54f99..9e01a2e 100644
--- a/R/permutest.betadisper.R
+++ b/R/permutest.betadisper.R
@@ -81,7 +81,7 @@
parallel <- 1
}
hasClus <- inherits(parallel, "cluster")
- if ((hasClus || parallel > 1L) && requireNamespace("parallel")) {
+ if (hasClus || parallel > 1L) {
if (.Platform$OS.type == "unix" && !hasClus) {
Pstats <- do.call("rbind",
mclapply(seq_len(nperm),
@@ -92,7 +92,8 @@
if (!hasClus) {
parallel <- makeCluster(parallel)
}
- Pstats <- parRapply(parallel, permutations, function(x) permFun(x))
+ Pstats <- parRapply(parallel, permutations,
+ function(x) permFun(x))
if (!hasClus) {
stopCluster(parallel)
}
diff --git a/R/permutest.cca.R b/R/permutest.cca.R
index 1a9a0ff..dce3405 100644
--- a/R/permutest.cca.R
+++ b/R/permutest.cca.R
@@ -117,7 +117,7 @@ permutest.default <- function(x, ...)
if (is.null(parallel))
parallel <- 1
hasClus <- inherits(parallel, "cluster")
- if ((hasClus || parallel > 1) && require(parallel)) {
+ if (hasClus || parallel > 1) {
if(.Platform$OS.type == "unix" && !hasClus) {
tmp <- do.call(rbind,
mclapply(1:nperm,
diff --git a/R/plot.spantree.R b/R/plot.spantree.R
index 2e21718..0a3d712 100644
--- a/R/plot.spantree.R
+++ b/R/plot.spantree.R
@@ -1,21 +1,24 @@
-"plot.spantree" <-
+`plot.spantree` <-
function (x, ord, cex = 0.7, type = "p", labels, dlim, FUN = sammon,
...)
{
FUNname <- deparse(substitute(FUN))
FUN <- match.fun(FUN)
- n <- length(x$kid) + 1
+ n <- x$n
if (missing(ord)) {
d <- cophenetic(x)
if (any(d<=0))
d[d<=0] <- min(d>0)/10
if (!missing(dlim))
d[d > dlim ] <- dlim
- y <- cmdscale(d)
- dup <- duplicated(y)
- if (any(dup))
- y[dup, ] <- y[dup,] + runif(2*sum(dup), -0.01, 0.01)
- ord <- FUN(d, y)
+ if (n > 2) {
+ y <- cmdscale(d)
+ dup <- duplicated(y)
+ if (any(dup))
+ y[dup, ] <- y[dup,] + runif(2*sum(dup), -0.01, 0.01)
+ ord <- FUN(d, y)
+ } else
+ ord <- cbind(seq_len(n), rep(0,n))
}
ord <- scores(ord, display = "sites", ...)
ordiArgAbsorber(ord, asp = 1, type = "n", FUN = "plot", ...)
diff --git a/R/poolaccum.R b/R/poolaccum.R
index c1fd436..67e2007 100644
--- a/R/poolaccum.R
+++ b/R/poolaccum.R
@@ -5,15 +5,18 @@
n <- nrow(x)
m <- ncol(x)
N <- seq_len(n)
- S <- chao <- boot <- jack1 <- jack2 <-
- matrix(0, nrow=n, ncol=permutations)
## specpool() is slow, but the vectorized versions below are
- ## pretty fast
- for (i in 1:permutations) {
+ ## pretty fast. We do not set up parallel processing, but use
+ ## permute API.
+ permat <- getPermuteMatrix(permutations, n)
+ nperm <- nrow(permat)
+ S <- chao <- boot <- jack1 <- jack2 <-
+ matrix(0, nrow=n, ncol=nperm)
+ for (i in 1:nperm) {
## It is a bad practice to replicate specpool equations here:
## if we change specpool, this function gets out of sync. You
## should be ashamed, Jari Oksanen!
- take <- sample.int(n, n)
+ take <- permat[i,]
tmp <- apply(x[take,] > 0, 2, cumsum)
S[,i] <- rowSums(tmp > 0)
## All-zero species are taken as *known* to be missing in
@@ -36,6 +39,7 @@
out <- list(S = S[take,], chao = chao[take,], jack1 = jack1[take,],
jack2 = jack2[take,], boot = boot[take,], N = N[take],
means = means[take,])
+ attr(out, "control") <- attr(permat, "control")
class(out) <- "poolaccum"
out
}
diff --git a/R/print.mantel.correlog.R b/R/print.mantel.correlog.R
index 61f76ee..62c23ab 100644
--- a/R/print.mantel.correlog.R
+++ b/R/print.mantel.correlog.R
@@ -6,4 +6,4 @@
cat('\n')
printCoefmat(x$mantel.res, P.values=TRUE, signif.stars=TRUE, Pvalues = TRUE)
invisible(x)
-}
\ No newline at end of file
+}
diff --git a/R/renyiaccum.R b/R/renyiaccum.R
index add178d..3c71d12 100644
--- a/R/renyiaccum.R
+++ b/R/renyiaccum.R
@@ -10,14 +10,15 @@ function(x, scales=c(0, 0.5, 1, 2, 4, Inf), permutations = 100,
if (p==1) {
x <- t(x)
n <- nrow(x)
- p <- ncol(x)
+ p <- ncol(x)
}
+ pmat <- getPermuteMatrix(permutations, n)
m <- length(scales)
result <- array(dim=c(n,m,permutations))
dimnames(result) <- list(pooled.sites=c(1:n), scale=scales,
permutation=c(1:permutations))
for (k in 1:permutations) {
- result[,,k] <- as.matrix(renyi((apply(x[sample(n),],2,cumsum)),
+ result[,,k] <- as.matrix(renyi((apply(x[pmat[k,],],2,cumsum)),
scales=scales, ...))
}
if (raw)
@@ -47,6 +48,7 @@ function(x, scales=c(0, 0.5, 1, 2, 4, Inf), permutations = 100,
scale=scales,
c("mean", "stdev", "min", "max", "Qnt 0.025", "Qnt 0.975", if (collector) "Collector"))
}
+ attr(result, "control") <- attr(pmat, "control")
class(result) <- c("renyiaccum", class(result))
result
}
diff --git a/R/simper.R b/R/simper.R
index 5114d4f..d86b86c 100644
--- a/R/simper.R
+++ b/R/simper.R
@@ -1,12 +1,12 @@
`simper` <-
- function(comm, group, permutations = 0, trace = FALSE,
+ function(comm, group, permutations = 0, trace = FALSE,
parallel = getOption("mc.cores"), ...)
{
- if (any(rowSums(comm, na.rm = TRUE) == 0))
+ if (any(rowSums(comm, na.rm = TRUE) == 0))
warning("you have empty rows: results may be meaningless")
pfun <- function(x, comm, comp, i, contrp) {
groupp <- group[perm[x,]]
- ga <- comm[groupp == comp[i, 1], , drop = FALSE]
+ ga <- comm[groupp == comp[i, 1], , drop = FALSE]
gb <- comm[groupp == comp[i, 2], , drop = FALSE]
n.a <- nrow(ga)
n.b <- nrow(gb)
@@ -14,7 +14,7 @@
for(k in seq_len(n.a)) {
mdp <- abs(ga[k, , drop = FALSE] - gb[j, , drop = FALSE])
mep <- ga[k, , drop = FALSE] + gb[j, , drop = FALSE]
- contrp[(j-1)*n.a+k, ] <- mdp / sum(mep)
+ contrp[(j-1)*n.a+k, ] <- mdp / sum(mep)
}
}
colMeans(contrp)
@@ -39,7 +39,7 @@
if (is.null(parallel))
parallel <- 1
hasClus <- inherits(parallel, "cluster")
- isParal <- (hasClus || parallel > 1) && require(parallel)
+ isParal <- hasClus || parallel > 1
isMulticore <- .Platform$OS.type == "unix" && !hasClus
if (isParal && !isMulticore && !hasClus) {
parallel <- makeCluster(parallel)
@@ -54,11 +54,11 @@
for (k in seq_len(n.a)) {
md <- abs(group.a[k, , drop = FALSE] - group.b[j, , drop = FALSE])
me <- group.a[k, , drop = FALSE] + group.b[j, , drop = FALSE]
- contr[(j-1)*n.a+k, ] <- md / sum(me)
+ contr[(j-1)*n.a+k, ] <- md / sum(me)
}
}
average <- colMeans(contr)
-
+
## Apply permutations
if(nperm > 0){
if (trace)
@@ -67,28 +67,28 @@
if (isParal) {
if (isMulticore){
- perm.contr <- mclapply(seq_len(nperm), function(d)
+ perm.contr <- mclapply(seq_len(nperm), function(d)
pfun(d, comm, comp, i, contrp), mc.cores = parallel)
perm.contr <- do.call(cbind, perm.contr)
} else {
- perm.contr <- parSapply(parallel, seq_len(nperm), function(d)
+ perm.contr <- parSapply(parallel, seq_len(nperm), function(d)
pfun(d, comm, comp, i, contrp))
- }
+ }
} else {
- perm.contr <- sapply(1:nperm, function(d)
+ perm.contr <- sapply(1:nperm, function(d)
pfun(d, comm, comp, i, contrp))
}
p <- (rowSums(apply(perm.contr, 2, function(x) x >= average)) + 1) / (nperm + 1)
- }
+ }
else {
p <- NULL
}
-
+
overall <- sum(average)
sdi <- apply(contr, 2, sd)
ratio <- average / sdi
ava <- colMeans(group.a)
- avb <- colMeans(group.b)
+ avb <- colMeans(group.b)
ord <- order(average, decreasing = TRUE)
cusum <- cumsum(average[ord] / overall)
out <- list(species = colnames(comm), average = average,
@@ -111,7 +111,7 @@
cat("cumulative contributions of most influential species:\n\n")
cusum <- lapply(x, function(z) z$cusum)
spec <- lapply(x, function(z) z$species[z$ord])
- for (i in 1:length(cusum)) {
+ for (i in seq_along(cusum)) {
names(cusum[[i]]) <- spec[[i]]
}
## this probably fails with empty or identical groups that have 0/0 = NaN
@@ -124,20 +124,20 @@
function(object, ordered = TRUE, digits = max(3, getOption("digits") - 3), ...)
{
if (ordered) {
- out <- lapply(object, function(z)
- data.frame(contr = z$average, sd = z$sd, ratio = z$ratio,
+ out <- lapply(object, function(z)
+ data.frame(contr = z$average, sd = z$sd, ratio = z$ratio,
av.a = z$ava, av.b = z$avb)[z$ord, ])
cusum <- lapply(object, function(z) z$cusum)
- for(i in 1:length(out)) {
+ for(i in seq_along(out)) {
out[[i]]$cumsum <- cusum[[i]]
if(!is.null(object[[i]]$p)) {
out[[i]]$p <- object[[i]]$p[object[[i]]$ord]
}
- }
- }
+ }
+ }
else {
- out <- lapply(object, function(z)
- data.frame(cbind(contr = z$average, sd = z$sd, 'contr/sd' = z$ratio,
+ out <- lapply(object, function(z)
+ data.frame(cbind(contr = z$average, sd = z$sd, 'contr/sd' = z$ratio,
ava = z$ava, avb = z$avb, p = z$p)))
}
attr(out, "digits") <- digits
diff --git a/R/spantree.R b/R/spantree.R
index fea2012..3bc826c 100644
--- a/R/spantree.R
+++ b/R/spantree.R
@@ -1,4 +1,4 @@
-"spantree" <-
+`spantree` <-
function (d, toolong = 0)
{
dis <- as.dist(d)
@@ -8,7 +8,7 @@
n = as.integer(n), val = double(n + 1),
dad = integer(n + 1), NAOK = TRUE, PACKAGE = "vegan")
out <- list(kid = dis$dad[2:n] + 1, dist = dis$val[2:n],
- labels = labels, call = match.call())
+ labels = labels, n = n, call = match.call())
class(out) <- "spantree"
out
}
diff --git a/R/specaccum.R b/R/specaccum.R
index a80ad70..940e70b 100644
--- a/R/specaccum.R
+++ b/R/specaccum.R
@@ -31,14 +31,10 @@
xout <- weights <- cumsum(w)
specaccum <- accumulator(x, sites)
}, random = {
- perm <- array(dim = c(n, permutations))
+ permat <- getPermuteMatrix(permutations, n)
+ perm <- apply(permat, 1, accumulator, x = x)
if (!is.null(w))
- weights <- array(dim = c(n, permutations))
- for (i in 1:permutations) {
- perm[, i] <- accumulator(x, ord <- sample(n))
- if(!is.null(w))
- weights[,i] <- cumsum(w[ord])
- }
+ weights <- apply(permat, 1, function(i) cumsum(w[i]))
sites <- 1:n
if (is.null(w)) {
specaccum <- apply(perm, 1, mean)
@@ -113,6 +109,8 @@
}
if (method == "rarefaction")
out$individuals <- ind
+ if (method == "random")
+ attr(out, "control") <- attr(permat, "control")
class(out) <- "specaccum"
out
}
diff --git a/R/specpool.R b/R/specpool.R
index ee03bcb..a094772 100644
--- a/R/specpool.R
+++ b/R/specpool.R
@@ -52,7 +52,7 @@
a1/a2
else 0
if (a2 > 0)
- var.chao[is] <- a2 * ssc * (0.5 + ssc * (1 + aa/4) * aa) * aa * aa
+ var.chao[is] <- a1 * ssc * (0.5 + ssc * (1 + aa/4) * aa) * aa
else
var.chao[is] <-
ssc * (ssc * (a1*(2*a1-1)^2/4 - a1^4/chao[is]/4) + a1*(a1-1)/2)
diff --git a/R/tolerance.cca.R b/R/tolerance.cca.R
index 87e961d..3bc2883 100644
--- a/R/tolerance.cca.R
+++ b/R/tolerance.cca.R
@@ -32,7 +32,11 @@ tolerance.cca <- function(x, choices = 1:2,
which <- "species"
## reconstruct species/response matrix Y - up to machine precision!
partialFit <- ifelse(is.null(x$pCCA$Fit), 0, x$pCCA$Fit)
- Y <- ((partialFit + x$CCA$Xbar) * sqrt(x$rowsum %o% x$colsum) +
+ if (is.null(x$CCA))
+ Xbar <- x$CA$Xbar
+ else
+ Xbar <- x$CCA$Xbar
+ Y <- ((partialFit + Xbar) * sqrt(x$rowsum %o% x$colsum) +
x$rowsum %o% x$colsum) * x$grand.total
which <- match.arg(which)
siteScrTypes <- if(is.null(x$CCA)){ "sites" } else {"lc"}
diff --git a/R/tsallisaccum.R b/R/tsallisaccum.R
index fcbaeaf..178fca1 100644
--- a/R/tsallisaccum.R
+++ b/R/tsallisaccum.R
@@ -1,6 +1,6 @@
-tsallisaccum <-
-function (x, scales = seq(0, 2, 0.2), permutations = 100, raw = FALSE,
- subset, ...)
+`tsallisaccum` <-
+ function (x, scales = seq(0, 2, 0.2), permutations = 100, raw = FALSE,
+ subset, ...)
{
if (!missing(subset))
x <- subset(x, subset)
@@ -12,12 +12,13 @@ function (x, scales = seq(0, 2, 0.2), permutations = 100, raw = FALSE,
n <- nrow(x)
p <- ncol(x)
}
+ pmat <- getPermuteMatrix(permutations, n)
m <- length(scales)
result <- array(dim = c(n, m, permutations))
dimnames(result) <- list(pooled.sites = c(1:n), scale = scales,
permutation = c(1:permutations))
for (k in 1:permutations) {
- result[, , k] <- as.matrix(tsallis((apply(x[sample(n),
+ result[, , k] <- as.matrix(tsallis((apply(x[pmat[k,],
], 2, cumsum)), scales = scales, ...))
}
if (raw) {
@@ -43,6 +44,7 @@ function (x, scales = seq(0, 2, 0.2), permutations = 100, raw = FALSE,
dimnames(result) <- list(pooled.sites = c(1:n), scale = scales,
c("mean", "stdev", "min", "max", "Qnt 0.025", "Qnt 0.975"))
}
+ attr(result, "control") <- attr(pmat, "control")
class(result) <- c("tsallisaccum", "renyiaccum", class(result))
result
}
diff --git a/R/vegandocs.R b/R/vegandocs.R
index 998adfd..6e1f25e 100644
--- a/R/vegandocs.R
+++ b/R/vegandocs.R
@@ -1,5 +1,5 @@
`vegandocs` <-
- function (doc = c("NEWS", "ONEWS", "ChangeLog", "FAQ-vegan.pdf",
+ function (doc = c("NEWS", "ONEWS", "FAQ-vegan.pdf",
"intro-vegan.pdf", "diversity-vegan.pdf",
"decision-vegan.pdf", "partitioning.pdf", "permutations.pdf"))
{
diff --git a/R/vif.cca.R b/R/vif.cca.R
index 03735e3..48efea0 100644
--- a/R/vif.cca.R
+++ b/R/vif.cca.R
@@ -1,6 +1,8 @@
`vif.cca` <-
function(object)
{
+ if (is.null(object$CCA))
+ stop("can be used only with constrained ordination")
Q <- object$CCA$QR
out <- rep(NA, NCOL(Q$qr))
names(out)[Q$pivot] <- colnames(Q$qr)
diff --git a/README.md b/README.md
deleted file mode 100644
index 3848d40..0000000
--- a/README.md
+++ /dev/null
@@ -1,7 +0,0 @@
-# vegan: an R package for community ecologists
-
-## Build status
-
-Linux | Windows
-------------|------------
-[![Build Status](https://travis-ci.org/vegandevs/vegan.svg?branch=master)](https://travis-ci.org/vegandevs/vegan) | [![Build status](https://ci.appveyor.com/api/projects/status/n7c2srupr55uhh4u/branch/master?svg=true)](https://ci.appveyor.com/project/gavinsimpson/vegan/branch/master)
diff --git a/inst/ChangeLog b/inst/ChangeLog
index 0680df6..fbfe86f 100644
--- a/inst/ChangeLog
+++ b/inst/ChangeLog
@@ -1,5 +1,16 @@
VEGAN DEVEL VERSIONS at https://github.com/vegandevs/vegan
+ ChangeLog provided a detailed development history of vegan, but it
+ is not updated after September 11, 2014. Vegan moved to git source
+ code management and linear ChangeLog is poorly suited for
+ branching git development. Use git log to track the history in
+ your current branch. The main upstream repository of vegan is
+ currently https://github.com/vegandevs/vegan.
+
+ ChangeLog gave technical details and was mainly provided for vegan
+ developers. Most important user-visible changes are listed in the
+ NEWS of the current release and its patched version.
+
Version 2.1-43 (opened September 11, 2014)
* cca, rda, capscale: remove u.eig, v.eig and wa.eig items or
diff --git a/inst/NEWS.Rd b/inst/NEWS.Rd
index 94a250e..a1d980a 100644
--- a/inst/NEWS.Rd
+++ b/inst/NEWS.Rd
@@ -2,6 +2,72 @@
\title{vegan News}
\encoding{UTF-8}
+\section{Changes in version 2.2-1}{
+
+ \subsection{GENERAL}{
+ \itemize{
+
+ \item This is a maintenance release to avoid warning messages
+ caused by changes in CRAN repository. The namespace usage is also
+ more stringent to avoid warnings and notes in development versions
+ of \R.
+
+ }
+ }% end general
+
+ \subsection{INSTALLATION}{
+ \itemize{
+
+ \item \pkg{vegan} can be installed and loaded without \pkg{tcltk}
+ package. The \pkg{tcltk} package is needed in \code{orditkplot}
+ function for interactive editing of ordination graphics.
+
+ }
+ } % installation
+
+ \subsection{BUG FIXES}{
+ \itemize{
+
+ \item \code{ordisurf} failed if \pkg{gam} package was loaded due
+ to namespace issues: some support functions of \pkg{gam} were used
+ instead of \pkg{mgcv} functions.
+
+ \item \code{tolerance} function failed for unconstrained
+ correspondence analysis.
+
+ }
+ } % bug fixes
+
+ \subsection{NEW FEATURES}{
+ \itemize{
+
+ \item \code{estimateR} uses a more exact variance formula for
+ bias-corrected Chao estimate of extrapolated number of
+ species. The new formula may be unpublished, but it was derived
+ following the guidelines of Chiu, Wang, Walther & Chao,
+ \emph{Biometrics} 70, 671--682 (2014),
+ \href{http://onlinelibrary.wiley.com/doi/10.1111/biom.12200/suppinfo}{online
+ supplementary material}.
+
+ \item Diversity accumulation functions \code{specaccum},
+ \code{renyiaccum}, \code{tsallisaccum}, \code{poolaccum} and
+ \code{estaccumR} use now \pkg{permute} package for permutations
+ of the order of sampling sites. Normally these functions only
+ need simple random permutation of sites, but restricted
+ permutation of the \pkg{permute} package and user-supplied
+ permutation matrices can be used.
+
+ \item \code{estaccumR} function can use parallel processing.
+
+ \item \code{linestack} accepts now expressions as labels. This
+ allows using mathematical symbols and formula given as
+ mathematical expressions.
+
+ }
+ } % new features
+
+} % v2.2-1
+
\section{Changes in version 2.2-0}{
\subsection{GENERAL}{
diff --git a/inst/doc/FAQ-vegan.pdf b/inst/doc/FAQ-vegan.pdf
index 0379210..d43090e 100644
Binary files a/inst/doc/FAQ-vegan.pdf and b/inst/doc/FAQ-vegan.pdf differ
diff --git a/inst/doc/NEWS.html b/inst/doc/NEWS.html
index b61ebb8..c01b47f 100644
--- a/inst/doc/NEWS.html
+++ b/inst/doc/NEWS.html
@@ -7,6 +7,88 @@
<h2>vegan News</h2>
+<h3>Changes in version 2.2-1</h3>
+
+
+
+<h4>GENERAL</h4>
+
+
+<ul>
+<li><p> This is a maintenance release to avoid warning messages
+caused by changes in CRAN repository. The namespace usage is also
+more stringent to avoid warnings and notes in development versions
+of <span style="font-family: Courier New, Courier; color: #666666;"><b>R</b></span>.
+</p>
+</li></ul>
+
+
+
+
+<h4>INSTALLATION</h4>
+
+
+<ul>
+<li> <p><span class="pkg">vegan</span> can be installed and loaded without <span class="pkg">tcltk</span>
+package. The <span class="pkg">tcltk</span> package is needed in <code>orditkplot</code>
+function for interactive editing of ordination graphics.
+</p>
+</li></ul>
+
+
+
+
+<h4>BUG FIXES</h4>
+
+
+<ul>
+<li> <p><code>ordisurf</code> failed if <span class="pkg">gam</span> package was loaded due
+to namespace issues: some support functions of <span class="pkg">gam</span> were used
+instead of <span class="pkg">mgcv</span> functions.
+</p>
+</li>
+<li> <p><code>tolerance</code> function failed for unconstrained
+correspondence analysis.
+</p>
+</li></ul>
+
+
+
+
+<h4>NEW FEATURES</h4>
+
+
+<ul>
+<li> <p><code>estimateR</code> uses a more exact variance formula for
+bias-corrected Chao estimate of extrapolated number of
+species. The new formula may be unpublished, but it was derived
+following the guidelines of Chiu, Wang, Walther & Chao,
+<em>Biometrics</em> 70, 671–682 (2014),
+<a href="http://onlinelibrary.wiley.com/doi/10.1111/biom.12200/suppinfo">online
+supplementary material</a>.
+</p>
+</li>
+<li><p> Diversity accumulation functions <code>specaccum</code>,
+<code>renyiaccum</code>, <code>tsallisaccum</code>, <code>poolaccum</code> and
+<code>estaccumR</code> use now <span class="pkg">permute</span> package for permutations
+of the order of sampling sites. Normally these functions only
+need simple random permutation of sites, but restricted
+permutation of the <span class="pkg">permute</span> package and user-supplied
+permutation matrices can be used.
+</p>
+</li>
+<li> <p><code>estaccumR</code> function can use parallel processing.
+</p>
+</li>
+<li> <p><code>linestack</code> accepts now expressions as labels. This
+allows using mathematical symbols and formula given as
+mathematical expressions.
+</p>
+</li></ul>
+
+
+
+
<h3>Changes in version 2.2-0</h3>
diff --git a/inst/doc/decision-vegan.pdf b/inst/doc/decision-vegan.pdf
index 2812360..e6d2559 100644
Binary files a/inst/doc/decision-vegan.pdf and b/inst/doc/decision-vegan.pdf differ
diff --git a/inst/doc/diversity-vegan.R b/inst/doc/diversity-vegan.R
index a56a00f..d9667bd 100644
--- a/inst/doc/diversity-vegan.R
+++ b/inst/doc/diversity-vegan.R
@@ -80,7 +80,7 @@ range(diversity(BCI, "simp") - (S2 -1))
###################################################
-### code chunk number 13: diversity-vegan.Rnw:258-262
+### code chunk number 13: diversity-vegan.Rnw:260-264
###################################################
data(dune)
data(dune.taxon)
@@ -89,21 +89,21 @@ mod <- taxondive(dune, taxdis)
###################################################
-### code chunk number 14: diversity-vegan.Rnw:265-266
+### code chunk number 14: diversity-vegan.Rnw:267-268
###################################################
getOption("SweaveHooks")[["fig"]]()
plot(mod)
###################################################
-### code chunk number 15: diversity-vegan.Rnw:292-294
+### code chunk number 15: diversity-vegan.Rnw:294-296
###################################################
tr <- hclust(taxdis, "aver")
mod <- treedive(dune, tr)
###################################################
-### code chunk number 16: diversity-vegan.Rnw:316-319
+### code chunk number 16: diversity-vegan.Rnw:318-321
###################################################
k <- sample(nrow(BCI), 1)
fish <- fisherfit(BCI[k,])
@@ -111,27 +111,27 @@ fish
###################################################
-### code chunk number 17: diversity-vegan.Rnw:322-323
+### code chunk number 17: diversity-vegan.Rnw:324-325
###################################################
getOption("SweaveHooks")[["fig"]]()
plot(fish)
###################################################
-### code chunk number 18: diversity-vegan.Rnw:351-352
+### code chunk number 18: diversity-vegan.Rnw:353-354
###################################################
prestondistr(BCI[k,])
###################################################
-### code chunk number 19: diversity-vegan.Rnw:383-385
+### code chunk number 19: diversity-vegan.Rnw:385-387
###################################################
rad <- radfit(BCI[k,])
rad
###################################################
-### code chunk number 20: diversity-vegan.Rnw:388-389
+### code chunk number 20: diversity-vegan.Rnw:390-391
###################################################
getOption("SweaveHooks")[["fig"]]()
print(radlattice(rad))
@@ -145,7 +145,7 @@ plot(sac, ci.type="polygon", ci.col="yellow")
###################################################
-### code chunk number 22: diversity-vegan.Rnw:458-459
+### code chunk number 22: diversity-vegan.Rnw:461-462
###################################################
getOption("SweaveHooks")[["fig"]]()
sac <- specaccum(BCI)
@@ -153,33 +153,33 @@ plot(sac, ci.type="polygon", ci.col="yellow")
###################################################
-### code chunk number 23: diversity-vegan.Rnw:487-488
+### code chunk number 23: diversity-vegan.Rnw:490-491
###################################################
ncol(BCI)/mean(specnumber(BCI)) - 1
###################################################
-### code chunk number 24: diversity-vegan.Rnw:505-507
+### code chunk number 24: diversity-vegan.Rnw:508-510
###################################################
beta <- vegdist(BCI, binary=TRUE)
mean(beta)
###################################################
-### code chunk number 25: diversity-vegan.Rnw:514-515
+### code chunk number 25: diversity-vegan.Rnw:517-518
###################################################
betadiver(help=TRUE)
###################################################
-### code chunk number 26: diversity-vegan.Rnw:533-535
+### code chunk number 26: diversity-vegan.Rnw:536-538
###################################################
z <- betadiver(BCI, "z")
quantile(z)
###################################################
-### code chunk number 27: diversity-vegan.Rnw:545-550
+### code chunk number 27: diversity-vegan.Rnw:548-553
###################################################
data(dune)
data(dune.env)
@@ -189,40 +189,40 @@ mod
###################################################
-### code chunk number 28: diversity-vegan.Rnw:553-554
+### code chunk number 28: diversity-vegan.Rnw:556-557
###################################################
getOption("SweaveHooks")[["fig"]]()
boxplot(mod)
###################################################
-### code chunk number 29: diversity-vegan.Rnw:639-640
+### code chunk number 29: diversity-vegan.Rnw:668-669
###################################################
specpool(BCI)
###################################################
-### code chunk number 30: diversity-vegan.Rnw:645-647
+### code chunk number 30: diversity-vegan.Rnw:674-676
###################################################
s <- sample(nrow(BCI), 25)
specpool(BCI[s,])
###################################################
-### code chunk number 31: diversity-vegan.Rnw:658-659
+### code chunk number 31: diversity-vegan.Rnw:687-688
###################################################
estimateR(BCI[k,])
###################################################
-### code chunk number 32: diversity-vegan.Rnw:698-700
+### code chunk number 32: diversity-vegan.Rnw:757-759
###################################################
veiledspec(prestondistr(BCI[k,]))
veiledspec(BCI[k,])
###################################################
-### code chunk number 33: diversity-vegan.Rnw:714-715
+### code chunk number 33: diversity-vegan.Rnw:773-774
###################################################
smo <- beals(BCI)
@@ -232,17 +232,17 @@ smo <- beals(BCI)
###################################################
j <- which(colnames(BCI) == "Ceiba.pentandra")
plot(beals(BCI, species=j, include=FALSE), BCI[,j],
- main="Ceiba pentandra", xlab="Probability of occurrence",
- ylab="Occurrence")
+ ylab="Occurrence", main="Ceiba pentandra",
+ xlab="Probability of occurrence")
###################################################
-### code chunk number 35: diversity-vegan.Rnw:728-729
+### code chunk number 35: diversity-vegan.Rnw:787-788
###################################################
getOption("SweaveHooks")[["fig"]]()
j <- which(colnames(BCI) == "Ceiba.pentandra")
plot(beals(BCI, species=j, include=FALSE), BCI[,j],
- main="Ceiba pentandra", xlab="Probability of occurrence",
- ylab="Occurrence")
+ ylab="Occurrence", main="Ceiba pentandra",
+ xlab="Probability of occurrence")
diff --git a/inst/doc/diversity-vegan.Rnw b/inst/doc/diversity-vegan.Rnw
index 903a141..4ffc833 100644
--- a/inst/doc/diversity-vegan.Rnw
+++ b/inst/doc/diversity-vegan.Rnw
@@ -67,7 +67,7 @@ indices \citep{Hill73number}:
\begin{align}
H &= - \sum_{i=1}^S p_i \log_b p_i & \text{Shannon--Weaver}\\
D_1 &= 1 - \sum_{i=1}^S p_i^2 &\text{Simpson}\\
-D_2 &= \frac{1}{\sum_{i=1}^S p_i^2} &\text{inverse Simpson}
+D_2 &= \frac{1}{\sum_{i=1}^S p_i^2} &\text{inverse Simpson}\,,
\end{align}
where $p_i$ is the proportion of species $i$, and $S$ is the number of
species so that $\sum_{i=1}^S p_i = 1$, and $b$ is the base of the
@@ -92,9 +92,9 @@ the numbers of species.
\pkg{vegan} also can estimate series of R\'{e}nyi and Tsallis
diversities. R{\'e}nyi diversity of order $a$ is \citep{Hill73number}:
\begin{equation}
-H_a = \frac{1}{1-a} \log \sum_{i=1}^S p_i^a
+H_a = \frac{1}{1-a} \log \sum_{i=1}^S p_i^a \,,
\end{equation}
-or the corresponding Hill numbers $N_a = \exp(H_a)$. Many common
+and the corresponding Hill number is $N_a = \exp(H_a)$. Many common
diversity indices are special cases of Hill numbers: $N_0 = S$, $N_1 =
\exp(H')$, $N_2 = D_2$, and $N_\infty = 1/(\max p_i)$. The
corresponding R\'{e}nyi diversities are $H_0 = \log(S)$, $H_1 = H'$, $H_2 =
@@ -103,8 +103,8 @@ Tsallis diversity of order $q$ is \citep{Tothmeresz95}:
\begin{equation}
H_q = \frac{1}{q-1} \left(1 - \sum_{i=1}^S p^q \right) \, .
\end{equation}
-This corresponds to common diversity indices: $H_0 = S-1$, $H_1 = H'$,
-and $H_2 = D_2$, and can be converted to the Hill number:
+These correspond to common diversity indices: $H_0 = S-1$, $H_1 = H'$,
+and $H_2 = D_1$, and can be converted to Hill numbers:
\begin{equation}
N_q = (1 - (q-1) H_q )^\frac{1}{1-q} \, .
\end{equation}
@@ -117,7 +117,7 @@ R <- renyi(BCI[k,])
We can really regard a site more diverse if all of its R\'{e}nyi
diversities are higher than in another site. We can inspect this
graphically using the standard \code{plot} function for the
-\code{renyi} result (Fig. \ref{fig:renyi}).
+\code{renyi} result (Fig.~\ref{fig:renyi}).
\begin{figure}
<<fig=true,echo=false>>=
print(plot(R))
@@ -142,28 +142,28 @@ richness actually may be caused by differences in sample size. To
solve this problem, we may try to rarefy species richness to the same
number of individuals. Expected number of species in a community
rarefied from $N$ to $n$ individuals is \citep{Hurlbert71}:
-\begin{multline}
+\begin{equation}
\label{eq:rare}
-\hat S_n = \sum_{i=1}^S (1 - q_i),\\ \text{where} \quad q_i = {N-x_i
- \choose n} \Bigm /{N \choose n}
-\end{multline}
-where $x_i$ is the count of species $i$, and ${N \choose n}$ is the
+\hat S_n = \sum_{i=1}^S (1 - q_i)\,, \quad\text{where } q_i =
+\frac{{N-x_i \choose n}}{{N \choose n}} \,.
+\end{equation}
+Here $x_i$ is the count of species $i$, and ${N \choose n}$ is the
binomial coefficient, or the number of ways we can choose $n$ from
$N$, and $q_i$ give the probabilities that species $i$ does \emph{not} occur in a
-sample of size $n$. This is defined only when $N-x_i > n$, but for
+sample of size $n$. This is positive only when $N-x_i \ge n$, but for
other cases $q_i = 0$ or the species is sure to occur in the sample.
The variance of rarefied richness is \citep{HeckEtal75}:
\begin{multline}
\label{eq:rarevar}
-s^2 = q_i (1-q_i) \\ + 2 \sum_{i=1}^S \sum_{j>i} \left[ {N- x_i - x_j
- \choose n} \Bigm / {N
- \choose n} - q_i q_j\right]
+s^2 = q_i (1-q_i) \\ + 2 \sum_{i=1}^S \sum_{j>i} \left[ \frac{{N- x_i - x_j
+ \choose n}}{ {N
+ \choose n}} - q_i q_j\right] \,.
\end{multline}
-Equation \ref{eq:rarevar} actually is of the same form as the variance
+Equation~\ref{eq:rarevar} actually is of the same form as the variance
of sum of correlated variables:
\begin{equation}
\VAR \left(\sum x_i \right) = \sum \VAR (x_i) + 2 \sum_{i=1}^S
-\sum_{j>i} \COV (x_i, x_j)
+\sum_{j>i} \COV (x_i, x_j) \,.
\end{equation}
The number of stems per hectare varies in our
@@ -215,7 +215,8 @@ The two basic indices are called taxonomic diversity $\Delta$ and
taxonomic distinctness $\Delta^*$ \citep{ClarkeWarwick98}:
\begin{align}
\Delta &= \frac{\sum \sum_{i<j} \omega_{ij} x_i x_j}{n (n-1) / 2}\\
-\Delta^* &= \frac{\sum \sum_{i<j} \omega_{ij} x_i x_j}{\sum \sum_{i<j} x_i x_j}
+\Delta^* &= \frac{\sum \sum_{i<j} \omega_{ij} x_i x_j}{\sum \sum_{i<j}
+ x_i x_j} \,.
\end{align}
These equations give the index values for a single site, and summation
goes over species $i$ and $j$, and $\omega$ are the taxonomic
@@ -230,7 +231,8 @@ richness\footnote{This text normally uses upper case letter $S$ for
to give $s \Delta^+$, or it can be used to estimate an index of
variation in taxonomic distinctness $\Lambda^+$ \citep{ClarkeWarwick01}:
\begin{equation}
- \Lambda^+ = \frac{\sum \sum_{i<j} \omega_{ij}^2}{n (n-1) / 2} - (\Delta^+)^2
+ \Lambda^+ = \frac{\sum \sum_{i<j} \omega_{ij}^2}{n (n-1) / 2} -
+ (\Delta^+)^2 \,.
\end{equation}
We still need the taxonomic differences among species ($\omega$) to
@@ -254,7 +256,7 @@ data in \pkg{vegan}\footnote{Actually I made such a classification,
but taxonomic differences proved to be of little use in the Barro
Colorado data: they only singled out sites with Monocots (palm
trees) in the data.}
-but there is such a table for the Dune meadow data (Fig. \ref{fig:taxondive}):
+but there is such a table for the Dune meadow data (Fig.~\ref{fig:taxondive}):
<<>>=
data(dune)
data(dune.taxon)
@@ -307,12 +309,12 @@ several models for species abundance distribution.
In Fisher's log-series, the expected number of species $\hat f$ with $n$
individuals is \citep{FisherEtal43}:
\begin{equation}
-\hat f_n = \frac{\alpha x^n}{n}
+\hat f_n = \frac{\alpha x^n}{n} \,,
\end{equation}
where $\alpha$ is the diversity parameter, and $x$ is a nuisance
parameter defined by $\alpha$ and total number
of individuals $N$ in the site, $x = N/(N-\alpha)$. Fisher's
-log-series for a randomly selected plot is (Fig. \ref{fig:fisher}):
+log-series for a randomly selected plot is (Fig.~\ref{fig:fisher}):
<<>>=
k <- sample(nrow(BCI), 1)
fish <- fisherfit(BCI[k,])
@@ -369,7 +371,7 @@ estimation:
\hat a_r &= N \hat p_1 r^\gamma &\text{Zipf}\\
\hat a_r &= N c (r + \beta)^\gamma &\text{Zipf--Mandelbrot}
\end{align}
-Where $\hat a_r$ is the expected abundance of species at rank $r$, $S$
+In all these, $\hat a_r$ is the expected abundance of species at rank $r$, $S$
is the number of species, $N$ is the number of individuals, $\Phi$ is
a standard normal function, $\hat p_1$ is the estimated proportion of
the most abundant species, and $\alpha$, $\mu$, $\sigma$, $\gamma$,
@@ -379,7 +381,7 @@ It is customary to define the models for proportions $p_r$ instead of
abundances $a_r$, but there is no reason for this, and \code{radfit}
is able to work with the original abundance data. We have count data,
and the default Poisson error looks appropriate, and our example data
-set gives (Fig. \ref{fig:rad}):
+set gives (Fig.~\ref{fig:rad}):
<<>>=
rad <- radfit(BCI[k,])
rad
@@ -426,30 +428,31 @@ to these individuals. Kindt's exact accumulator resembles rarefaction
\citep{UglandEtal03}:
\begin{multline}
\label{eq:kindt}
-\hat S_n = \sum_{i=1}^S (1 - p_i), \, \\ \text{where} \quad p_i = {N- f_i
-\choose n} \Bigm / {N \choose n}
+\hat S_n = \sum_{i=1}^S (1 - p_i), \,\quad \text{where }
+p_i = \frac{{N- f_i \choose n}}{{N \choose n}} \,,
\end{multline}
-where $f_i$ is the frequency of species $i$. Approximate variance
+and $f_i$ is the frequency of species $i$. Approximate variance
estimator is:
\begin{multline}
\label{eq:kindtvar}
s^2 = p_i (1 - p_i) \\ + 2 \sum_{i=1}^S \sum_{j>i} \left( r_{ij}
- \sqrt{p_i(1-p_i)} \sqrt{p_j (1-p_j)}\right)
+ \sqrt{p_i(1-p_i)} \sqrt{p_j (1-p_j)}\right) \,,
\end{multline}
where $r_{ij}$ is the correlation coefficient between species $i$ and
-$j$. Both of these are unpublished: eq. \ref{eq:kindt} was developed
-by Roeland Kindt, and eq. \ref{eq:kindtvar} by Jari Oksanen. The third
+$j$. Both of these are unpublished: eq.~\ref{eq:kindt} was developed
+by Roeland Kindt, and eq.~\ref{eq:kindtvar} by Jari Oksanen. The third
analytic method was suggested by \citet{Coleman82}:
\begin{equation}
\label{eq:cole}
-S_n = \sum_{i=1}^S (1 - p_i), \, \text{where} \quad p_i = \left(1 - \frac{1}{n}\right)^{f_i}
+S_n = \sum_{i=1}^S (1 - p_i), \quad \text{where } p_i = \left(1 -
+ \frac{1}{n}\right)^{f_i} \,,
\end{equation}
-and he suggested variance $s^2 = p_i (1-p_i)$ which ignores the
-covariance component. In addition, eq. \ref{eq:cole} does not
+and the suggested variance is $s^2 = p_i (1-p_i)$ which ignores the
+covariance component. In addition, eq.~\ref{eq:cole} does not
properly handle sampling without replacement and underestimates the
species accumulation curve.
-The recommended is Kindt's exact method (Fig. \ref{fig:sac}):
+The recommended is Kindt's exact method (Fig.~\ref{fig:sac}):
<<a>>=
sac <- specaccum(BCI)
plot(sac, ci.type="polygon", ci.col="yellow")
@@ -478,7 +481,7 @@ number of species in a collection of sites $S$ and the average
richness per one site $\bar \alpha$ \citep{Tuomisto10a}:
\begin{equation}
\label{eq:beta}
- \beta = S/\bar \alpha - 1
+ \beta = S/\bar \alpha - 1 \,.
\end{equation}
Subtraction of one means that $\beta = 0$ when there are no excess
species or no heterogeneity between sites. For this index, no specific
@@ -488,16 +491,16 @@ of \pkg{vegan} function \code{specnumber}:
ncol(BCI)/mean(specnumber(BCI)) - 1
@
-The index of eq. \ref{eq:beta} is problematic because $S$ increases
+The index of eq.~\ref{eq:beta} is problematic because $S$ increases
with the number of sites even when sites are all subsets of the same
community. \citet{Whittaker60} noticed this, and suggested the index
to be found from pairwise comparison of sites. If the number of shared
species in two sites is $a$, and the numbers of species unique to each
site are $b$ and $c$, then $\bar \alpha = (2a + b + c)/2$ and $S =
-a+b+c$, and index \ref{eq:beta} can be expressed as:
+a+b+c$, and index~\ref{eq:beta} can be expressed as:
\begin{equation}
\label{eq:betabray}
- \beta = \frac{a+b+c}{(2a+b+c)/2} - 1 = \frac{b+c}{2a+b+c}
+ \beta = \frac{a+b+c}{(2a+b+c)/2} - 1 = \frac{b+c}{2a+b+c} \,.
\end{equation}
This is the S{\o}rensen index of dissimilarity, and it can be found
for all sites using \pkg{vegan} function \code{vegdist} with
@@ -508,7 +511,7 @@ mean(beta)
@
There are many other definitions of beta diversity in addition to
-eq. \ref{eq:beta}. All commonly used indices can be found using
+eq.~\ref{eq:beta}. All commonly used indices can be found using
\code{betadiver} \citep{KoleffEtal03}. The indices in \code{betadiver}
can be referred to by subscript name, or index number:
<<>>=
@@ -520,7 +523,7 @@ One of the more interesting indices is based
on the Arrhenius species--area model
\begin{equation}
\label{eq:arrhenius}
- \hat S = c X^z
+ \hat S = c X^z\,,
\end{equation}
where $X$ is the area (size) of the patch or site, and $c$ and $z$ are
parameters. Parameter $c$ is uninteresting, but $z$ gives the
@@ -541,7 +544,7 @@ Function \code{betadisper} can be used to analyse beta diversities
with respect to classes or factors \citep{Anderson06, AndersonEtal06}.
There is no such classification available for the Barro Colorado
Island data, and the example studies beta diversities in the
-management classes of the dune meadows (Fig. \ref{fig:betadisper}):
+management classes of the dune meadows (Fig.~\ref{fig:betadisper}):
<<>>=
data(dune)
data(dune.env)
@@ -572,68 +575,94 @@ with a single site. Both functions assume that the number of unseen
species is related to the number of rare species, or species seen only
once or twice.
+The incidence-based functions group species by their number of
+occurrences $f_i = f_0, f_1, \ldots, f_N$, where $f$ is the number of
+species occuring in exactly $i$ sites in the data: $f_N$ is the number
+of species occurring on every $N$ site, $f_1$ the number of species
+occurring once, and $f_0$ the number of species in the species pool
+but not found in the sample. The total number of species in the pool
+$S_p$ is
+\begin{equation}
+S_p = \sum_{i=0}^N f_i = f_0+ S_o \,,
+\end{equation}
+where $S_o = \sum_{i>0} f_i$ is the observed number of species. The
+sampling proportion $i/N$ is an estimate for the commonness of the
+species in the community. When species is present in the community but
+not in the sample, $i=0$ is an obvious under-estimate, and
+consequently, for values $i>0$ the species commonness is
+over-estimated \citep{Good53}. The models for the pool size estimate
+the number of species missing in the sample $f_0$.
+
Function \code{specpool} implements the following models to estimate
-the pool size $S_p$ \citep{SmithVanBelle84, Chao87, ChiuEtal14}:
-\begin{align}
-\label{eq:chao-basic}
-S_p &= S_o + \frac{f_1^2}{2 f_2} \frac{N-1}{N} & \text{Chao}\\
-\label{eq:chao-bc}
-S_p &= S_o + \frac{f_1 (f_1 -1)}{2 (f_2+1)} \frac{N-1}{N} & \text{Chao bias-corrected}\\
-S_p &= S_o + f_1 \frac{N-1}{N} & \text{1st order Jackknife}\\
-S_p & = S_o + f_1 \frac{2N-3}{N} \nonumber \\ & + f_2 \frac{(N-2)^2}{N(N-1)}
-& \text{2nd order Jackknife}\\
-S_p &= S_o + \sum_{i=1}^{S_o} (1-p_i)^N & \text{Bootstrap}
-\end{align}
-Here $S_o$ is the observed number of species, $f_1$ and $f_2$ are the
-numbers of species observed once or twice, $N$ is the number of sites,
-and $p_i$ are proportions of species. The idea in jackknife seems to
-be that we missed about as many species as we saw only once, and the
-idea in bootstrap that if we repeat sampling (with replacement) from
-the same data, we miss as many species as we missed originally.
-\citet{ChiuEtal14} introduced the small-sample correction term
+the number of missing species $f_0$. Chao estimator is \citep{Chao87, ChiuEtal14}:
+\begin{equation}
+\label{eq:chao}
+\hat f_0 = \begin{cases}
+ \frac{f_1^2}{2 f_2} \frac{N-1}{N} &\text{if } f_2 > 0 \\
+\frac{f_1 (f_1 -1)}{2} \frac{N-1}{N} & \text{if } f_2 = 0 \,.
+\end{cases}
+\end{equation}
+The latter case for $f_2=0$ is known as the bias-corrected
+form. \citet{ChiuEtal14} introduced the small-sample correction term
$\frac{N}{N-1}$, but it was not originally used \citep{Chao87}.
-The variance the estimator of the basic Chao estimate is \citep{ChiuEtal14}:
+The first and second order jackknife estimators are
+\citep{SmithVanBelle84}:
+\begin{align}
+\hat f_0 &= f_1 \frac{N-1}{N} \\
+\hat f_0 & = f_1 \frac{2N-3}{N} + f_2 \frac{(N-2)^2}{N(N-1)} \,.
+\end{align}
+The boostrap estimator is \citep{SmithVanBelle84}:
+\begin{equation}
+\hat f_0 = \sum_{i=1}^{S_o} (1-p_i)^N \,.
+\end{equation}
+The idea in jackknife seems to be that we missed about as many species
+as we saw only once, and the idea in bootstrap that if we repeat
+sampling (with replacement) from the same data, we miss as many
+species as we missed originally.
+
+The variance estimaters only concern the estimated number of missing
+species $\hat f_0$, although they are often expressed as they would
+apply to the pool size $S_p$; this is only true if we assume that
+$\VAR(S_o) = 0$. The variance of the Chao estimate is \citep{ChiuEtal14}:
\begin{multline}
\label{eq:var-chao-basic}
-s^2 = f_2 \left(A^2 \frac{G^4}{4} + A^2 G^3 + A \frac{G^2}{2} \right),\\
-\text{where}\; A = \frac{N-1}{N}\;\text{and}\; G = \frac{f_1}{f_2}
-\end{multline}
-The variance of bias-corrected Chao estimate can be approximated by
-replacing the terms of eq.~\ref{eq:var-chao-basic} with the
-corresponding terms in eq.~\ref{eq:chao-bc}:
-\begin{multline}
-\label{eq:var-chao-bc}
-s^2 = A \frac{f_1(f_1-1)}{2(f_2+1)} + A^2 \frac{f_1(2 f_1+1)^2}{(f_2+1)^2}\\
- + A^2 \frac{f_1^2 f_2 (f_1 -1)^2}{4 (f_2 + 1)^4}
+\VAR(\hat f_0) = f_1 \left(A^2 \frac{G^3}{4} + A^2 G^2 + A \frac{G}{2} \right),\\
+\text{where } A = \frac{N-1}{N}\;\text{and } G = \frac{f_1}{f_2} \,.
\end{multline}
-If we apply the bias-correction in the special case where there are no
-doubletons ($f_2 = 0$), the he variance is
+%% The variance of bias-corrected Chao estimate can be approximated by
+%% replacing the terms of eq.~\ref{eq:var-chao-basic} with the
+%% corresponding terms of the bias-correcter form of in eq.~\ref{eq:chao}:
+%% \begin{multline}
+%% \label{eq:var-chao-bc}
+%% s^2 = A \frac{f_1(f_1-1)}{2} + A^2 \frac{f_1(2 f_1+1)^2}{(f_2+1)^2}\\
+%% + A^2 \frac{f_1^2 f_2 (f_1 -1)^2}{4 (f_2 + 1)^4}
+%% \end{multline}
+For the bias-corrected form of eq.~\ref{eq:chao} (case $f_2 = 0$), the variance is
\citep[who omit small-sample correction in some terms]{ChiuEtal14}:
\begin{multline}
\label{eq:var-chao-bc0}
-s^2 = \frac{1}{4} A^2 f_1 (2f_1 -1)^2 + \frac{1}{2} A f_1 (f_1-1) - \frac{1}{4}A^2 \frac{f_1^4}{S_p}
+\VAR(\hat f_0) = \tfrac{1}{4} A^2 f_1 (2f_1 -1)^2 + \tfrac{1}{2} A f_1
+(f_1-1) \\- \tfrac{1}{4}A^2 \frac{f_1^4}{S_p} \,.
\end{multline}
-Function \code{specpool} uses eq.~\ref{eq:chao-basic} and estimates
-its variance with eq.~\ref{eq:var-chao-basic} when $f_2 > 0$. When
-$f_2 = 0$, \code{specpool} applies eq.~\ref{eq:chao-bc} which reduces
-to $\frac{N-1}{N} \frac{1}{2} f_1 (f_1 - 1)$, and its variance
-estimator eq.~\ref{eq:var-chao-bc0}.
The variance of the first-order jackknife is based on the number of
``singletons'' $r$ (species occurring only once in the data) in sample
plots \citep{SmithVanBelle84}:
\begin{equation}
-s^2 = \left(\sum_{i=1}^N r_i^2 - \frac{f_1}{N}\right) \frac{N-1}{N}
+\VAR(\hat f_0) = \left(\sum_{i=1}^N r_i^2 - \frac{f_1}{N}\right)
+\frac{N-1}{N} \,.
\end{equation}
Variance of the second-order jackknife is not evaluated in
\code{specpool} (but contributions are welcome).
-For the variance of bootstrap estimator, it is practical to define a
-new variable $q_i = (1-p_i)^N$ for each species \citep{SmithVanBelle84}:
+
+The variance of bootstrap estimator is\citep{SmithVanBelle84}:
\begin{multline}
-s^2 = \sum_{i=1}^{S_o} q_i (1-q_i) \\ +2 \sum_{i \neq j}^{S_o} \left[(Z_{ij}/N)^N - q_i q_j \right]
+\VAR(\hat f_0) = \sum_{i=1}^{S_o} q_i (1-q_i) \\ +2 \sum_{i \neq
+ j}^{S_o} \left[(Z_{ij}/N)^N - q_i q_j \right] \\
+\text{where } q_i = (1-p_i)^N \, ,
\end{multline}
-where $Z_{ij}$ is the number of sites where both species are absent.
+and $Z_{ij}$ is the number of sites where both species are absent.
The extrapolated richness values for the whole BCI data are:
<<>>=
@@ -658,18 +687,46 @@ two of these methods:
<<>>=
estimateR(BCI[k,])
@
+In abundance based models $a_i$ denotes the number of species with $i$
+individuals, and takes the place of $f_i$ of previous models.
Chao's method is similar as the bias-corrected model
-eq.~\ref{eq:chao-bc} with its variance estimator
-eq.~\ref{eq:var-chao-bc}, but it uses counts of individuals instead of
-incidences, and does not use small sample correction. \textsc{ace} is
-based on rare species also:
+eq.~\ref{eq:chao} \citep{Chao87, ChiuEtal14}:
+\begin{equation}
+ \label{eq:chao-bc}
+ S_p = S_o + \frac{a_1 (a_1 - 1)}{2 (a_2 + 1)}\,.
+\end{equation}
+When $f_2=0$, eq.~\ref{eq:chao-bc} reduces to the bias-corrected form
+of eq.~\ref{eq:chao}, but quantitative estimators are based on
+abundances and do not use small-sample correction. This is not usually
+needed because sample sizes are total numbers of individuals, and
+these are usually high, unlike in frequency based models, where the
+sample size is the number of sites \citep{ChiuEtal14}.
+
+A commonly used approximate variance estimator of eq.~\ref{eq:chao-bc} is:
+\begin{multline}
+ \label{eq:var-chao-bc}
+ s^2 = \frac{a_1(a_1-1)}{2} + \frac{a_1(2 a_1+1)^2}{(a_2+1)^2}\\
+ + \frac{a_1^2 a_2 (a_1 -1)^2}{4 (a_2 + 1)^4} \,.
+\end{multline}
+However, \pkg{vegan} does not use this, but instead the following more
+exact form which was directly derived from eq.~\ref{eq:chao-bc}
+following \citet[web appendix]{ChiuEtal14}:
+\begin{multline}
+ s^2 = \frac{1}{4} \frac{1}{(a_2+1)^4 S_p} [a_1 (S_p a_1^3
+ a_2 + 4 S_p a_1^2 a_2^2 \\+ 2 S_p a_1 a_2^3 + 6 S_p a_1^2 a_2 + 2 S_p
+ a_1 a_2^2 -2 S_p a_2^3 \\+ 4 S_p a_1^2 + S_p a_1 a_2 -5 S_p a_2^2 - a_1^3 - 2
+ a_1^2 a_2\\ - a_1 a_2^2 - 2 S_p a_1 - 4 S_p a_2 - S_p ) ]\,.
+\end{multline}
+The variance estimators only concern the number of unseen species like previously.
+
+The \textsc{ace} is estimator is defined as \citep{OHara05}:
\begin{equation}
\begin{split}
S_p &= S_\mathrm{abund} + \frac{S_\mathrm{rare}}{C_\mathrm{ACE}} +
\frac{a_1}{C_\mathrm{ACE}} \gamma^2\, , \quad \text{where}\\
C_\mathrm{ACE} &= 1 - \frac{a_1}{N_\mathrm{rare}}\\
\gamma^2 &= \frac{S_\mathrm{rare}}{C_\mathrm{ACE}} \sum_{i=1}^{10} i
-(i-1) a_1 \frac{N_\mathrm{rare} - 1}{N_\mathrm{rare}}
+(i-1) a_1 \frac{N_\mathrm{rare} - 1}{N_\mathrm{rare}}\,.
\end{split}
\end{equation}
Now $a_1$ takes the place of $f_1$ above, and means the number of
@@ -677,7 +734,9 @@ species with only one individual.
Here $S_\mathrm{abund}$ and $S_\mathrm{rare}$ are the numbers of
species of abundant and rare species, with an arbitrary upper limit of
10 individuals for a rare species, and $N_\mathrm{rare}$ is the total
-number of individuals in rare species.
+number of individuals in rare species. The variance estimator uses
+iterative solution, and it is best interpreted from the source code or
+following \citet{OHara05}.
The pool size
is estimated separately for each site, but if input is a data frame,
@@ -687,7 +746,7 @@ If log-normal abundance model is appropriate, it can be used to
estimate the pool size. Log-normal model has a finite number of
species which can be found integrating the log-normal:
\begin{equation}
-S_p = S_\mu \sigma \sqrt{2 \pi}
+S_p = S_\mu \sigma \sqrt{2 \pi} \,,
\end{equation}
where $S_\mu$ is the modal height or the expected number of species at
maximum (at $\mu$), and $\sigma$ is the width. Function
@@ -717,12 +776,12 @@ smo <- beals(BCI)
We may see how the estimated probability of occurrence and observed
numbers of stems relate in one of the more familiar species. We study
only one species, and to avoid circular reasoning we do not include
-the target species in the smoothing (Fig. \ref{fig:beals}):
+the target species in the smoothing (Fig.~\ref{fig:beals}):
<<a>>=
j <- which(colnames(BCI) == "Ceiba.pentandra")
plot(beals(BCI, species=j, include=FALSE), BCI[,j],
- main="Ceiba pentandra", xlab="Probability of occurrence",
- ylab="Occurrence")
+ ylab="Occurrence", main="Ceiba pentandra",
+ xlab="Probability of occurrence")
@
\begin{figure}
<<fig=true,echo=false>>=
diff --git a/inst/doc/diversity-vegan.pdf b/inst/doc/diversity-vegan.pdf
index 14a1d29..7ecde2f 100644
Binary files a/inst/doc/diversity-vegan.pdf and b/inst/doc/diversity-vegan.pdf differ
diff --git a/inst/doc/intro-vegan.pdf b/inst/doc/intro-vegan.pdf
index 9cedf1c..d5af1d6 100644
Binary files a/inst/doc/intro-vegan.pdf and b/inst/doc/intro-vegan.pdf differ
diff --git a/man/betadisper.Rd b/man/betadisper.Rd
index 2c02b13..4d83afb 100644
--- a/man/betadisper.Rd
+++ b/man/betadisper.Rd
@@ -47,11 +47,11 @@ betadisper(d, group, type = c("median","centroid"), bias.adjust = FALSE)
\arguments{
\item{d}{a distance structure such as that returned by
- \code{\link[stats]{dist}}, \code{\link{betadiver}} or
+ \code{\link[stats]{dist}}, \code{\link{betadiver}} or
\code{\link{vegdist}}.}
\item{group}{vector describing the group structure, usually a factor
or an object that can be coerced to a factor using
- \code{\link[base]{as.factor}}. Can consist of a factor with a single
+ \code{\link{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.}
@@ -161,7 +161,7 @@ betadisper(d, group, type = c("median","centroid"), bias.adjust = FALSE)
functions in the \code{\link{ordiplot}} family.
The \code{boxplot} function invisibly returns a list whose components
- are documented in \code{\link[graphics]{boxplot}}.
+ are documented in \code{\link{boxplot}}.
\code{eigenvals.betadisper} returns a named vector of eigenvalues.
@@ -217,7 +217,7 @@ betadisper(d, group, type = c("median","centroid"), bias.adjust = FALSE)
}
\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{scores}}, \code{\link{boxplot}},
\code{\link{TukeyHSD}}. Further measure of beta diversity
can be found in \code{\link{betadiver}}.}
\examples{
diff --git a/man/isomap.Rd b/man/isomap.Rd
index 3bcd71c..5f1f72b 100644
--- a/man/isomap.Rd
+++ b/man/isomap.Rd
@@ -60,8 +60,8 @@ isomapdist(dist, epsilon, k, path = "shortest", fragmentedOK =FALSE, ...)
\code{\link{stepacross}}).
De'ath (1999) actually published essentially the same method before
- Tenenbaum et al. (2000), and De'ath's function is available in
- \code{\link[mvpart]{xdiss}} in package \pkg{mvpart}. The differences are that
+ Tenenbaum et al. (2000), and De'ath's function is available in function
+ \code{xdiss} in non-CRAN package \pkg{mvpart}. The differences are that
\code{isomap} introduced the \code{k} criterion, whereas De'ath only
used \code{epsilon} criterion. In practice, De'ath also retains
higher proportion of dissimilarities than typical \code{isomap}.
@@ -100,14 +100,15 @@ isomapdist(dist, epsilon, k, path = "shortest", fragmentedOK =FALSE, ...)
folds. If data do not have such a manifold structure, the results are
very sensitive to parameter values.
}
+
\seealso{The underlying functions that do the proper work are
- \code{\link{stepacross}}, \code{\link{distconnected}} and \code{\link{cmdscale}}.
- Package \pkg{mvpart} provides a parallel (but a bit different) implementation
- (\code{\link[mvpart]{xdiss}}). Moreover, \pkg{vegan} function
- \code{\link{metaMDS}} may trigger \code{\link{stepacross}}
- transformation, but usually only for longest dissimilarities. The
- \code{plot} method of \pkg{vegan} minimum spanning tree function
- (\code{\link{spantree}}) has even more extreme way of isomapping things. }
+ \code{\link{stepacross}}, \code{\link{distconnected}} and
+ \code{\link{cmdscale}}. Function \code{\link{metaMDS}} may trigger
+ \code{\link{stepacross}} transformation, but usually only for
+ longest dissimilarities. The \code{plot} method of \pkg{vegan}
+ minimum spanning tree function (\code{\link{spantree}}) has even
+ more extreme way of isomapping things. }
+
\examples{
## The following examples also overlay minimum spanning tree to
## the graphics in red.
diff --git a/man/kendall.global.Rd b/man/kendall.global.Rd
index 1d2d470..d3d5286 100644
--- a/man/kendall.global.Rd
+++ b/man/kendall.global.Rd
@@ -146,7 +146,7 @@ the behavioral sciences. 2nd edition. McGraw-Hill, New York.
\seealso{\code{\link{cor}}, \code{\link{friedman.test}},
\code{\link{hclust}}, \code{\link{cutree}}, \code{\link{kmeans}},
-\code{\link[vegan]{cascadeKM}}, \code{\link[labdsv]{indval}}}
+\code{\link{cascadeKM}}, \code{\link[labdsv]{indval}}}
\author{ F. Guillaume Blanchet, University of Alberta, and Pierre
Legendre, Université de Montréal }
diff --git a/man/linestack.Rd b/man/linestack.Rd
index 7aa6c1b..a6e992f 100644
--- a/man/linestack.Rd
+++ b/man/linestack.Rd
@@ -9,18 +9,20 @@
}
\usage{
linestack(x, labels, cex = 0.8, side = "right", hoff = 2, air = 1.1,
- at = 0, add = FALSE, axis = FALSE, ...)
+ at = 0, add = FALSE, axis = FALSE, ...)
}
\arguments{
\item{x}{Numeric vector to be plotted. }
- \item{labels}{Text labels used instead of default (names of \code{x}).}
+ \item{labels}{Labels used instead of default (names of \code{x}). May
+ be expressions to be drawn with \code{\link{plotmath}}.}
\item{cex}{Size of the labels. }
- \item{side}{Put labels to the \code{"right"} or
- \code{"left"} of the axis. }
+ \item{side}{Put labels to the \code{"right"} or \code{"left"} of the
+ axis.}
\item{hoff}{Distance from the vertical axis to the label in units of
the width of letter \dQuote{m}. }
- \item{air}{Multiplier to string height to leave empty space between labels. }
+ \item{air}{Multiplier to string height to leave empty space between
+ labels.}
\item{at}{Position of plot in horizontal axis. }
\item{add}{Add to an existing plot. }
\item{axis}{Add axis to the plot. }
@@ -30,7 +32,7 @@ linestack(x, labels, cex = 0.8, side = "right", hoff = 2, air = 1.1,
The function returns invisibly the shifted positions of labels in
user coordinates.
}
-\author{Jari Oksanen }
+\author{Jari Oksanen with modifications by Gavin L. Simpson}
\note{ The function always draws labelled diagrams. If you want to have
unlabelled diagrams, you can use, e.g., \code{\link{plot}},
\code{\link{stripchart}} or \code{\link{rug}}.
@@ -43,6 +45,23 @@ ord <- decorana(dune)
linestack(scores(ord, choices=1, display="sp"))
linestack(scores(ord, choices=1, display="si"), side="left", add=TRUE)
title(main="DCA axis 1")
+
+## Expressions as labels
+N <- 10 # Number of sites
+df <- data.frame(Ca = rlnorm(N, 2), NO3 = rlnorm(N, 4),
+ SO4 = rlnorm(N, 10), K = rlnorm(N, 3))
+ord <- rda(df, scale = TRUE)
+### vector of expressions for labels
+labs <- expression(Ca^{2+phantom()},
+ NO[3]^{-phantom()},
+ SO[4]^{-2},
+ K^{+phantom()})
+scl <- 1
+linestack(scores(ord, choices = 1, display = "species", scaling = scl),
+ labels = labs, air = 2)
+linestack(scores(ord, choices = 1, display = "site", scaling = scl),
+ side = "left", add = TRUE)
+title(main = "PCA axis 1")
}
\keyword{ hplot }
\keyword{ aplot }
diff --git a/man/monoMDS.Rd b/man/monoMDS.Rd
index dd6a953..0696aa2 100644
--- a/man/monoMDS.Rd
+++ b/man/monoMDS.Rd
@@ -185,7 +185,7 @@ Peter R. Michin (Fortran core) and Jari Oksanen (R interface).
(1987).
}
-\seealso{ \code{\link[vegan]{metaMDS}} for the \pkg{vegan} way of
+\seealso{ \code{\link{metaMDS}} for the \pkg{vegan} way of
running NMDS, and \code{\link[MASS]{isoMDS}} and
\code{\link[smacof]{smacofSym}} for some alternative implementations
of NMDS. }
diff --git a/man/pcnm.Rd b/man/pcnm.Rd
index 682ada0..9f20618 100644
--- a/man/pcnm.Rd
+++ b/man/pcnm.Rd
@@ -88,7 +88,7 @@ pcnm(dis, threshold, w, dist.ret = FALSE)
}
\author{Jari Oksanen, based on the code of Stephane Dray.}
-\seealso{ \code{\link[vegan]{spantree}}. }
+\seealso{ \code{\link{spantree}}. }
\examples{
## Example from Borcard & Legendre (2002)
data(mite.xy)
diff --git a/man/renyi.Rd b/man/renyi.Rd
index 25c60f0..928d6bf 100644
--- a/man/renyi.Rd
+++ b/man/renyi.Rd
@@ -28,8 +28,10 @@ renyiaccum(x, scales = c(0, 0.5, 1, 2, 4, Inf), permutations = 100,
\item{x}{Community data matrix or plotting object. }
\item{scales}{Scales of \enc{Rényi}{Renyi} diversity.}
\item{hill}{Calculate Hill numbers.}
- \item{permutations}{Number of random permutations in accumulating
- sites.}
+ \item{permutations}{Usually an integer giving the number
+ permutations, but can also be a list of control values for the
+ permutations as returned by the function \code{\link[permute]{how}},
+ or a permutation matrix where each row gives the permuted indices.}
\item{raw}{if \code{FALSE} then return summary statistics of
permutations, and if \code{TRUE} then returns the individual
permutations.}
diff --git a/man/specaccum.Rd b/man/specaccum.Rd
index e4cabfb..55c5309 100644
--- a/man/specaccum.Rd
+++ b/man/specaccum.Rd
@@ -42,7 +42,12 @@ fitspecaccum(object, model, method = "random", ...)
expected richness following
Coleman et al. 1982, and \code{"rarefaction"} finds the mean when
accumulating individuals instead of sites. }
- \item{permutations}{Number of permutations with \code{method = "random"}.}
+ \item{permutations}{Number of permutations with \code{method = "random"}.
+ Usually an integer giving the number permutations, but can also be a
+ list of control values for the permutations as returned by the
+ function \code{\link[permute]{how}}, or a permutation matrix where
+ each row gives the permuted indices.
+ }
\item{conditioned}{ Estimation of standard deviation is conditional on
the empirical dataset for the exact SAC}
\item{gamma}{Method for estimating the total extrapolated number of species in the
diff --git a/man/specpool.Rd b/man/specpool.Rd
index ee7251a..ce78039 100644
--- a/man/specpool.Rd
+++ b/man/specpool.Rd
@@ -23,7 +23,7 @@ specpool(x, pool, smallsample = TRUE)
estimateR(x, ...)
specpool2vect(X, index = c("jack1","jack2", "chao", "boot","Species"))
poolaccum(x, permutations = 100, minsize = 3)
-estaccumR(x, permutations = 100)
+estaccumR(x, permutations = 100, parallel = getOption("mc.cores"))
\method{summary}{poolaccum}(object, display, alpha = 0.05, ...)
\method{plot}{poolaccum}(x, alpha = 0.05, type = c("l","g"), ...)
}
@@ -37,8 +37,15 @@ estaccumR(x, permutations = 100)
\eqn{N} is the number of sites within the \code{pool}.}
\item{X, object}{A \code{specpool} result object.}
\item{index}{The selected index of extrapolated richness.}
- \item{permutations}{Number of permutations of sampling order of sites.}
+ \item{permutations}{Usually an integer giving the number
+ permutations, but can also be a list of control values for the
+ permutations as returned by the function \code{\link[permute]{how}},
+ or a permutation matrix where each row gives the permuted indices.}
\item{minsize}{Smallest number of sampling units reported.}
+ \item{parallel}{Number of parallel processes or a predefined socket
+ cluster. With \code{parallel = 1} uses ordinary, non-parallel
+ processing. The parallel processing is done with \pkg{parallel}
+ package.}
\item{display}{Indices to be displayed.}
\item{alpha}{Level of quantiles shown. This proportion will be left outside
symmetric limits.}
diff --git a/man/tsallis.Rd b/man/tsallis.Rd
index 1a27da6..455923e 100644
--- a/man/tsallis.Rd
+++ b/man/tsallis.Rd
@@ -22,9 +22,11 @@ tsallisaccum(x, scales = seq(0, 2, 0.2), permutations = 100,
by their maximum (diversity value at equiprobability conditions).}
\item{hill}{Calculate Hill numbers.}
-
- \item{permutations}{Number of random permutations in accumulating
- sites.}
+
+ \item{permutations}{Usually an integer giving the number
+ permutations, but can also be a list of control values for the
+ permutations as returned by the function \code{\link[permute]{how}},
+ or a permutation matrix where each row gives the permuted indices.}
\item{raw}{If \code{FALSE} then return summary statistics of
permutations, and if TRUE then returns the individual
diff --git a/man/vegandocs.Rd b/man/vegandocs.Rd
index c7216a4..f36e708 100644
--- a/man/vegandocs.Rd
+++ b/man/vegandocs.Rd
@@ -7,7 +7,7 @@
ChangeLog in \pkg{vegan}, or vignettes in \pkg{permute}. }
\usage{
-vegandocs(doc = c("NEWS", "ONEWS", "ChangeLog", "FAQ-vegan.pdf",
+vegandocs(doc = c("NEWS", "ONEWS", "FAQ-vegan.pdf",
"intro-vegan.pdf", "diversity-vegan.pdf", "decision-vegan.pdf",
"partitioning.pdf", "permutations.pdf"))
}
@@ -28,9 +28,6 @@ vegandocs(doc = c("NEWS", "ONEWS", "ChangeLog", "FAQ-vegan.pdf",
\item \code{ONEWS}: old news about \pkg{vegan} version \code{1.*}
before September 2011.
- \item \code{ChangeLog}: similar to news, but intended for
- developers wit more fine grained comments on internal changes.
-
\item \code{FAQ-vegan}: Frequently Asked Questions. Consult here
before writing to Mail groups.
diff --git a/vignettes/FAQ-vegan.pdf b/vignettes/FAQ-vegan.pdf
index 0379210..d43090e 100644
Binary files a/vignettes/FAQ-vegan.pdf and b/vignettes/FAQ-vegan.pdf differ
diff --git a/vignettes/NEWS.html b/vignettes/NEWS.html
index b61ebb8..c01b47f 100644
--- a/vignettes/NEWS.html
+++ b/vignettes/NEWS.html
@@ -7,6 +7,88 @@
<h2>vegan News</h2>
+<h3>Changes in version 2.2-1</h3>
+
+
+
+<h4>GENERAL</h4>
+
+
+<ul>
+<li><p> This is a maintenance release to avoid warning messages
+caused by changes in CRAN repository. The namespace usage is also
+more stringent to avoid warnings and notes in development versions
+of <span style="font-family: Courier New, Courier; color: #666666;"><b>R</b></span>.
+</p>
+</li></ul>
+
+
+
+
+<h4>INSTALLATION</h4>
+
+
+<ul>
+<li> <p><span class="pkg">vegan</span> can be installed and loaded without <span class="pkg">tcltk</span>
+package. The <span class="pkg">tcltk</span> package is needed in <code>orditkplot</code>
+function for interactive editing of ordination graphics.
+</p>
+</li></ul>
+
+
+
+
+<h4>BUG FIXES</h4>
+
+
+<ul>
+<li> <p><code>ordisurf</code> failed if <span class="pkg">gam</span> package was loaded due
+to namespace issues: some support functions of <span class="pkg">gam</span> were used
+instead of <span class="pkg">mgcv</span> functions.
+</p>
+</li>
+<li> <p><code>tolerance</code> function failed for unconstrained
+correspondence analysis.
+</p>
+</li></ul>
+
+
+
+
+<h4>NEW FEATURES</h4>
+
+
+<ul>
+<li> <p><code>estimateR</code> uses a more exact variance formula for
+bias-corrected Chao estimate of extrapolated number of
+species. The new formula may be unpublished, but it was derived
+following the guidelines of Chiu, Wang, Walther & Chao,
+<em>Biometrics</em> 70, 671–682 (2014),
+<a href="http://onlinelibrary.wiley.com/doi/10.1111/biom.12200/suppinfo">online
+supplementary material</a>.
+</p>
+</li>
+<li><p> Diversity accumulation functions <code>specaccum</code>,
+<code>renyiaccum</code>, <code>tsallisaccum</code>, <code>poolaccum</code> and
+<code>estaccumR</code> use now <span class="pkg">permute</span> package for permutations
+of the order of sampling sites. Normally these functions only
+need simple random permutation of sites, but restricted
+permutation of the <span class="pkg">permute</span> package and user-supplied
+permutation matrices can be used.
+</p>
+</li>
+<li> <p><code>estaccumR</code> function can use parallel processing.
+</p>
+</li>
+<li> <p><code>linestack</code> accepts now expressions as labels. This
+allows using mathematical symbols and formula given as
+mathematical expressions.
+</p>
+</li></ul>
+
+
+
+
<h3>Changes in version 2.2-0</h3>
diff --git a/vignettes/decision-vegan.tex b/vignettes/decision-vegan.tex
index b46fb64..b5ff272 100644
--- a/vignettes/decision-vegan.tex
+++ b/vignettes/decision-vegan.tex
@@ -9,8 +9,8 @@
\date{\footnotesize{
processed with vegan
-2.2-0
-in R Under development (unstable) (2014-11-16 r66991) on \today}}
+2.2-1
+in R Under development (unstable) (2015-01-12 r67426) on \today}}
%% need no \usepackage{Sweave}
\begin{document}
@@ -702,19 +702,19 @@ Call: cca(formula = varespec[i, ] ~ Al + K, data
Inertia Proportion Rank
Total 2.0832 1.0000
-Constrained 0.2023 0.0971 2
-Unconstrained 1.8809 0.9029 21
+Constrained 0.1910 0.0917 2
+Unconstrained 1.8922 0.9083 21
Inertia is mean squared contingency coefficient
Eigenvalues for constrained axes:
CCA1 CCA2
-0.17450 0.02779
+0.13160 0.05938
Eigenvalues for unconstrained axes:
CA1 CA2 CA3 CA4 CA5 CA6 CA7
-0.5192 0.3131 0.1957 0.1802 0.1562 0.1203 0.0894
+0.4532 0.3119 0.2221 0.1933 0.1722 0.1163 0.1070
CA8
-0.0799
+0.0869
(Showed only 8 of all 21 unconstrained eigenvalues)
\end{Soutput}
\end{Schunk}
@@ -742,11 +742,11 @@ remain within numerical accuracy:
> max(residuals(proc))
\end{Sinput}
\begin{Soutput}
-[1] 2.948264e-14
+[1] 2.895313e-14
\end{Soutput}
\end{Schunk}
In \code{cca} the difference would be somewhat larger than now
-observed 2.9483e-14 because site
+observed 2.8953e-14 because site
weights used for environmental variables are shuffled with the species
data.
diff --git a/vignettes/diversity-vegan.Rnw b/vignettes/diversity-vegan.Rnw
index 903a141..4ffc833 100644
--- a/vignettes/diversity-vegan.Rnw
+++ b/vignettes/diversity-vegan.Rnw
@@ -67,7 +67,7 @@ indices \citep{Hill73number}:
\begin{align}
H &= - \sum_{i=1}^S p_i \log_b p_i & \text{Shannon--Weaver}\\
D_1 &= 1 - \sum_{i=1}^S p_i^2 &\text{Simpson}\\
-D_2 &= \frac{1}{\sum_{i=1}^S p_i^2} &\text{inverse Simpson}
+D_2 &= \frac{1}{\sum_{i=1}^S p_i^2} &\text{inverse Simpson}\,,
\end{align}
where $p_i$ is the proportion of species $i$, and $S$ is the number of
species so that $\sum_{i=1}^S p_i = 1$, and $b$ is the base of the
@@ -92,9 +92,9 @@ the numbers of species.
\pkg{vegan} also can estimate series of R\'{e}nyi and Tsallis
diversities. R{\'e}nyi diversity of order $a$ is \citep{Hill73number}:
\begin{equation}
-H_a = \frac{1}{1-a} \log \sum_{i=1}^S p_i^a
+H_a = \frac{1}{1-a} \log \sum_{i=1}^S p_i^a \,,
\end{equation}
-or the corresponding Hill numbers $N_a = \exp(H_a)$. Many common
+and the corresponding Hill number is $N_a = \exp(H_a)$. Many common
diversity indices are special cases of Hill numbers: $N_0 = S$, $N_1 =
\exp(H')$, $N_2 = D_2$, and $N_\infty = 1/(\max p_i)$. The
corresponding R\'{e}nyi diversities are $H_0 = \log(S)$, $H_1 = H'$, $H_2 =
@@ -103,8 +103,8 @@ Tsallis diversity of order $q$ is \citep{Tothmeresz95}:
\begin{equation}
H_q = \frac{1}{q-1} \left(1 - \sum_{i=1}^S p^q \right) \, .
\end{equation}
-This corresponds to common diversity indices: $H_0 = S-1$, $H_1 = H'$,
-and $H_2 = D_2$, and can be converted to the Hill number:
+These correspond to common diversity indices: $H_0 = S-1$, $H_1 = H'$,
+and $H_2 = D_1$, and can be converted to Hill numbers:
\begin{equation}
N_q = (1 - (q-1) H_q )^\frac{1}{1-q} \, .
\end{equation}
@@ -117,7 +117,7 @@ R <- renyi(BCI[k,])
We can really regard a site more diverse if all of its R\'{e}nyi
diversities are higher than in another site. We can inspect this
graphically using the standard \code{plot} function for the
-\code{renyi} result (Fig. \ref{fig:renyi}).
+\code{renyi} result (Fig.~\ref{fig:renyi}).
\begin{figure}
<<fig=true,echo=false>>=
print(plot(R))
@@ -142,28 +142,28 @@ richness actually may be caused by differences in sample size. To
solve this problem, we may try to rarefy species richness to the same
number of individuals. Expected number of species in a community
rarefied from $N$ to $n$ individuals is \citep{Hurlbert71}:
-\begin{multline}
+\begin{equation}
\label{eq:rare}
-\hat S_n = \sum_{i=1}^S (1 - q_i),\\ \text{where} \quad q_i = {N-x_i
- \choose n} \Bigm /{N \choose n}
-\end{multline}
-where $x_i$ is the count of species $i$, and ${N \choose n}$ is the
+\hat S_n = \sum_{i=1}^S (1 - q_i)\,, \quad\text{where } q_i =
+\frac{{N-x_i \choose n}}{{N \choose n}} \,.
+\end{equation}
+Here $x_i$ is the count of species $i$, and ${N \choose n}$ is the
binomial coefficient, or the number of ways we can choose $n$ from
$N$, and $q_i$ give the probabilities that species $i$ does \emph{not} occur in a
-sample of size $n$. This is defined only when $N-x_i > n$, but for
+sample of size $n$. This is positive only when $N-x_i \ge n$, but for
other cases $q_i = 0$ or the species is sure to occur in the sample.
The variance of rarefied richness is \citep{HeckEtal75}:
\begin{multline}
\label{eq:rarevar}
-s^2 = q_i (1-q_i) \\ + 2 \sum_{i=1}^S \sum_{j>i} \left[ {N- x_i - x_j
- \choose n} \Bigm / {N
- \choose n} - q_i q_j\right]
+s^2 = q_i (1-q_i) \\ + 2 \sum_{i=1}^S \sum_{j>i} \left[ \frac{{N- x_i - x_j
+ \choose n}}{ {N
+ \choose n}} - q_i q_j\right] \,.
\end{multline}
-Equation \ref{eq:rarevar} actually is of the same form as the variance
+Equation~\ref{eq:rarevar} actually is of the same form as the variance
of sum of correlated variables:
\begin{equation}
\VAR \left(\sum x_i \right) = \sum \VAR (x_i) + 2 \sum_{i=1}^S
-\sum_{j>i} \COV (x_i, x_j)
+\sum_{j>i} \COV (x_i, x_j) \,.
\end{equation}
The number of stems per hectare varies in our
@@ -215,7 +215,8 @@ The two basic indices are called taxonomic diversity $\Delta$ and
taxonomic distinctness $\Delta^*$ \citep{ClarkeWarwick98}:
\begin{align}
\Delta &= \frac{\sum \sum_{i<j} \omega_{ij} x_i x_j}{n (n-1) / 2}\\
-\Delta^* &= \frac{\sum \sum_{i<j} \omega_{ij} x_i x_j}{\sum \sum_{i<j} x_i x_j}
+\Delta^* &= \frac{\sum \sum_{i<j} \omega_{ij} x_i x_j}{\sum \sum_{i<j}
+ x_i x_j} \,.
\end{align}
These equations give the index values for a single site, and summation
goes over species $i$ and $j$, and $\omega$ are the taxonomic
@@ -230,7 +231,8 @@ richness\footnote{This text normally uses upper case letter $S$ for
to give $s \Delta^+$, or it can be used to estimate an index of
variation in taxonomic distinctness $\Lambda^+$ \citep{ClarkeWarwick01}:
\begin{equation}
- \Lambda^+ = \frac{\sum \sum_{i<j} \omega_{ij}^2}{n (n-1) / 2} - (\Delta^+)^2
+ \Lambda^+ = \frac{\sum \sum_{i<j} \omega_{ij}^2}{n (n-1) / 2} -
+ (\Delta^+)^2 \,.
\end{equation}
We still need the taxonomic differences among species ($\omega$) to
@@ -254,7 +256,7 @@ data in \pkg{vegan}\footnote{Actually I made such a classification,
but taxonomic differences proved to be of little use in the Barro
Colorado data: they only singled out sites with Monocots (palm
trees) in the data.}
-but there is such a table for the Dune meadow data (Fig. \ref{fig:taxondive}):
+but there is such a table for the Dune meadow data (Fig.~\ref{fig:taxondive}):
<<>>=
data(dune)
data(dune.taxon)
@@ -307,12 +309,12 @@ several models for species abundance distribution.
In Fisher's log-series, the expected number of species $\hat f$ with $n$
individuals is \citep{FisherEtal43}:
\begin{equation}
-\hat f_n = \frac{\alpha x^n}{n}
+\hat f_n = \frac{\alpha x^n}{n} \,,
\end{equation}
where $\alpha$ is the diversity parameter, and $x$ is a nuisance
parameter defined by $\alpha$ and total number
of individuals $N$ in the site, $x = N/(N-\alpha)$. Fisher's
-log-series for a randomly selected plot is (Fig. \ref{fig:fisher}):
+log-series for a randomly selected plot is (Fig.~\ref{fig:fisher}):
<<>>=
k <- sample(nrow(BCI), 1)
fish <- fisherfit(BCI[k,])
@@ -369,7 +371,7 @@ estimation:
\hat a_r &= N \hat p_1 r^\gamma &\text{Zipf}\\
\hat a_r &= N c (r + \beta)^\gamma &\text{Zipf--Mandelbrot}
\end{align}
-Where $\hat a_r$ is the expected abundance of species at rank $r$, $S$
+In all these, $\hat a_r$ is the expected abundance of species at rank $r$, $S$
is the number of species, $N$ is the number of individuals, $\Phi$ is
a standard normal function, $\hat p_1$ is the estimated proportion of
the most abundant species, and $\alpha$, $\mu$, $\sigma$, $\gamma$,
@@ -379,7 +381,7 @@ It is customary to define the models for proportions $p_r$ instead of
abundances $a_r$, but there is no reason for this, and \code{radfit}
is able to work with the original abundance data. We have count data,
and the default Poisson error looks appropriate, and our example data
-set gives (Fig. \ref{fig:rad}):
+set gives (Fig.~\ref{fig:rad}):
<<>>=
rad <- radfit(BCI[k,])
rad
@@ -426,30 +428,31 @@ to these individuals. Kindt's exact accumulator resembles rarefaction
\citep{UglandEtal03}:
\begin{multline}
\label{eq:kindt}
-\hat S_n = \sum_{i=1}^S (1 - p_i), \, \\ \text{where} \quad p_i = {N- f_i
-\choose n} \Bigm / {N \choose n}
+\hat S_n = \sum_{i=1}^S (1 - p_i), \,\quad \text{where }
+p_i = \frac{{N- f_i \choose n}}{{N \choose n}} \,,
\end{multline}
-where $f_i$ is the frequency of species $i$. Approximate variance
+and $f_i$ is the frequency of species $i$. Approximate variance
estimator is:
\begin{multline}
\label{eq:kindtvar}
s^2 = p_i (1 - p_i) \\ + 2 \sum_{i=1}^S \sum_{j>i} \left( r_{ij}
- \sqrt{p_i(1-p_i)} \sqrt{p_j (1-p_j)}\right)
+ \sqrt{p_i(1-p_i)} \sqrt{p_j (1-p_j)}\right) \,,
\end{multline}
where $r_{ij}$ is the correlation coefficient between species $i$ and
-$j$. Both of these are unpublished: eq. \ref{eq:kindt} was developed
-by Roeland Kindt, and eq. \ref{eq:kindtvar} by Jari Oksanen. The third
+$j$. Both of these are unpublished: eq.~\ref{eq:kindt} was developed
+by Roeland Kindt, and eq.~\ref{eq:kindtvar} by Jari Oksanen. The third
analytic method was suggested by \citet{Coleman82}:
\begin{equation}
\label{eq:cole}
-S_n = \sum_{i=1}^S (1 - p_i), \, \text{where} \quad p_i = \left(1 - \frac{1}{n}\right)^{f_i}
+S_n = \sum_{i=1}^S (1 - p_i), \quad \text{where } p_i = \left(1 -
+ \frac{1}{n}\right)^{f_i} \,,
\end{equation}
-and he suggested variance $s^2 = p_i (1-p_i)$ which ignores the
-covariance component. In addition, eq. \ref{eq:cole} does not
+and the suggested variance is $s^2 = p_i (1-p_i)$ which ignores the
+covariance component. In addition, eq.~\ref{eq:cole} does not
properly handle sampling without replacement and underestimates the
species accumulation curve.
-The recommended is Kindt's exact method (Fig. \ref{fig:sac}):
+The recommended is Kindt's exact method (Fig.~\ref{fig:sac}):
<<a>>=
sac <- specaccum(BCI)
plot(sac, ci.type="polygon", ci.col="yellow")
@@ -478,7 +481,7 @@ number of species in a collection of sites $S$ and the average
richness per one site $\bar \alpha$ \citep{Tuomisto10a}:
\begin{equation}
\label{eq:beta}
- \beta = S/\bar \alpha - 1
+ \beta = S/\bar \alpha - 1 \,.
\end{equation}
Subtraction of one means that $\beta = 0$ when there are no excess
species or no heterogeneity between sites. For this index, no specific
@@ -488,16 +491,16 @@ of \pkg{vegan} function \code{specnumber}:
ncol(BCI)/mean(specnumber(BCI)) - 1
@
-The index of eq. \ref{eq:beta} is problematic because $S$ increases
+The index of eq.~\ref{eq:beta} is problematic because $S$ increases
with the number of sites even when sites are all subsets of the same
community. \citet{Whittaker60} noticed this, and suggested the index
to be found from pairwise comparison of sites. If the number of shared
species in two sites is $a$, and the numbers of species unique to each
site are $b$ and $c$, then $\bar \alpha = (2a + b + c)/2$ and $S =
-a+b+c$, and index \ref{eq:beta} can be expressed as:
+a+b+c$, and index~\ref{eq:beta} can be expressed as:
\begin{equation}
\label{eq:betabray}
- \beta = \frac{a+b+c}{(2a+b+c)/2} - 1 = \frac{b+c}{2a+b+c}
+ \beta = \frac{a+b+c}{(2a+b+c)/2} - 1 = \frac{b+c}{2a+b+c} \,.
\end{equation}
This is the S{\o}rensen index of dissimilarity, and it can be found
for all sites using \pkg{vegan} function \code{vegdist} with
@@ -508,7 +511,7 @@ mean(beta)
@
There are many other definitions of beta diversity in addition to
-eq. \ref{eq:beta}. All commonly used indices can be found using
+eq.~\ref{eq:beta}. All commonly used indices can be found using
\code{betadiver} \citep{KoleffEtal03}. The indices in \code{betadiver}
can be referred to by subscript name, or index number:
<<>>=
@@ -520,7 +523,7 @@ One of the more interesting indices is based
on the Arrhenius species--area model
\begin{equation}
\label{eq:arrhenius}
- \hat S = c X^z
+ \hat S = c X^z\,,
\end{equation}
where $X$ is the area (size) of the patch or site, and $c$ and $z$ are
parameters. Parameter $c$ is uninteresting, but $z$ gives the
@@ -541,7 +544,7 @@ Function \code{betadisper} can be used to analyse beta diversities
with respect to classes or factors \citep{Anderson06, AndersonEtal06}.
There is no such classification available for the Barro Colorado
Island data, and the example studies beta diversities in the
-management classes of the dune meadows (Fig. \ref{fig:betadisper}):
+management classes of the dune meadows (Fig.~\ref{fig:betadisper}):
<<>>=
data(dune)
data(dune.env)
@@ -572,68 +575,94 @@ with a single site. Both functions assume that the number of unseen
species is related to the number of rare species, or species seen only
once or twice.
+The incidence-based functions group species by their number of
+occurrences $f_i = f_0, f_1, \ldots, f_N$, where $f$ is the number of
+species occuring in exactly $i$ sites in the data: $f_N$ is the number
+of species occurring on every $N$ site, $f_1$ the number of species
+occurring once, and $f_0$ the number of species in the species pool
+but not found in the sample. The total number of species in the pool
+$S_p$ is
+\begin{equation}
+S_p = \sum_{i=0}^N f_i = f_0+ S_o \,,
+\end{equation}
+where $S_o = \sum_{i>0} f_i$ is the observed number of species. The
+sampling proportion $i/N$ is an estimate for the commonness of the
+species in the community. When species is present in the community but
+not in the sample, $i=0$ is an obvious under-estimate, and
+consequently, for values $i>0$ the species commonness is
+over-estimated \citep{Good53}. The models for the pool size estimate
+the number of species missing in the sample $f_0$.
+
Function \code{specpool} implements the following models to estimate
-the pool size $S_p$ \citep{SmithVanBelle84, Chao87, ChiuEtal14}:
-\begin{align}
-\label{eq:chao-basic}
-S_p &= S_o + \frac{f_1^2}{2 f_2} \frac{N-1}{N} & \text{Chao}\\
-\label{eq:chao-bc}
-S_p &= S_o + \frac{f_1 (f_1 -1)}{2 (f_2+1)} \frac{N-1}{N} & \text{Chao bias-corrected}\\
-S_p &= S_o + f_1 \frac{N-1}{N} & \text{1st order Jackknife}\\
-S_p & = S_o + f_1 \frac{2N-3}{N} \nonumber \\ & + f_2 \frac{(N-2)^2}{N(N-1)}
-& \text{2nd order Jackknife}\\
-S_p &= S_o + \sum_{i=1}^{S_o} (1-p_i)^N & \text{Bootstrap}
-\end{align}
-Here $S_o$ is the observed number of species, $f_1$ and $f_2$ are the
-numbers of species observed once or twice, $N$ is the number of sites,
-and $p_i$ are proportions of species. The idea in jackknife seems to
-be that we missed about as many species as we saw only once, and the
-idea in bootstrap that if we repeat sampling (with replacement) from
-the same data, we miss as many species as we missed originally.
-\citet{ChiuEtal14} introduced the small-sample correction term
+the number of missing species $f_0$. Chao estimator is \citep{Chao87, ChiuEtal14}:
+\begin{equation}
+\label{eq:chao}
+\hat f_0 = \begin{cases}
+ \frac{f_1^2}{2 f_2} \frac{N-1}{N} &\text{if } f_2 > 0 \\
+\frac{f_1 (f_1 -1)}{2} \frac{N-1}{N} & \text{if } f_2 = 0 \,.
+\end{cases}
+\end{equation}
+The latter case for $f_2=0$ is known as the bias-corrected
+form. \citet{ChiuEtal14} introduced the small-sample correction term
$\frac{N}{N-1}$, but it was not originally used \citep{Chao87}.
-The variance the estimator of the basic Chao estimate is \citep{ChiuEtal14}:
+The first and second order jackknife estimators are
+\citep{SmithVanBelle84}:
+\begin{align}
+\hat f_0 &= f_1 \frac{N-1}{N} \\
+\hat f_0 & = f_1 \frac{2N-3}{N} + f_2 \frac{(N-2)^2}{N(N-1)} \,.
+\end{align}
+The boostrap estimator is \citep{SmithVanBelle84}:
+\begin{equation}
+\hat f_0 = \sum_{i=1}^{S_o} (1-p_i)^N \,.
+\end{equation}
+The idea in jackknife seems to be that we missed about as many species
+as we saw only once, and the idea in bootstrap that if we repeat
+sampling (with replacement) from the same data, we miss as many
+species as we missed originally.
+
+The variance estimaters only concern the estimated number of missing
+species $\hat f_0$, although they are often expressed as they would
+apply to the pool size $S_p$; this is only true if we assume that
+$\VAR(S_o) = 0$. The variance of the Chao estimate is \citep{ChiuEtal14}:
\begin{multline}
\label{eq:var-chao-basic}
-s^2 = f_2 \left(A^2 \frac{G^4}{4} + A^2 G^3 + A \frac{G^2}{2} \right),\\
-\text{where}\; A = \frac{N-1}{N}\;\text{and}\; G = \frac{f_1}{f_2}
-\end{multline}
-The variance of bias-corrected Chao estimate can be approximated by
-replacing the terms of eq.~\ref{eq:var-chao-basic} with the
-corresponding terms in eq.~\ref{eq:chao-bc}:
-\begin{multline}
-\label{eq:var-chao-bc}
-s^2 = A \frac{f_1(f_1-1)}{2(f_2+1)} + A^2 \frac{f_1(2 f_1+1)^2}{(f_2+1)^2}\\
- + A^2 \frac{f_1^2 f_2 (f_1 -1)^2}{4 (f_2 + 1)^4}
+\VAR(\hat f_0) = f_1 \left(A^2 \frac{G^3}{4} + A^2 G^2 + A \frac{G}{2} \right),\\
+\text{where } A = \frac{N-1}{N}\;\text{and } G = \frac{f_1}{f_2} \,.
\end{multline}
-If we apply the bias-correction in the special case where there are no
-doubletons ($f_2 = 0$), the he variance is
+%% The variance of bias-corrected Chao estimate can be approximated by
+%% replacing the terms of eq.~\ref{eq:var-chao-basic} with the
+%% corresponding terms of the bias-correcter form of in eq.~\ref{eq:chao}:
+%% \begin{multline}
+%% \label{eq:var-chao-bc}
+%% s^2 = A \frac{f_1(f_1-1)}{2} + A^2 \frac{f_1(2 f_1+1)^2}{(f_2+1)^2}\\
+%% + A^2 \frac{f_1^2 f_2 (f_1 -1)^2}{4 (f_2 + 1)^4}
+%% \end{multline}
+For the bias-corrected form of eq.~\ref{eq:chao} (case $f_2 = 0$), the variance is
\citep[who omit small-sample correction in some terms]{ChiuEtal14}:
\begin{multline}
\label{eq:var-chao-bc0}
-s^2 = \frac{1}{4} A^2 f_1 (2f_1 -1)^2 + \frac{1}{2} A f_1 (f_1-1) - \frac{1}{4}A^2 \frac{f_1^4}{S_p}
+\VAR(\hat f_0) = \tfrac{1}{4} A^2 f_1 (2f_1 -1)^2 + \tfrac{1}{2} A f_1
+(f_1-1) \\- \tfrac{1}{4}A^2 \frac{f_1^4}{S_p} \,.
\end{multline}
-Function \code{specpool} uses eq.~\ref{eq:chao-basic} and estimates
-its variance with eq.~\ref{eq:var-chao-basic} when $f_2 > 0$. When
-$f_2 = 0$, \code{specpool} applies eq.~\ref{eq:chao-bc} which reduces
-to $\frac{N-1}{N} \frac{1}{2} f_1 (f_1 - 1)$, and its variance
-estimator eq.~\ref{eq:var-chao-bc0}.
The variance of the first-order jackknife is based on the number of
``singletons'' $r$ (species occurring only once in the data) in sample
plots \citep{SmithVanBelle84}:
\begin{equation}
-s^2 = \left(\sum_{i=1}^N r_i^2 - \frac{f_1}{N}\right) \frac{N-1}{N}
+\VAR(\hat f_0) = \left(\sum_{i=1}^N r_i^2 - \frac{f_1}{N}\right)
+\frac{N-1}{N} \,.
\end{equation}
Variance of the second-order jackknife is not evaluated in
\code{specpool} (but contributions are welcome).
-For the variance of bootstrap estimator, it is practical to define a
-new variable $q_i = (1-p_i)^N$ for each species \citep{SmithVanBelle84}:
+
+The variance of bootstrap estimator is\citep{SmithVanBelle84}:
\begin{multline}
-s^2 = \sum_{i=1}^{S_o} q_i (1-q_i) \\ +2 \sum_{i \neq j}^{S_o} \left[(Z_{ij}/N)^N - q_i q_j \right]
+\VAR(\hat f_0) = \sum_{i=1}^{S_o} q_i (1-q_i) \\ +2 \sum_{i \neq
+ j}^{S_o} \left[(Z_{ij}/N)^N - q_i q_j \right] \\
+\text{where } q_i = (1-p_i)^N \, ,
\end{multline}
-where $Z_{ij}$ is the number of sites where both species are absent.
+and $Z_{ij}$ is the number of sites where both species are absent.
The extrapolated richness values for the whole BCI data are:
<<>>=
@@ -658,18 +687,46 @@ two of these methods:
<<>>=
estimateR(BCI[k,])
@
+In abundance based models $a_i$ denotes the number of species with $i$
+individuals, and takes the place of $f_i$ of previous models.
Chao's method is similar as the bias-corrected model
-eq.~\ref{eq:chao-bc} with its variance estimator
-eq.~\ref{eq:var-chao-bc}, but it uses counts of individuals instead of
-incidences, and does not use small sample correction. \textsc{ace} is
-based on rare species also:
+eq.~\ref{eq:chao} \citep{Chao87, ChiuEtal14}:
+\begin{equation}
+ \label{eq:chao-bc}
+ S_p = S_o + \frac{a_1 (a_1 - 1)}{2 (a_2 + 1)}\,.
+\end{equation}
+When $f_2=0$, eq.~\ref{eq:chao-bc} reduces to the bias-corrected form
+of eq.~\ref{eq:chao}, but quantitative estimators are based on
+abundances and do not use small-sample correction. This is not usually
+needed because sample sizes are total numbers of individuals, and
+these are usually high, unlike in frequency based models, where the
+sample size is the number of sites \citep{ChiuEtal14}.
+
+A commonly used approximate variance estimator of eq.~\ref{eq:chao-bc} is:
+\begin{multline}
+ \label{eq:var-chao-bc}
+ s^2 = \frac{a_1(a_1-1)}{2} + \frac{a_1(2 a_1+1)^2}{(a_2+1)^2}\\
+ + \frac{a_1^2 a_2 (a_1 -1)^2}{4 (a_2 + 1)^4} \,.
+\end{multline}
+However, \pkg{vegan} does not use this, but instead the following more
+exact form which was directly derived from eq.~\ref{eq:chao-bc}
+following \citet[web appendix]{ChiuEtal14}:
+\begin{multline}
+ s^2 = \frac{1}{4} \frac{1}{(a_2+1)^4 S_p} [a_1 (S_p a_1^3
+ a_2 + 4 S_p a_1^2 a_2^2 \\+ 2 S_p a_1 a_2^3 + 6 S_p a_1^2 a_2 + 2 S_p
+ a_1 a_2^2 -2 S_p a_2^3 \\+ 4 S_p a_1^2 + S_p a_1 a_2 -5 S_p a_2^2 - a_1^3 - 2
+ a_1^2 a_2\\ - a_1 a_2^2 - 2 S_p a_1 - 4 S_p a_2 - S_p ) ]\,.
+\end{multline}
+The variance estimators only concern the number of unseen species like previously.
+
+The \textsc{ace} is estimator is defined as \citep{OHara05}:
\begin{equation}
\begin{split}
S_p &= S_\mathrm{abund} + \frac{S_\mathrm{rare}}{C_\mathrm{ACE}} +
\frac{a_1}{C_\mathrm{ACE}} \gamma^2\, , \quad \text{where}\\
C_\mathrm{ACE} &= 1 - \frac{a_1}{N_\mathrm{rare}}\\
\gamma^2 &= \frac{S_\mathrm{rare}}{C_\mathrm{ACE}} \sum_{i=1}^{10} i
-(i-1) a_1 \frac{N_\mathrm{rare} - 1}{N_\mathrm{rare}}
+(i-1) a_1 \frac{N_\mathrm{rare} - 1}{N_\mathrm{rare}}\,.
\end{split}
\end{equation}
Now $a_1$ takes the place of $f_1$ above, and means the number of
@@ -677,7 +734,9 @@ species with only one individual.
Here $S_\mathrm{abund}$ and $S_\mathrm{rare}$ are the numbers of
species of abundant and rare species, with an arbitrary upper limit of
10 individuals for a rare species, and $N_\mathrm{rare}$ is the total
-number of individuals in rare species.
+number of individuals in rare species. The variance estimator uses
+iterative solution, and it is best interpreted from the source code or
+following \citet{OHara05}.
The pool size
is estimated separately for each site, but if input is a data frame,
@@ -687,7 +746,7 @@ If log-normal abundance model is appropriate, it can be used to
estimate the pool size. Log-normal model has a finite number of
species which can be found integrating the log-normal:
\begin{equation}
-S_p = S_\mu \sigma \sqrt{2 \pi}
+S_p = S_\mu \sigma \sqrt{2 \pi} \,,
\end{equation}
where $S_\mu$ is the modal height or the expected number of species at
maximum (at $\mu$), and $\sigma$ is the width. Function
@@ -717,12 +776,12 @@ smo <- beals(BCI)
We may see how the estimated probability of occurrence and observed
numbers of stems relate in one of the more familiar species. We study
only one species, and to avoid circular reasoning we do not include
-the target species in the smoothing (Fig. \ref{fig:beals}):
+the target species in the smoothing (Fig.~\ref{fig:beals}):
<<a>>=
j <- which(colnames(BCI) == "Ceiba.pentandra")
plot(beals(BCI, species=j, include=FALSE), BCI[,j],
- main="Ceiba pentandra", xlab="Probability of occurrence",
- ylab="Occurrence")
+ ylab="Occurrence", main="Ceiba pentandra",
+ xlab="Probability of occurrence")
@
\begin{figure}
<<fig=true,echo=false>>=
diff --git a/vignettes/diversity-vegan.tex b/vignettes/diversity-vegan.tex
index 6569bd3..1d153bb 100644
--- a/vignettes/diversity-vegan.tex
+++ b/vignettes/diversity-vegan.tex
@@ -10,8 +10,8 @@
\title{Vegan: ecological diversity} \author{Jari Oksanen}
\date{\footnotesize{
- processed with vegan 2.2-0
- in R Under development (unstable) (2014-11-16 r66991) on \today}}
+ processed with vegan 2.2-1
+ in R Under development (unstable) (2015-01-12 r67426) on \today}}
%% need no \usepackage{Sweave}
\begin{document}
@@ -62,7 +62,7 @@ indices \citep{Hill73number}:
\begin{align}
H &= - \sum_{i=1}^S p_i \log_b p_i & \text{Shannon--Weaver}\\
D_1 &= 1 - \sum_{i=1}^S p_i^2 &\text{Simpson}\\
-D_2 &= \frac{1}{\sum_{i=1}^S p_i^2} &\text{inverse Simpson}
+D_2 &= \frac{1}{\sum_{i=1}^S p_i^2} &\text{inverse Simpson}\,,
\end{align}
where $p_i$ is the proportion of species $i$, and $S$ is the number of
species so that $\sum_{i=1}^S p_i = 1$, and $b$ is the base of the
@@ -91,9 +91,9 @@ the numbers of species.
\pkg{vegan} also can estimate series of R\'{e}nyi and Tsallis
diversities. R{\'e}nyi diversity of order $a$ is \citep{Hill73number}:
\begin{equation}
-H_a = \frac{1}{1-a} \log \sum_{i=1}^S p_i^a
+H_a = \frac{1}{1-a} \log \sum_{i=1}^S p_i^a \,,
\end{equation}
-or the corresponding Hill numbers $N_a = \exp(H_a)$. Many common
+and the corresponding Hill number is $N_a = \exp(H_a)$. Many common
diversity indices are special cases of Hill numbers: $N_0 = S$, $N_1 =
\exp(H')$, $N_2 = D_2$, and $N_\infty = 1/(\max p_i)$. The
corresponding R\'{e}nyi diversities are $H_0 = \log(S)$, $H_1 = H'$, $H_2 =
@@ -102,8 +102,8 @@ Tsallis diversity of order $q$ is \citep{Tothmeresz95}:
\begin{equation}
H_q = \frac{1}{q-1} \left(1 - \sum_{i=1}^S p^q \right) \, .
\end{equation}
-This corresponds to common diversity indices: $H_0 = S-1$, $H_1 = H'$,
-and $H_2 = D_2$, and can be converted to the Hill number:
+These correspond to common diversity indices: $H_0 = S-1$, $H_1 = H'$,
+and $H_2 = D_1$, and can be converted to Hill numbers:
\begin{equation}
N_q = (1 - (q-1) H_q )^\frac{1}{1-q} \, .
\end{equation}
@@ -118,7 +118,7 @@ We select a random subset of five sites for R\'{e}nyi diversities:
We can really regard a site more diverse if all of its R\'{e}nyi
diversities are higher than in another site. We can inspect this
graphically using the standard \code{plot} function for the
-\code{renyi} result (Fig. \ref{fig:renyi}).
+\code{renyi} result (Fig.~\ref{fig:renyi}).
\begin{figure}
\includegraphics{diversity-vegan-006}
\caption{R\'{e}nyi diversities in six randomly selected plots. The plot
@@ -143,28 +143,28 @@ richness actually may be caused by differences in sample size. To
solve this problem, we may try to rarefy species richness to the same
number of individuals. Expected number of species in a community
rarefied from $N$ to $n$ individuals is \citep{Hurlbert71}:
-\begin{multline}
+\begin{equation}
\label{eq:rare}
-\hat S_n = \sum_{i=1}^S (1 - q_i),\\ \text{where} \quad q_i = {N-x_i
- \choose n} \Bigm /{N \choose n}
-\end{multline}
-where $x_i$ is the count of species $i$, and ${N \choose n}$ is the
+\hat S_n = \sum_{i=1}^S (1 - q_i)\,, \quad\text{where } q_i =
+\frac{{N-x_i \choose n}}{{N \choose n}} \,.
+\end{equation}
+Here $x_i$ is the count of species $i$, and ${N \choose n}$ is the
binomial coefficient, or the number of ways we can choose $n$ from
$N$, and $q_i$ give the probabilities that species $i$ does \emph{not} occur in a
-sample of size $n$. This is defined only when $N-x_i > n$, but for
+sample of size $n$. This is positive only when $N-x_i \ge n$, but for
other cases $q_i = 0$ or the species is sure to occur in the sample.
The variance of rarefied richness is \citep{HeckEtal75}:
\begin{multline}
\label{eq:rarevar}
-s^2 = q_i (1-q_i) \\ + 2 \sum_{i=1}^S \sum_{j>i} \left[ {N- x_i - x_j
- \choose n} \Bigm / {N
- \choose n} - q_i q_j\right]
+s^2 = q_i (1-q_i) \\ + 2 \sum_{i=1}^S \sum_{j>i} \left[ \frac{{N- x_i - x_j
+ \choose n}}{ {N
+ \choose n}} - q_i q_j\right] \,.
\end{multline}
-Equation \ref{eq:rarevar} actually is of the same form as the variance
+Equation~\ref{eq:rarevar} actually is of the same form as the variance
of sum of correlated variables:
\begin{equation}
\VAR \left(\sum x_i \right) = \sum \VAR (x_i) + 2 \sum_{i=1}^S
-\sum_{j>i} \COV (x_i, x_j)
+\sum_{j>i} \COV (x_i, x_j) \,.
\end{equation}
The number of stems per hectare varies in our
@@ -236,7 +236,8 @@ The two basic indices are called taxonomic diversity $\Delta$ and
taxonomic distinctness $\Delta^*$ \citep{ClarkeWarwick98}:
\begin{align}
\Delta &= \frac{\sum \sum_{i<j} \omega_{ij} x_i x_j}{n (n-1) / 2}\\
-\Delta^* &= \frac{\sum \sum_{i<j} \omega_{ij} x_i x_j}{\sum \sum_{i<j} x_i x_j}
+\Delta^* &= \frac{\sum \sum_{i<j} \omega_{ij} x_i x_j}{\sum \sum_{i<j}
+ x_i x_j} \,.
\end{align}
These equations give the index values for a single site, and summation
goes over species $i$ and $j$, and $\omega$ are the taxonomic
@@ -251,7 +252,8 @@ richness\footnote{This text normally uses upper case letter $S$ for
to give $s \Delta^+$, or it can be used to estimate an index of
variation in taxonomic distinctness $\Lambda^+$ \citep{ClarkeWarwick01}:
\begin{equation}
- \Lambda^+ = \frac{\sum \sum_{i<j} \omega_{ij}^2}{n (n-1) / 2} - (\Delta^+)^2
+ \Lambda^+ = \frac{\sum \sum_{i<j} \omega_{ij}^2}{n (n-1) / 2} -
+ (\Delta^+)^2 \,.
\end{equation}
We still need the taxonomic differences among species ($\omega$) to
@@ -275,7 +277,7 @@ data in \pkg{vegan}\footnote{Actually I made such a classification,
but taxonomic differences proved to be of little use in the Barro
Colorado data: they only singled out sites with Monocots (palm
trees) in the data.}
-but there is such a table for the Dune meadow data (Fig. \ref{fig:taxondive}):
+but there is such a table for the Dune meadow data (Fig.~\ref{fig:taxondive}):
\begin{Schunk}
\begin{Sinput}
> data(dune)
@@ -330,12 +332,12 @@ several models for species abundance distribution.
In Fisher's log-series, the expected number of species $\hat f$ with $n$
individuals is \citep{FisherEtal43}:
\begin{equation}
-\hat f_n = \frac{\alpha x^n}{n}
+\hat f_n = \frac{\alpha x^n}{n} \,,
\end{equation}
where $\alpha$ is the diversity parameter, and $x$ is a nuisance
parameter defined by $\alpha$ and total number
of individuals $N$ in the site, $x = N/(N-\alpha)$. Fisher's
-log-series for a randomly selected plot is (Fig. \ref{fig:fisher}):
+log-series for a randomly selected plot is (Fig.~\ref{fig:fisher}):
\begin{Schunk}
\begin{Sinput}
> k <- sample(nrow(BCI), 1)
@@ -344,14 +346,14 @@ log-series for a randomly selected plot is (Fig. \ref{fig:fisher}):
\end{Sinput}
\begin{Soutput}
Fisher log series model
-No. of species: 86
-Fisher alpha: 33.31374
+No. of species: 91
+Fisher alpha: 35.84847
\end{Soutput}
\end{Schunk}
\begin{figure}
\includegraphics{diversity-vegan-017}
\caption{Fisher's log-series fitted to one randomly selected site
- (43).}
+ (22).}
\label{fig:fisher}
\end{figure}
We already saw $\alpha$ as a diversity index.
@@ -375,7 +377,7 @@ octave, and the same for all species at the octave limits occurring 2,
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 43):
+BCI data, but here our random plot (number 22):
\begin{Schunk}
\begin{Sinput}
> prestondistr(BCI[k,])
@@ -383,18 +385,18 @@ BCI data, but here our random plot (number 43):
\begin{Soutput}
Preston lognormal model
Method: maximized likelihood to log2 abundances
-No. of species: 86
+No. of species: 91
- mode width S0
- 0.722374 1.867705 22.353328
+ mode width S0
+ 0.6707546 1.8437957 24.0831256
Frequencies by Octave
- 0 1 2 3 4
-Observed 17.50000 27.00000 16.5000 11.50000 9.000000
-Fitted 20.74239 22.10773 17.6901 10.62715 4.792958
+ 0 1 2 3 4
+Observed 19.50000 28.5000 15.50000 14.50000 8.000000
+Fitted 22.54109 23.7022 18.57176 10.84347 4.717738
5 6
-Observed 2.500000 2.0000000
-Fitted 1.622897 0.4125523
+Observed 3.000000 2.0000000
+Fitted 1.529503 0.3695023
\end{Soutput}
\end{Schunk}
@@ -415,7 +417,7 @@ estimation:
\hat a_r &= N \hat p_1 r^\gamma &\text{Zipf}\\
\hat a_r &= N c (r + \beta)^\gamma &\text{Zipf--Mandelbrot}
\end{align}
-Where $\hat a_r$ is the expected abundance of species at rank $r$, $S$
+In all these, $\hat a_r$ is the expected abundance of species at rank $r$, $S$
is the number of species, $N$ is the number of individuals, $\Phi$ is
a standard normal function, $\hat p_1$ is the estimated proportion of
the most abundant species, and $\alpha$, $\mu$, $\sigma$, $\gamma$,
@@ -425,7 +427,7 @@ It is customary to define the models for proportions $p_r$ instead of
abundances $a_r$, but there is no reason for this, and \code{radfit}
is able to work with the original abundance data. We have count data,
and the default Poisson error looks appropriate, and our example data
-set gives (Fig. \ref{fig:rad}):
+set gives (Fig.~\ref{fig:rad}):
\begin{Schunk}
\begin{Sinput}
> rad <- radfit(BCI[k,])
@@ -433,26 +435,26 @@ set gives (Fig. \ref{fig:rad}):
\end{Sinput}
\begin{Soutput}
RAD models, family poisson
-No. of species 86, total abundance 407
+No. of species 91, total abundance 418
par1 par2 par3 Deviance
-Null 92.4312
-Preemption 0.054324 82.4328
-Lognormal 0.82087 1.2361 20.2361
-Zipf 0.1632 -0.90476 20.0974
-Mandelbrot 0.57359 -1.2499 2.4591 9.5133
+Null 114.1747
+Preemption 0.051814 110.5156
+Lognormal 0.75751 1.2637 26.2510
+Zipf 0.16662 -0.92076 15.5222
+Mandelbrot 0.34281 -1.1219 1.2679 9.6047
AIC BIC
-Null 336.9752 336.9752
-Preemption 328.9768 331.4312
-Lognormal 268.7801 273.6888
-Zipf 268.6414 273.5501
-Mandelbrot 260.0574 267.4204
+Null 370.1156 370.1156
+Preemption 368.4564 370.9673
+Lognormal 286.1919 291.2136
+Zipf 275.4630 280.4847
+Mandelbrot 271.5455 279.0781
\end{Soutput}
\end{Schunk}
\begin{figure}
\includegraphics{diversity-vegan-020}
\caption{Ranked abundance distribution models for a random plot
- (no. 43). The best model has the lowest \textsc{aic}.}
+ (no. 22). The best model has the lowest \textsc{aic}.}
\label{fig:rad}
\end{figure}
@@ -489,30 +491,31 @@ to these individuals. Kindt's exact accumulator resembles rarefaction
\citep{UglandEtal03}:
\begin{multline}
\label{eq:kindt}
-\hat S_n = \sum_{i=1}^S (1 - p_i), \, \\ \text{where} \quad p_i = {N- f_i
-\choose n} \Bigm / {N \choose n}
+\hat S_n = \sum_{i=1}^S (1 - p_i), \,\quad \text{where }
+p_i = \frac{{N- f_i \choose n}}{{N \choose n}} \,,
\end{multline}
-where $f_i$ is the frequency of species $i$. Approximate variance
+and $f_i$ is the frequency of species $i$. Approximate variance
estimator is:
\begin{multline}
\label{eq:kindtvar}
s^2 = p_i (1 - p_i) \\ + 2 \sum_{i=1}^S \sum_{j>i} \left( r_{ij}
- \sqrt{p_i(1-p_i)} \sqrt{p_j (1-p_j)}\right)
+ \sqrt{p_i(1-p_i)} \sqrt{p_j (1-p_j)}\right) \,,
\end{multline}
where $r_{ij}$ is the correlation coefficient between species $i$ and
-$j$. Both of these are unpublished: eq. \ref{eq:kindt} was developed
-by Roeland Kindt, and eq. \ref{eq:kindtvar} by Jari Oksanen. The third
+$j$. Both of these are unpublished: eq.~\ref{eq:kindt} was developed
+by Roeland Kindt, and eq.~\ref{eq:kindtvar} by Jari Oksanen. The third
analytic method was suggested by \citet{Coleman82}:
\begin{equation}
\label{eq:cole}
-S_n = \sum_{i=1}^S (1 - p_i), \, \text{where} \quad p_i = \left(1 - \frac{1}{n}\right)^{f_i}
+S_n = \sum_{i=1}^S (1 - p_i), \quad \text{where } p_i = \left(1 -
+ \frac{1}{n}\right)^{f_i} \,,
\end{equation}
-and he suggested variance $s^2 = p_i (1-p_i)$ which ignores the
-covariance component. In addition, eq. \ref{eq:cole} does not
+and the suggested variance is $s^2 = p_i (1-p_i)$ which ignores the
+covariance component. In addition, eq.~\ref{eq:cole} does not
properly handle sampling without replacement and underestimates the
species accumulation curve.
-The recommended is Kindt's exact method (Fig. \ref{fig:sac}):
+The recommended is Kindt's exact method (Fig.~\ref{fig:sac}):
\begin{Schunk}
\begin{Sinput}
> sac <- specaccum(BCI)
@@ -541,7 +544,7 @@ number of species in a collection of sites $S$ and the average
richness per one site $\bar \alpha$ \citep{Tuomisto10a}:
\begin{equation}
\label{eq:beta}
- \beta = S/\bar \alpha - 1
+ \beta = S/\bar \alpha - 1 \,.
\end{equation}
Subtraction of one means that $\beta = 0$ when there are no excess
species or no heterogeneity between sites. For this index, no specific
@@ -556,16 +559,16 @@ of \pkg{vegan} function \code{specnumber}:
\end{Soutput}
\end{Schunk}
-The index of eq. \ref{eq:beta} is problematic because $S$ increases
+The index of eq.~\ref{eq:beta} is problematic because $S$ increases
with the number of sites even when sites are all subsets of the same
community. \citet{Whittaker60} noticed this, and suggested the index
to be found from pairwise comparison of sites. If the number of shared
species in two sites is $a$, and the numbers of species unique to each
site are $b$ and $c$, then $\bar \alpha = (2a + b + c)/2$ and $S =
-a+b+c$, and index \ref{eq:beta} can be expressed as:
+a+b+c$, and index~\ref{eq:beta} can be expressed as:
\begin{equation}
\label{eq:betabray}
- \beta = \frac{a+b+c}{(2a+b+c)/2} - 1 = \frac{b+c}{2a+b+c}
+ \beta = \frac{a+b+c}{(2a+b+c)/2} - 1 = \frac{b+c}{2a+b+c} \,.
\end{equation}
This is the S{\o}rensen index of dissimilarity, and it can be found
for all sites using \pkg{vegan} function \code{vegdist} with
@@ -581,7 +584,7 @@ binary data:
\end{Schunk}
There are many other definitions of beta diversity in addition to
-eq. \ref{eq:beta}. All commonly used indices can be found using
+eq.~\ref{eq:beta}. All commonly used indices can be found using
\code{betadiver} \citep{KoleffEtal03}. The indices in \code{betadiver}
can be referred to by subscript name, or index number:
\begin{Schunk}
@@ -624,7 +627,7 @@ One of the more interesting indices is based
on the Arrhenius species--area model
\begin{equation}
\label{eq:arrhenius}
- \hat S = c X^z
+ \hat S = c X^z\,,
\end{equation}
where $X$ is the area (size) of the patch or site, and $c$ and $z$ are
parameters. Parameter $c$ is uninteresting, but $z$ gives the
@@ -651,7 +654,7 @@ Function \code{betadisper} can be used to analyse beta diversities
with respect to classes or factors \citep{Anderson06, AndersonEtal06}.
There is no such classification available for the Barro Colorado
Island data, and the example studies beta diversities in the
-management classes of the dune meadows (Fig. \ref{fig:betadisper}):
+management classes of the dune meadows (Fig.~\ref{fig:betadisper}):
\begin{Schunk}
\begin{Sinput}
> data(dune)
@@ -700,68 +703,94 @@ with a single site. Both functions assume that the number of unseen
species is related to the number of rare species, or species seen only
once or twice.
+The incidence-based functions group species by their number of
+occurrences $f_i = f_0, f_1, \ldots, f_N$, where $f$ is the number of
+species occuring in exactly $i$ sites in the data: $f_N$ is the number
+of species occurring on every $N$ site, $f_1$ the number of species
+occurring once, and $f_0$ the number of species in the species pool
+but not found in the sample. The total number of species in the pool
+$S_p$ is
+\begin{equation}
+S_p = \sum_{i=0}^N f_i = f_0+ S_o \,,
+\end{equation}
+where $S_o = \sum_{i>0} f_i$ is the observed number of species. The
+sampling proportion $i/N$ is an estimate for the commonness of the
+species in the community. When species is present in the community but
+not in the sample, $i=0$ is an obvious under-estimate, and
+consequently, for values $i>0$ the species commonness is
+over-estimated \citep{Good53}. The models for the pool size estimate
+the number of species missing in the sample $f_0$.
+
Function \code{specpool} implements the following models to estimate
-the pool size $S_p$ \citep{SmithVanBelle84, Chao87, ChiuEtal14}:
-\begin{align}
-\label{eq:chao-basic}
-S_p &= S_o + \frac{f_1^2}{2 f_2} \frac{N-1}{N} & \text{Chao}\\
-\label{eq:chao-bc}
-S_p &= S_o + \frac{f_1 (f_1 -1)}{2 (f_2+1)} \frac{N-1}{N} & \text{Chao bias-corrected}\\
-S_p &= S_o + f_1 \frac{N-1}{N} & \text{1st order Jackknife}\\
-S_p & = S_o + f_1 \frac{2N-3}{N} \nonumber \\ & + f_2 \frac{(N-2)^2}{N(N-1)}
-& \text{2nd order Jackknife}\\
-S_p &= S_o + \sum_{i=1}^{S_o} (1-p_i)^N & \text{Bootstrap}
-\end{align}
-Here $S_o$ is the observed number of species, $f_1$ and $f_2$ are the
-numbers of species observed once or twice, $N$ is the number of sites,
-and $p_i$ are proportions of species. The idea in jackknife seems to
-be that we missed about as many species as we saw only once, and the
-idea in bootstrap that if we repeat sampling (with replacement) from
-the same data, we miss as many species as we missed originally.
-\citet{ChiuEtal14} introduced the small-sample correction term
+the number of missing species $f_0$. Chao estimator is \citep{Chao87, ChiuEtal14}:
+\begin{equation}
+\label{eq:chao}
+\hat f_0 = \begin{cases}
+ \frac{f_1^2}{2 f_2} \frac{N-1}{N} &\text{if } f_2 > 0 \\
+\frac{f_1 (f_1 -1)}{2} \frac{N-1}{N} & \text{if } f_2 = 0 \,.
+\end{cases}
+\end{equation}
+The latter case for $f_2=0$ is known as the bias-corrected
+form. \citet{ChiuEtal14} introduced the small-sample correction term
$\frac{N}{N-1}$, but it was not originally used \citep{Chao87}.
-The variance the estimator of the basic Chao estimate is \citep{ChiuEtal14}:
+The first and second order jackknife estimators are
+\citep{SmithVanBelle84}:
+\begin{align}
+\hat f_0 &= f_1 \frac{N-1}{N} \\
+\hat f_0 & = f_1 \frac{2N-3}{N} + f_2 \frac{(N-2)^2}{N(N-1)} \,.
+\end{align}
+The boostrap estimator is \citep{SmithVanBelle84}:
+\begin{equation}
+\hat f_0 = \sum_{i=1}^{S_o} (1-p_i)^N \,.
+\end{equation}
+The idea in jackknife seems to be that we missed about as many species
+as we saw only once, and the idea in bootstrap that if we repeat
+sampling (with replacement) from the same data, we miss as many
+species as we missed originally.
+
+The variance estimaters only concern the estimated number of missing
+species $\hat f_0$, although they are often expressed as they would
+apply to the pool size $S_p$; this is only true if we assume that
+$\VAR(S_o) = 0$. The variance of the Chao estimate is \citep{ChiuEtal14}:
\begin{multline}
\label{eq:var-chao-basic}
-s^2 = f_2 \left(A^2 \frac{G^4}{4} + A^2 G^3 + A \frac{G^2}{2} \right),\\
-\text{where}\; A = \frac{N-1}{N}\;\text{and}\; G = \frac{f_1}{f_2}
-\end{multline}
-The variance of bias-corrected Chao estimate can be approximated by
-replacing the terms of eq.~\ref{eq:var-chao-basic} with the
-corresponding terms in eq.~\ref{eq:chao-bc}:
-\begin{multline}
-\label{eq:var-chao-bc}
-s^2 = A \frac{f_1(f_1-1)}{2(f_2+1)} + A^2 \frac{f_1(2 f_1+1)^2}{(f_2+1)^2}\\
- + A^2 \frac{f_1^2 f_2 (f_1 -1)^2}{4 (f_2 + 1)^4}
+\VAR(\hat f_0) = f_1 \left(A^2 \frac{G^3}{4} + A^2 G^2 + A \frac{G}{2} \right),\\
+\text{where } A = \frac{N-1}{N}\;\text{and } G = \frac{f_1}{f_2} \,.
\end{multline}
-If we apply the bias-correction in the special case where there are no
-doubletons ($f_2 = 0$), the he variance is
+%% The variance of bias-corrected Chao estimate can be approximated by
+%% replacing the terms of eq.~\ref{eq:var-chao-basic} with the
+%% corresponding terms of the bias-correcter form of in eq.~\ref{eq:chao}:
+%% \begin{multline}
+%% \label{eq:var-chao-bc}
+%% s^2 = A \frac{f_1(f_1-1)}{2} + A^2 \frac{f_1(2 f_1+1)^2}{(f_2+1)^2}\\
+%% + A^2 \frac{f_1^2 f_2 (f_1 -1)^2}{4 (f_2 + 1)^4}
+%% \end{multline}
+For the bias-corrected form of eq.~\ref{eq:chao} (case $f_2 = 0$), the variance is
\citep[who omit small-sample correction in some terms]{ChiuEtal14}:
\begin{multline}
\label{eq:var-chao-bc0}
-s^2 = \frac{1}{4} A^2 f_1 (2f_1 -1)^2 + \frac{1}{2} A f_1 (f_1-1) - \frac{1}{4}A^2 \frac{f_1^4}{S_p}
+\VAR(\hat f_0) = \tfrac{1}{4} A^2 f_1 (2f_1 -1)^2 + \tfrac{1}{2} A f_1
+(f_1-1) \\- \tfrac{1}{4}A^2 \frac{f_1^4}{S_p} \,.
\end{multline}
-Function \code{specpool} uses eq.~\ref{eq:chao-basic} and estimates
-its variance with eq.~\ref{eq:var-chao-basic} when $f_2 > 0$. When
-$f_2 = 0$, \code{specpool} applies eq.~\ref{eq:chao-bc} which reduces
-to $\frac{N-1}{N} \frac{1}{2} f_1 (f_1 - 1)$, and its variance
-estimator eq.~\ref{eq:var-chao-bc0}.
The variance of the first-order jackknife is based on the number of
``singletons'' $r$ (species occurring only once in the data) in sample
plots \citep{SmithVanBelle84}:
\begin{equation}
-s^2 = \left(\sum_{i=1}^N r_i^2 - \frac{f_1}{N}\right) \frac{N-1}{N}
+\VAR(\hat f_0) = \left(\sum_{i=1}^N r_i^2 - \frac{f_1}{N}\right)
+\frac{N-1}{N} \,.
\end{equation}
Variance of the second-order jackknife is not evaluated in
\code{specpool} (but contributions are welcome).
-For the variance of bootstrap estimator, it is practical to define a
-new variable $q_i = (1-p_i)^N$ for each species \citep{SmithVanBelle84}:
+
+The variance of bootstrap estimator is\citep{SmithVanBelle84}:
\begin{multline}
-s^2 = \sum_{i=1}^{S_o} q_i (1-q_i) \\ +2 \sum_{i \neq j}^{S_o} \left[(Z_{ij}/N)^N - q_i q_j \right]
+\VAR(\hat f_0) = \sum_{i=1}^{S_o} q_i (1-q_i) \\ +2 \sum_{i \neq
+ j}^{S_o} \left[(Z_{ij}/N)^N - q_i q_j \right] \\
+\text{where } q_i = (1-p_i)^N \, ,
\end{multline}
-where $Z_{ij}$ is the number of sites where both species are absent.
+and $Z_{ij}$ is the number of sites where both species are absent.
The extrapolated richness values for the whole BCI data are:
\begin{Schunk}
@@ -784,10 +813,10 @@ the plots (but this is rarely true):
> specpool(BCI[s,])
\end{Sinput}
\begin{Soutput}
- Species chao chao.se jack1 jack1.se jack2
-All 206 229.1771 12.00792 230.96 7.394701 242.5367
- boot boot.se n
-All 217.8287 4.374874 25
+ Species chao chao.se jack1 jack1.se jack2
+All 212 231.44 9.819491 237.92 8.309224 246.89
+ boot boot.se n
+All 224.7046 4.71474 25
\end{Soutput}
\end{Schunk}
@@ -804,26 +833,54 @@ two of these methods:
> estimateR(BCI[k,])
\end{Sinput}
\begin{Soutput}
- 43
-S.obs 86.000000
-S.chao1 115.750000
-se.chao1 13.264138
-S.ACE 132.940236
-se.ACE 6.432043
+ 22
+S.obs 91.000000
+S.chao1 130.000000
+se.chao1 16.580069
+S.ACE 141.966707
+se.ACE 6.459391
\end{Soutput}
\end{Schunk}
+In abundance based models $a_i$ denotes the number of species with $i$
+individuals, and takes the place of $f_i$ of previous models.
Chao's method is similar as the bias-corrected model
-eq.~\ref{eq:chao-bc} with its variance estimator
-eq.~\ref{eq:var-chao-bc}, but it uses counts of individuals instead of
-incidences, and does not use small sample correction. \textsc{ace} is
-based on rare species also:
+eq.~\ref{eq:chao} \citep{Chao87, ChiuEtal14}:
+\begin{equation}
+ \label{eq:chao-bc}
+ S_p = S_o + \frac{a_1 (a_1 - 1)}{2 (a_2 + 1)}\,.
+\end{equation}
+When $f_2=0$, eq.~\ref{eq:chao-bc} reduces to the bias-corrected form
+of eq.~\ref{eq:chao}, but quantitative estimators are based on
+abundances and do not use small-sample correction. This is not usually
+needed because sample sizes are total numbers of individuals, and
+these are usually high, unlike in frequency based models, where the
+sample size is the number of sites \citep{ChiuEtal14}.
+
+A commonly used approximate variance estimator of eq.~\ref{eq:chao-bc} is:
+\begin{multline}
+ \label{eq:var-chao-bc}
+ s^2 = \frac{a_1(a_1-1)}{2} + \frac{a_1(2 a_1+1)^2}{(a_2+1)^2}\\
+ + \frac{a_1^2 a_2 (a_1 -1)^2}{4 (a_2 + 1)^4} \,.
+\end{multline}
+However, \pkg{vegan} does not use this, but instead the following more
+exact form which was directly derived from eq.~\ref{eq:chao-bc}
+following \citet[web appendix]{ChiuEtal14}:
+\begin{multline}
+ s^2 = \frac{1}{4} \frac{1}{(a_2+1)^4 S_p} [a_1 (S_p a_1^3
+ a_2 + 4 S_p a_1^2 a_2^2 \\+ 2 S_p a_1 a_2^3 + 6 S_p a_1^2 a_2 + 2 S_p
+ a_1 a_2^2 -2 S_p a_2^3 \\+ 4 S_p a_1^2 + S_p a_1 a_2 -5 S_p a_2^2 - a_1^3 - 2
+ a_1^2 a_2\\ - a_1 a_2^2 - 2 S_p a_1 - 4 S_p a_2 - S_p ) ]\,.
+\end{multline}
+The variance estimators only concern the number of unseen species like previously.
+
+The \textsc{ace} is estimator is defined as \citep{OHara05}:
\begin{equation}
\begin{split}
S_p &= S_\mathrm{abund} + \frac{S_\mathrm{rare}}{C_\mathrm{ACE}} +
\frac{a_1}{C_\mathrm{ACE}} \gamma^2\, , \quad \text{where}\\
C_\mathrm{ACE} &= 1 - \frac{a_1}{N_\mathrm{rare}}\\
\gamma^2 &= \frac{S_\mathrm{rare}}{C_\mathrm{ACE}} \sum_{i=1}^{10} i
-(i-1) a_1 \frac{N_\mathrm{rare} - 1}{N_\mathrm{rare}}
+(i-1) a_1 \frac{N_\mathrm{rare} - 1}{N_\mathrm{rare}}\,.
\end{split}
\end{equation}
Now $a_1$ takes the place of $f_1$ above, and means the number of
@@ -831,7 +888,9 @@ species with only one individual.
Here $S_\mathrm{abund}$ and $S_\mathrm{rare}$ are the numbers of
species of abundant and rare species, with an arbitrary upper limit of
10 individuals for a rare species, and $N_\mathrm{rare}$ is the total
-number of individuals in rare species.
+number of individuals in rare species. The variance estimator uses
+iterative solution, and it is best interpreted from the source code or
+following \citet{OHara05}.
The pool size
is estimated separately for each site, but if input is a data frame,
@@ -841,7 +900,7 @@ If log-normal abundance model is appropriate, it can be used to
estimate the pool size. Log-normal model has a finite number of
species which can be found integrating the log-normal:
\begin{equation}
-S_p = S_\mu \sigma \sqrt{2 \pi}
+S_p = S_\mu \sigma \sqrt{2 \pi} \,,
\end{equation}
where $S_\mu$ is the modal height or the expected number of species at
maximum (at $\mu$), and $\sigma$ is the width. Function
@@ -855,14 +914,14 @@ can try:
\end{Sinput}
\begin{Soutput}
Extrapolated Observed Veiled
- 104.6503 86.0000 18.6503
+ 111.30523 91.00000 20.30523
\end{Soutput}
\begin{Sinput}
> veiledspec(BCI[k,])
\end{Sinput}
\begin{Soutput}
Extrapolated Observed Veiled
- 118.52239 86.00000 32.52239
+ 129.14959 91.00000 38.14959
\end{Soutput}
\end{Schunk}
@@ -885,13 +944,13 @@ Function \code{beals} implement Beals smoothing \citep{McCune87,
We may see how the estimated probability of occurrence and observed
numbers of stems relate in one of the more familiar species. We study
only one species, and to avoid circular reasoning we do not include
-the target species in the smoothing (Fig. \ref{fig:beals}):
+the target species in the smoothing (Fig.~\ref{fig:beals}):
\begin{Schunk}
\begin{Sinput}
> j <- which(colnames(BCI) == "Ceiba.pentandra")
> plot(beals(BCI, species=j, include=FALSE), BCI[,j],
- main="Ceiba pentandra", xlab="Probability of occurrence",
- ylab="Occurrence")
+ ylab="Occurrence", main="Ceiba pentandra",
+ xlab="Probability of occurrence")
\end{Sinput}
\end{Schunk}
\begin{figure}
diff --git a/vignettes/intro-vegan.tex b/vignettes/intro-vegan.tex
index 13c5c70..9d37785 100644
--- a/vignettes/intro-vegan.tex
+++ b/vignettes/intro-vegan.tex
@@ -8,8 +8,8 @@
\date{\footnotesize{
processed with vegan
-2.2-0
-in R Under development (unstable) (2014-11-16 r66991) on \today}}
+2.2-1
+in R Under development (unstable) (2015-01-12 r67426) on \today}}
%% need no \usepackage{Sweave}
\begin{document}
@@ -113,13 +113,8 @@ species scores to the configuration as weighted averages (function
\end{Sinput}
\begin{Soutput}
Run 0 stress 0.1192678
-Run 1 stress 0.1886532
-Run 2 stress 0.1183186
-... New best solution
-... procrustes: rmse 0.02026887 max resid 0.06495011
-Run 3 stress 0.1192678
-Run 4 stress 0.1183186
-... procrustes: rmse 6.471967e-05 max resid 0.000210315
+Run 1 stress 0.1192682
+... procrustes: rmse 0.0003682283 max resid 0.001132974
*** Solution reached
\end{Soutput}
\begin{Sinput}
@@ -135,9 +130,9 @@ Data: dune
Distance: bray
Dimensions: 2
-Stress: 0.1183186
+Stress: 0.1192678
Stress type 1, weak ties
-Two convergent solutions found after 4 tries
+Two convergent solutions found after 1 tries
Scaling: centring, PC rotation, halfchange scaling
Species: expanded scores based on ‘dune’
\end{Soutput}
@@ -296,7 +291,7 @@ variables using permutation tests:
***VECTORS
NMDS1 NMDS2 r2 Pr(>r)
-A1 0.96473 0.26325 0.3649 0.017 *
+A1 0.99008 0.14052 0.3798 0.021 *
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Permutation: free
@@ -306,14 +301,14 @@ Number of permutations: 999
Centroids:
NMDS1 NMDS2
-ManagementBF -0.4534 -0.0103
-ManagementHF -0.2635 -0.1282
-ManagementNM 0.2957 0.5790
-ManagementSF 0.1506 -0.4670
+ManagementBF -0.4474 -0.0193
+ManagementHF -0.2689 -0.1256
+ManagementNM 0.2976 0.5798
+ManagementSF 0.1502 -0.4654
Goodness of fit:
r2 Pr(>r)
-Management 0.4134 0.009 **
+Management 0.4134 0.01 **
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Permutation: free
@@ -342,12 +337,12 @@ Link function: identity
Formula:
y ~ s(x1, x2, k = 10, bs = "tp", fx = FALSE)
-<environment: 0x6e6fa00>
+<environment: 0x7b18f20>
Estimated degrees of freedom:
-1.59 total = 2.59
+1.62 total = 2.62
-REML score: 41.58727
+REML score: 41.42642
\end{Soutput}
\end{Schunk}
\begin{figure}
@@ -486,8 +481,8 @@ Number of permutations: 199
Model: cca(formula = dune ~ A1 + Management, data = dune.env)
Df ChiSquare F Pr(>F)
-A1 1 0.22476 2.5245 0.025 *
-Management 3 0.55502 2.0780 0.010 **
+A1 1 0.22476 2.5245 0.010 **
+Management 3 0.55502 2.0780 0.005 **
Residual 15 1.33549
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
@@ -508,8 +503,8 @@ Number of permutations: 199
Model: cca(formula = dune ~ A1 + Management, data = dune.env)
Df ChiSquare F Pr(>F)
-A1 1 0.17594 1.9761 0.06 .
-Management 3 0.55502 2.0780 0.01 **
+A1 1 0.17594 1.9761 0.050 *
+Management 3 0.55502 2.0780 0.005 **
Residual 15 1.33549
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
@@ -530,9 +525,9 @@ Number of permutations: 499
Model: cca(formula = dune ~ A1 + Management, data = dune.env)
Df ChiSquare F Pr(>F)
CCA1 1 0.31875 3.5801 0.002 **
-CCA2 1 0.23718 2.6640 0.004 **
-CCA3 1 0.13217 1.4845 0.102
-CCA4 1 0.09168 1.0297 0.390
+CCA2 1 0.23718 2.6640 0.006 **
+CCA3 1 0.13217 1.4845 0.120
+CCA4 1 0.09168 1.0297 0.426
Residual 15 1.33549
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
@@ -585,8 +580,8 @@ Number of permutations: 499
Model: cca(formula = dune ~ A1 + Management + Condition(Moisture), data = dune.env)
Df ChiSquare F Pr(>F)
-A1 1 0.11543 1.4190 0.122
-Management 3 0.39543 1.6205 0.012 *
+A1 1 0.11543 1.4190 0.112
+Management 3 0.39543 1.6205 0.014 *
Residual 12 0.97610
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
@@ -612,8 +607,8 @@ Number of permutations: 499
Model: cca(formula = dune ~ A1 + Management + Condition(Moisture), data = dune.env)
Df ChiSquare F Pr(>F)
-A1 1 0.11543 1.4190 0.242
-Management 3 0.39543 1.6205 0.002 **
+A1 1 0.11543 1.4190 0.256
+Management 3 0.39543 1.6205 0.006 **
Residual 12 0.97610
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
diff --git a/vignettes/vegan.bib b/vignettes/vegan.bib
index 4e82c52..d5a1f71 100644
--- a/vignettes/vegan.bib
+++ b/vignettes/vegan.bib
@@ -1,4 +1,22 @@
+ at Article{OHara05,
+ author = {R. B. O'Hara},
+ title = {Species richness estimators: how many species can
+ dance on the head of a pin},
+ journal = {Journal of Animal Ecology},
+ year = 2005,
+ volume = 74,
+ pages = {375--386}}
+
+ at Article{Good53,
+ author = {I. J. Good},
+ title = {The population frequencies of species and the
+ estimation of population parameters},
+ journal = {Biometrika},
+ year = 1953,
+ volume = 40,
+ pages = {237--264}}
+
@Article{ChiuEtal14,
author = {C. H. Chiu and Y. T. Wang and B. A. Walther and
A. Chao},
@@ -248,7 +266,7 @@
}
@Article{Tothmeresz95,
- author = {B. Tothmeresz},
+ author = {B. T{\'o}thm{\'e}r{\'e}sz},
title = {Comparison of different methods for diversity ordering},
journal = {Journal of Vegetation Science},
year = 1995,
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/r-cran-vegan.git
More information about the debian-med-commit
mailing list