[med-svn] [r-cran-vegan] 01/03: Imported Upstream version 2.0-9
Charles Plessy
plessy at alioth.debian.org
Tue Oct 15 10:43:26 UTC 2013
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 b8ffbea155830c713ecaf1270104c01952349aad
Author: Charles Plessy <plessy at debian.org>
Date: Tue Oct 15 19:38:11 2013 +0900
Imported Upstream version 2.0-9
---
.Rinstignore | 5 -
DESCRIPTION | 23 +-
MD5 | 187 +++++-----
NAMESPACE | 5 +-
R/adipart.default.R | 2 +-
R/anova.ccabyaxis.R | 3 +-
R/as.mlm.cca.R | 4 -
R/as.mlm.rda.R | 4 -
R/betadisper.R | 15 +-
R/betadiver.R | 9 +-
R/capscale.R | 2 -
R/density.anosim.R | 1 -
R/densityplot.oecosimu.R | 1 -
R/eigenvals.R | 14 +-
R/hiersimu.default.R | 2 +-
R/indpower.R | 2 +-
R/intersetcor.R | 3 -
R/multipart.default.R | 2 +-
R/oecosimu.R | 4 +-
R/ordiArrowTextXY.R | 27 ++
R/ordicloud.R | 1 -
R/ordilabel.R | 4 -
R/ordipointlabel.R | 8 +-
R/ordiresids.R | 1 -
R/ordisplom.R | 1 -
R/ordisurf.R | 122 +++++--
R/orditkplot.R | 3 -
R/ordixyplot.R | 1 -
R/plot.cca.R | 3 +-
R/plot.envfit.R | 94 ++---
R/plot.ordipointlabel.R | 11 +
R/plot.ordisurf.R | 6 +-
R/plot.poolaccum.R | 1 -
R/plot.radfit.frame.R | 1 -
R/plot.renyi.R | 1 -
R/plot.renyiaccum.R | 1 -
R/prepanel.ordi3d.R | 2 +-
R/print.betadisper.R | 11 +-
R/print.oecosimu.R | 4 +-
R/print.vectorfit.R | 5 +-
R/radlattice.R | 1 -
R/raupcrick.R | 2 +-
R/stressplot.R | 22 +-
R/text.cca.R | 2 +-
R/vegandocs.R | 9 +-
R/vegdist.R | 2 +-
build/vignette.rds | Bin 0 -> 289 bytes
inst/ChangeLog | 53 ++-
inst/NEWS.Rd | 54 ++-
inst/doc/FAQ-vegan.pdf | Bin 146861 -> 148690 bytes
inst/doc/NEWS.html | 64 +++-
inst/doc/decision-vegan.R | 152 ++++++++
inst/doc/decision-vegan.Rnw | 167 ++++-----
inst/doc/decision-vegan.pdf | Bin 281477 -> 319750 bytes
inst/doc/diversity-vegan.R | 254 ++++++++++++++
inst/doc/diversity-vegan.Rnw | 311 ++++++++---------
inst/doc/diversity-vegan.pdf | Bin 308847 -> 358270 bytes
inst/doc/intro-vegan.R | 195 +++++++++++
inst/doc/intro-vegan.Rnw | 76 ++--
inst/doc/intro-vegan.pdf | Bin 169289 -> 237324 bytes
inst/doc/vegan.bib | 99 ------
inst/doc/veganjss.sty | 24 --
man/SSarrhenius.Rd | 4 +-
man/adipart.Rd | 4 +-
man/adonis.Rd | 3 +-
man/anova.cca.Rd | 5 +-
man/betadisper.Rd | 35 +-
man/cca.Rd | 4 +-
man/clamtest.Rd | 2 +-
man/density.adonis.Rd | 7 +-
man/eventstar.Rd | 2 +-
man/make.cepnames.Rd | 2 +-
man/mantel.correlog.Rd | 3 +-
man/model.matrix.cca.Rd | 4 +-
man/monoMDS.Rd | 2 +-
man/mrpp.Rd | 4 +-
man/multipart.Rd | 2 +-
man/nobs.adonis.Rd | 2 +-
man/oecosimu.Rd | 9 +-
man/ordipointlabel.Rd | 31 +-
man/ordistep.Rd | 2 +-
man/ordisurf.Rd | 199 ++++++++---
man/pcnm.Rd | 6 +-
man/prc.Rd | 2 +-
man/predict.cca.Rd | 2 +-
man/radfit.Rd | 2 +-
man/specaccum.Rd | 4 +-
man/varpart.Rd | 92 ++---
man/vegan-internal.Rd | 7 +
man/vegan-package.Rd | 3 +-
man/vegdist.Rd | 2 +-
vignettes/.install_extras | 2 +
{inst/doc => vignettes}/FAQ-vegan.pdf | Bin 146861 -> 148690 bytes
{inst/doc => vignettes}/FAQ-vegan.texi | 31 +-
{inst/doc => vignettes}/Makefile | 4 +-
{inst/doc => vignettes}/NEWS.html | 64 +++-
{inst/doc => vignettes}/decision-vegan.Rnw | 167 ++++-----
{inst/doc => vignettes}/decision-vegan.tex | 246 +++++++------
{inst/doc => vignettes}/diversity-vegan.Rnw | 311 ++++++++---------
{inst/doc => vignettes}/diversity-vegan.tex | 500 ++++++++++++++-------------
{inst/doc => vignettes}/intro-vegan.Rnw | 76 ++--
{inst/doc => vignettes}/intro-vegan.tex | 183 +++++-----
vignettes/vegan.bib | 356 +++++++++++++++++++
vignettes/vegan.sty | 47 +++
104 files changed, 2947 insertions(+), 1569 deletions(-)
diff --git a/.Rinstignore b/.Rinstignore
deleted file mode 100644
index d116eff..0000000
--- a/.Rinstignore
+++ /dev/null
@@ -1,5 +0,0 @@
-Makefile
-.*tex$
-.*sty$
-.*bib$
-.*texi$
diff --git a/DESCRIPTION b/DESCRIPTION
index beb5e1d..af1ee72 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -1,19 +1,18 @@
Package: vegan
Title: Community Ecology Package
-Version: 2.0-7
-Date: March 19, 2013
-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
+Version: 2.0-9
+Date: September 25, 2013
+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
Maintainer: Jari Oksanen <jari.oksanen at oulu.fi>
-Depends: permute
-Imports: lattice
-Suggests: MASS, mgcv, lattice, cluster, scatterplot3d, rgl, tcltk
-Description: Ordination methods, diversity analysis and other functions
- for community and vegetation ecologists.
+Depends: permute, lattice, R (>= 2.14.0)
+Suggests: MASS, mgcv, cluster, scatterplot3d, rgl, tcltk
+Description: Ordination methods, diversity analysis and other
+ functions for community and vegetation ecologists.
License: GPL-2
URL: http://cran.r-project.org, http://vegan.r-forge.r-project.org/
-Packaged: 2013-03-19 11:34:07 UTC; jarioksa
+Packaged: 2013-09-25 07:30:17 UTC; jarioksa
NeedsCompilation: yes
Repository: CRAN
-Date/Publication: 2013-03-19 16:04:57
+Date/Publication: 2013-09-25 09:56:27
diff --git a/MD5 b/MD5
index 1ec737a..30e6e35 100644
--- a/MD5
+++ b/MD5
@@ -1,5 +1,5 @@
-4118da91bd5fe845079424bf0750a660 *DESCRIPTION
-e4c6f26e26e7f8e31b4e4a30d13d467e *NAMESPACE
+2115d26f94d5b10c4a7c8bd4caa31e54 *DESCRIPTION
+717b1fe683786bc702d85368b504bc38 *NAMESPACE
4b8531b446af54510e5fb31f841aed2f *R/AIC.radfit.R
5c5fdbcdc2a38e2cbafdb8f2c5eb2e08 *R/CCorA.R
6592cf7dc692f87b4a147eb625e18624 *R/MDSrotate.R
@@ -13,14 +13,14 @@ d80688d78aba3cd9367ffaaaec6ec252 *R/TukeyHSD.betadisper.R
a7e4a96ac08502dc4cd7023d0510e94f *R/add1.cca.R
bc63dc46c564df2dea69d90f25e52ba3 *R/ade2vegancca.R
3fea698281bc0b4c3a5ad26f4d44d0e2 *R/adipart.R
-ca2eae68396cb5a16355751efb906557 *R/adipart.default.R
+a8898cc23b1b831ea783c6a257c2d2a0 *R/adipart.default.R
05387ee9e552fcec123b4b922e837eaa *R/adipart.formula.R
39805e701d7a10abe111056a5b8afcfe *R/adonis.R
38726b7dad817378b3fc41094c11595a *R/alias.cca.R
fa03b3668c0435eebc778b9def908be9 *R/anosim.R
a4f23289c4a5eab2a3587292b306d497 *R/anova.betadisper.R
a3767eb78bd5d62341ff198fbf65d1b1 *R/anova.cca.R
-363461c0bab2687ece5bf521398db928 *R/anova.ccabyaxis.R
+39899a9935779881f1d34f727f58ca3b *R/anova.ccabyaxis.R
350cc1a6e930a195c80b5c7aef0d9b7e *R/anova.ccabymargin.R
145b004abb6a5dca32fc8f60338af590 *R/anova.ccabyterm.R
97cbe54d0f4f7adee7a20b6c982d1ecf *R/anova.ccanull.R
@@ -29,15 +29,15 @@ a3767eb78bd5d62341ff198fbf65d1b1 *R/anova.cca.R
eee49f0fce625a3b8266b82f05c86aac *R/as.mcmc.oecosimu.R
cfaa7dc7d3f45c29e59e83326f1371d4 *R/as.mcmc.permat.R
ee820c6d748d3aaa26d7412ea11128aa *R/as.mlm.R
-1d5f7f86bb0ed985c087814c83af64ed *R/as.mlm.cca.R
-0e281c0ea391184e4fff1dd90dc5129a *R/as.mlm.rda.R
+340f6a922578c8965803c63e08c5abbf *R/as.mlm.cca.R
+ec4c60b2bae11116b56946b136a78ed0 *R/as.mlm.rda.R
a7f01bd69394d5554cf10279a2690080 *R/as.preston.R
50aa2e700cc26301885d9ef7ca7f12c4 *R/as.rad.R
124345e75a121a5d750d1b306156614a *R/as.ts.oecosimu.R
251aa91b87e2f964f24fe61791eedac9 *R/as.ts.permat.R
fbec6d133dea10372ce082c7035a8ab2 *R/beals.R
-d25853e603f6af59234db7714c55f71f *R/betadisper.R
-92d22ad6b8870005ed86940cd90f2077 *R/betadiver.R
+2c609113eb4b410f4dd7da61c74564c4 *R/betadisper.R
+0228981546980ab73c8346a0292fa98d *R/betadiver.R
46ae3f75a0b483fecab589637d72a307 *R/bgdispersal.R
4603ea944d470a9e284cb6cab6d75529 *R/bioenv.R
4018f8ddbc314125dbd17d44f710147e *R/bioenv.default.R
@@ -56,7 +56,7 @@ b3ec7384552e94c46102d26e38c40538 *R/cIndexKM.R
a6df607186ceb18d204494b6a33816d4 *R/calibrate.R
f093f401495379d30354e6424606190a *R/calibrate.cca.R
f56b52d53b17c7dc8d8c9accd5a3401a *R/calibrate.ordisurf.R
-d2de008e9d603d4a7fdc1e2fcccecd51 *R/capscale.R
+907e5f013ace197de05c884e71c79563 *R/capscale.R
bbff0e97ac052b1742a0e4ba082bac68 *R/cascadeKM.R
2e09a82ec52e211afc2ac6e8d4b40898 *R/cca.R
22fd69d812ee7dbaf9b23d6774ab0883 *R/cca.default.R
@@ -75,9 +75,9 @@ d0f10f160ac99ba936824a49c608868a *R/cophenetic.spantree.R
edee3aaced61290b219985d0ce69155c *R/coverscale.R
1b1a6343072d69c5ccbf9a72ba068cbd *R/decorana.R
1169ef2aa4cd76c33c6166b1b253a665 *R/decostand.R
-72e1985e74ccaf8785e7d6b6f2005018 *R/density.anosim.R
+476dabb4b68409249d28557129ff3d6c *R/density.anosim.R
4a13947927b175862e2266ff9589f2a0 *R/density.oecosimu.R
-b18236e376b3e0fb38faa1cf10139f30 *R/densityplot.oecosimu.R
+f15615231f0bcad3a68ab7d718968251 *R/densityplot.oecosimu.R
e5b54fa580331ab24d28dc59110c45fe *R/designdist.R
8fb0105cb21a5e425f72e0085fa669a2 *R/deviance.cca.R
52f41185396ddd9acdcee9df7298d65a *R/deviance.rda.R
@@ -87,7 +87,7 @@ cafeabc2133997b3381c9edf6a971abf *R/distconnected.R
00136d6f9d6dd5ca16db7633eceb4e92 *R/downweight.R
064822fa2240075d55e6f19fa10fc07b *R/drop1.cca.R
79c66a10794aacaf08f1d28192228bea *R/eigengrad.R
-f969318c513ddbc66982b7e7da8f3769 *R/eigenvals.R
+be739eb24b369efbdaefa03537a5418c *R/eigenvals.R
17a62527ee103c09bfba0c851ab12560 *R/envfit.R
6e63b5fff3b7e834694b8adbdb6c6070 *R/envfit.default.R
fe12ea2872df48afc72f59efd3c50c4f *R/envfit.formula.R
@@ -115,14 +115,14 @@ bdb5429c7c23d1f730c5c7c938fb5e09 *R/fitted.radfit.R
8a767726c40223a58d4055759bf41efe *R/head.summary.cca.R
d17f4f6be45b52e01cd605b09b56a80a *R/hierParseFormula.R
3d19236ee5dd2f1c678061773895e86f *R/hiersimu.R
-5c12aa3da8e9ed06db19bad2f1eea41a *R/hiersimu.default.R
+ab36d3e113a35b8e53a475d1e8190072 *R/hiersimu.default.R
edf53c3358944421756412b991432bd7 *R/hiersimu.formula.R
d02fc9c672a9b2c4a31065702a3381be *R/humpfit.R
1637bd10b39801c14b65656f29dafcf1 *R/identify.ordiplot.R
-ba2579e418e11343a471548b2f2bc44a *R/indpower.R
+34d3e11d35b2fbff759d2bb78c249814 *R/indpower.R
6d30d57bbf47d448d0c267964ad7233a *R/inertcomp.R
bf423cb7cf07abc3a4c64229bcc8fc14 *R/initMDS.R
-3e3b885b1b13cd00a947c06a6689e773 *R/intersetcor.R
+8de3472b9c7eb28d00cf34b9a7d95587 *R/intersetcor.R
c63972a171f76f92652feeb2daf30e82 *R/isomap.R
1e167e69edcee4aa651d97bef81b31e9 *R/isomapdist.R
5abdcd58cf3811e482543d5207114331 *R/kendall.global.R
@@ -151,7 +151,7 @@ beae6832197823e4ade3569c021b1693 *R/mrpp.R
0c8ef224eeeb965c8b60bb63d5adf10e *R/mso.R
7e428f1adfdae287a1d64a79c6f2c3bc *R/msoplot.R
7c219818ce5841e957db47f16986080b *R/multipart.R
-dad9c4679ae4febe6d17af0829b282f0 *R/multipart.default.R
+d8f736c5fce5c8950406ae6d434c9578 *R/multipart.default.R
4f3e2c82d5783c04f9a50761c82e2f02 *R/multipart.formula.R
f5e79cb1c2dc1fcabb6e6b5cb4dc0828 *R/nestedbetasor.R
85d4744650c1e2a0edf16809b77f7ab4 *R/nestedchecker.R
@@ -161,37 +161,38 @@ e65023174f4ce8874a2f88f332af5a37 *R/nestedn0.R
cf4c7acbbf20366f629dee40c9203764 *R/nestedtemp.R
74b2723851155de631716fa479f8ea38 *R/no.shared.R
47973ff187f68836a19d20ea37c60868 *R/nobs.R
-dfc5c85777c1dbc55b850dc1ccbf115a *R/oecosimu.R
+2c24d7eeb78c8149275ce5b6b3c3bd88 *R/oecosimu.R
7b3988a207ecfe1ea574c5857ffcd2a3 *R/orderingKM.R
e3d108eed97633040fa22c2b384e19e4 *R/ordiArgAbsorber.R
d2d5d94504676e6b1edf25b0c024edf3 *R/ordiArrowMul.R
+898781983832b0c3fef8319a53f4979e *R/ordiArrowTextXY.R
da71b576fb9908051a545375e14a80e0 *R/ordiGetData.R
99c1ec285e2afe4fb8beccbd507a123e *R/ordiNAexclude.R
b78b985ccd7179b59e031bce191354da *R/ordiParseFormula.R
119f2a2cb24ca7a63c8ee591b50d8ecf *R/ordiR2step.R
7757339f5b8899cb54f13da274abda66 *R/ordiTerminfo.R
e06d56a6e7d47767b9e71a73cbd3a80b *R/ordiarrows.R
-76020bb8174d580dd0f4866df2172339 *R/ordicloud.R
+85f3047b80ab9a2ea57dd7935d07b583 *R/ordicloud.R
793f91b9bf7c35f335949121d6f317c9 *R/ordicluster.R
7160bf241bdbe59c1145160435b274ae *R/ordiellipse.R
c253906529c77aead16b293275f1afc3 *R/ordigrid.R
9ca9cd415622e47453a06897e2fde751 *R/ordihull.R
-b8841b7492a95f04da5952d06da72e3f *R/ordilabel.R
+b64fd4746b6f8c8c792d84be677c6b4b *R/ordilabel.R
20a6f500c31e6640de535f0730b69a55 *R/ordilattice.getEnvfit.R
c805e6801ef30758b9f7718269cabdfc *R/ordimedian.R
55d2f18681d065ea6dd29e0f1e64772e *R/ordiplot.R
58a7e6f3453b1d95e1984c392577d4a8 *R/ordiplot3d.R
-fc7bc36cc7cf7f4280f071c831a8a6a6 *R/ordipointlabel.R
-9d2a860c9143446f950755327af2f7ce *R/ordiresids.R
+158797cbb1ac53db1869003dfe400aef *R/ordipointlabel.R
+e57a2b904e572829a5fd97f5b6576644 *R/ordiresids.R
601554e97800197af1bc50993406d9ef *R/ordirgl.R
41949d4c859f08bc5a978791d387d1a4 *R/ordisegments.R
6766b4753ea23da33975045e3943262d *R/ordispider.R
-bfabbea279d3586a727ab576c981d028 *R/ordisplom.R
+1de439b5ffaf18640e08fadcaf7193ee *R/ordisplom.R
2d233485d1aa0b604f1949c2a3691f61 *R/ordistep.R
-9511ac94227ca4c517afcaa335ccf510 *R/ordisurf.R
-1951a3f4c16c9d500145a17b293083cd *R/orditkplot.R
+d83970050d2430b1aca11d9bd4a6cb5d *R/ordisurf.R
+023ff6234cccb988d4bccd2e79b15f64 *R/orditkplot.R
bc3671e5b7a30e2849d3b59f65783c97 *R/orditorp.R
-7148d283d2447ac65146d5e3237b0a9a *R/ordixyplot.R
+5a99010a09cd4a018b02d397be8cc4ec *R/ordixyplot.R
c53e9402a842833d80a8df39c0adee6f *R/orglpoints.R
56c4036863990ae0ec88a8d459540fd0 *R/orglsegments.R
7ea9d2eb332869c020abe77e3ac6e416 *R/orglspider.R
@@ -212,11 +213,11 @@ f7c8d52c791489d956a7fd833913f242 *R/plot.MOStest.R
58d63201c7f61f455b0394b7a0e1235d *R/plot.betadisper.R
de416206dba5566d70080bc14e86382e *R/plot.betadiver.R
9023fd332556779fe9405e0714ec5dae *R/plot.cascadeKM.R
-d6efc684c3506870243a337fadd85ed8 *R/plot.cca.R
+a16f29fa9be2c7592458130b6b93482b *R/plot.cca.R
38ccde16c9eb9028219d27f14d343b3e *R/plot.clamtest.R
8c043a9b7262c33ec2054045cdaa1811 *R/plot.contribdiv.R
0ab3b62ac155ede193867f43640dbd34 *R/plot.decorana.R
-090911b19b4659e69ba80dab85bc7ff7 *R/plot.envfit.R
+e9ad6e3db90cdebb2e5852dc016afc2b *R/plot.envfit.R
10bf121300b684a8173f680de54f452a *R/plot.fisherfit.R
9a4f1746e6e5b80b48994f404e72eb74 *R/plot.humpfit.R
ed258eefbe3facce3533a16395217fab *R/plot.isomap.R
@@ -224,10 +225,11 @@ ed258eefbe3facce3533a16395217fab *R/plot.isomap.R
45b6355daaa38bdd65f98fca234869ed *R/plot.meandist.R
aeddafb96f777e9905a1c4660ed3cadc *R/plot.metaMDS.R
2574a84757435e0594f89434a9f4ec82 *R/plot.nestedtemp.R
-fdfbb536547823f1c25bcf756c33d19d *R/plot.ordisurf.R
+df06e0f9bd4bc8a546adf466c6daeca6 *R/plot.ordipointlabel.R
+8552a3f2a039f2e18167b8cd301a3b79 *R/plot.ordisurf.R
da30b6ae5fd0e30543f18064cf19b54a *R/plot.orditkplot.R
7e136913597f9f78ac069be6a5a3f465 *R/plot.permat.R
-90fd0b03484169b406eeac09c33cb75e *R/plot.poolaccum.R
+38e6ae320c35fe9d9fbc32c5bf4d5880 *R/plot.poolaccum.R
fdc1beae72f52a43883861a8b56bf289 *R/plot.prc.R
6cd9c1a91d03a8afb8f9148f0d369cad *R/plot.preston.R
31b95161a7558e111e3c01778b9d17db *R/plot.prestonfit.R
@@ -235,10 +237,10 @@ fdc1beae72f52a43883861a8b56bf289 *R/plot.prc.R
c7e5c6d58944d75ab6dac163e051769f *R/plot.profile.fisherfit.R
02ff38f3fb337a63534356255b8641a9 *R/plot.rad.R
fc2dc1b63ae6f50067a7a376c736394b *R/plot.radfit.R
-97e04e44547a38580a988bbd684e4cb3 *R/plot.radfit.frame.R
+af0dac1922ddd4eac1090ba1dd5b1089 *R/plot.radfit.frame.R
360dec911e8d4e772f888d89b8e0f6f7 *R/plot.radline.R
-8da525de886af7ced0065ecc8add6fa9 *R/plot.renyi.R
-fc8b4dc932acc72ed789278055077b88 *R/plot.renyiaccum.R
+08f6b41506125e27b37a08b3bb730ffb *R/plot.renyi.R
+90046d0d152cdca37f7868aa61fad5c2 *R/plot.renyiaccum.R
e71b966111f99c7048ebbe26c1aa6a12 *R/plot.spantree.R
e449c6ef786f8802c9806b51248b66cc *R/plot.specaccum.R
abc96c8853871035d494dfa9086d4d6e *R/plot.taxondive.R
@@ -263,14 +265,14 @@ e9107f2a97c429ff8e45c62a3671c281 *R/predict.fitspecaccum.R
35a61b21f7ff4d24451aff811add56d7 *R/predict.rda.R
eb223fbfded71ae4f0b374c1e92c3f2e *R/predict.specaccum.R
4f56d16f5bf8f9af3477c23137a70fb5 *R/pregraphKM.R
-32d5ccabf03e23941fe3dcb2182b5c8f *R/prepanel.ordi3d.R
+81bb150e264f7da07989c909f4531a45 *R/prepanel.ordi3d.R
0bb3fa9e3847051a28ceb186023bb952 *R/prestondistr.R
7db2fd99abc08bf5e1341e5b74fb4617 *R/prestonfit.R
953d32321b6e12a30209a8cda78244c9 *R/print.CCorA.R
3a1584c7d991683a61271fb2fc002b73 *R/print.MOStest.R
1e07dd6a9eefb1d0af31a4db98c94305 *R/print.adonis.R
15b31674cb74df69467902853a9254d1 *R/print.anosim.R
-7c99a949e155f76c3a223741afb39836 *R/print.betadisper.R
+a530724906dc69888c27a538fc388cbf *R/print.betadisper.R
2945b0c68fb04cb2c7dc460a419c5478 *R/print.bioenv.R
528c225f34769670a4a3049a0e29ae59 *R/print.capscale.R
f757010a0187dc81e9b844df25c58640 *R/print.cca.R
@@ -291,7 +293,7 @@ eed481e994c01ec4d7b443fb8cafad46 *R/print.nesteddisc.R
91c6a9b43c8b045d11a4b8834d1c9d47 *R/print.nestedn0.R
0f8e3935f95b67b96e066435743bbee0 *R/print.nestednodf.R
2f1732fffc2fb487420a910a1d3f5971 *R/print.nestedtemp.R
-58402a74333f1bd193dc7706f930a1b9 *R/print.oecosimu.R
+32edebf47fbb4b3a0afd92ab56bd5de5 *R/print.oecosimu.R
faf2620b1fbaec410af7b6e3159510ce *R/print.permat.R
575da3562c07c6324e84288ac603b011 *R/print.permutest.betadisper.R
f0c12622e4f250aacca5b7fabe54cbd1 *R/print.permutest.cca.R
@@ -317,7 +319,7 @@ b3eb24e4b56838e9db1811c07d37a571 *R/print.summary.permat.R
0511b5e09f1af985431cac7c1b74a8cf *R/print.taxondive.R
46680885c99c48e4bc5d84203c40d4b0 *R/print.varpart.R
c80f3931f05ab3066dfe93b98e737856 *R/print.varpart234.R
-189ac58ee6b91e4e40ef0b89012b8ed6 *R/print.vectorfit.R
+326bb34df103cb26cadae2ba06b580b3 *R/print.vectorfit.R
8917f5ef5398c984e0e2675c83e74c5c *R/print.wcmdscale.R
083d526f54611d40ce749ffe95f169ae *R/procrustes.R
819af0297e5d0a907f7fa91319c67e96 *R/profile.MOStest.R
@@ -332,11 +334,11 @@ b129148e6efbbe1c45482c93d66f959b *R/rad.null.R
23fd677c0c8d6f4a8e6c6444d2cc8601 *R/radfit.R
235a5213c266f1b2101c767ad1528888 *R/radfit.data.frame.R
2f6d8082f39540bbe7cf0e0cf3c666c9 *R/radfit.default.R
-1241d5e79bd4e9a9fbeb6a4bf4c86023 *R/radlattice.R
+36cfb246e391a7434c714fbb2269cdb6 *R/radlattice.R
33e294ffd0c75b25d36d18d4a3ad9884 *R/rankindex.R
0a7c015a3700b34f29cb6bb0b94f68d2 *R/rarecurve.R
6be7a6edec618f464dd7c783eca371f0 *R/rarefy.R
-bf743ab0025f40797f607ce38b6e3636 *R/raupcrick.R
+9bea5153ae57e1c729623f59b9395415 *R/raupcrick.R
8116cefb40383fb571abb9fb82091087 *R/rda.R
f9008aa5cf3109a3607aca9ac6bfe8d7 *R/rda.default.R
90b562e8a94febce8430a344392a2943 *R/rda.formula.R
@@ -378,7 +380,7 @@ e1857ce9bf27f6a66ab2d0f7a2c05478 *R/specaccum.R
77cc19684e9ceb27500ca7f802923328 *R/specpool2vect.R
2cf0545588fb2bb86185f71c21bda1c5 *R/spenvcor.R
33d884aae53dcc5fa80d9e9ffae4515e *R/stepacross.R
-30cd106b7947532f7eb5969d7a864f40 *R/stressplot.R
+8a9ad6d02dc566d954f3426f600ebf19 *R/stressplot.R
a61ce658c68a8b17e094f7b0040e4efe *R/summary.anosim.R
7145185243348b4a1be616329b87b9ff *R/summary.bioenv.R
772628c3a5de67f983d6ba15d8274b40 *R/summary.cca.R
@@ -400,7 +402,7 @@ a8c1bf3d3f371f3ee5a3de3c39a4113a *R/summary.procrustes.R
f1530a301997e88e27e2eb072e295515 *R/tabasco.R
62bc8a0693a71adb1457b0a102d8951a *R/taxa2dist.R
90ec6192eb43f8fd29bc93485f4ef293 *R/taxondive.R
-f94b7781111e04de4ae1f7df67003ca2 *R/text.cca.R
+dcfdf0eb68a8acfa6a8b0cfb6fcac0f5 *R/text.cca.R
1f4d9ba97695c0fa99456f427114b049 *R/text.decorana.R
6a6e426f6e464bb7bdaa75d92674562c *R/text.metaMDS.R
974bdc93cd9b352d30debf3e93111136 *R/text.ordiplot.R
@@ -420,8 +422,8 @@ a0682e3051c01f8f5823b158c018d18f *R/varpart.R
7695b046ee79a9b3140a22d2bed6e048 *R/vegan-defunct.R
b43aca5a7abcce2f36629ed4036add72 *R/vegan-deprecated.R
722ab25ac95b6c419b29a94347916f23 *R/veganCovEllipse.R
-c33a08b31fabd66594d97a4362c85534 *R/vegandocs.R
-5be53abd0d608c314dc6a9f071bd676d *R/vegdist.R
+a3b54cd895f7ef425d2827501f03a1ff *R/vegandocs.R
+916e31172356ad50ea304e46570cddbc *R/vegdist.R
cbf0bc1d54508fe56afcc8bd789abd77 *R/vegemite.R
5d6047d7f63f04ae9ff40179c534aa0b *R/veiledspec.R
1f6deab4b61a9be48be43e80703cd4b6 *R/vif.cca.R
@@ -432,6 +434,7 @@ ecfd48e2f4df6bcd683a87203dd80e12 *R/weights.cca.R
73babeed9df14635d99b1a619a1286e4 *R/weights.rda.R
4138f57726620d493f218e5e3da0013c *R/wisconsin.R
17cbf4b5c186fe577cf361f0254df1d6 *R/zzz.R
+b0c5bd6da3c6d704eaf46677e2260ff1 *build/vignette.rds
b92ea8ce0eb1f5860d535645fd5286b7 *data/BCI.rda
31eb8ea8153321cb2a5e9040ef12d50f *data/dune.env.rda
51793132b98f7dd3c963f2500a190eaa *data/dune.rda
@@ -444,52 +447,48 @@ c51905bd025ccea2737527b6fca4a081 *data/mite.pcnm.rda
ee3c343418d7cf2e435028adf93205f1 *data/sipoo.rda
f87df84297865b5faf31e232e97a0f94 *data/varechem.rda
82153b3e47807b926b77cef49900f422 *data/varespec.rda
-bf2ad7c62163afdaa41ea336bdaeb88c *inst/ChangeLog
-ab9b7fd3e8cac85ace5c94673e9382b0 *inst/NEWS.Rd
+b8ebfd5ef9be13de19bc0d95e580989f *inst/ChangeLog
+d552d6c5e3a571ec56c062b6ef0ee7e7 *inst/NEWS.Rd
9abfab8b05c34dd283379a7d87500ffb *inst/ONEWS
-47feb16ee49ec7e6483eebb881fae159 *inst/doc/FAQ-vegan.pdf
-a901a5efa50b13f8ce50b95bada4a1b8 *inst/doc/FAQ-vegan.texi
-a712f5f699b09276e523f83ce3b731ae *inst/doc/Makefile
-262d0bb9e1efda623933fc1a42fd4b96 *inst/doc/NEWS.html
-bfad8283cb33e6e2837f62360671a014 *inst/doc/decision-vegan.Rnw
-e4946ba807e8c7db84096c9320a9b36a *inst/doc/decision-vegan.pdf
-027057d32bd1bb6baf990ecd9845711e *inst/doc/decision-vegan.tex
-51f01c074c07c22f3da55c597ca05d9a *inst/doc/diversity-vegan.Rnw
-b97571ad2b3609cd358903b951c1f869 *inst/doc/diversity-vegan.pdf
-50b65b4730835c95babdb6e5ed974868 *inst/doc/diversity-vegan.tex
-53ffe702420a71c3cbc8b8287b25fbfe *inst/doc/intro-vegan.Rnw
-3272a98bf658a5a396a0e3fb9182f52d *inst/doc/intro-vegan.pdf
-3d58488f31e30b1c80ac9755d7530784 *inst/doc/intro-vegan.tex
+e864afa3351b069bc8898598f7963a14 *inst/doc/FAQ-vegan.pdf
+e4063a155721a54563fbac418581ea77 *inst/doc/NEWS.html
+a6d028bb062957daf8ebbb3029dec88a *inst/doc/decision-vegan.R
+fce7a85b3e7f348fb12812758dc45d5c *inst/doc/decision-vegan.Rnw
+90b7617629e619ed07008f852283f6dd *inst/doc/decision-vegan.pdf
+74aeefa3177a897ea7c5ccfe67895c55 *inst/doc/diversity-vegan.R
+d0e8beedbfe2f77f8a6934e4a459674d *inst/doc/diversity-vegan.Rnw
+1c6eff24d295b56cf2530086b965253a *inst/doc/diversity-vegan.pdf
+99be07f681b826342c48620d57933b76 *inst/doc/intro-vegan.R
+66c024cfa42524d1649f7033286c52b0 *inst/doc/intro-vegan.Rnw
+c73caf3ecade23b1b318563c6130e464 *inst/doc/intro-vegan.pdf
a1c35ea488b715441cd2269eb6998945 *inst/doc/partitioning.pdf
-bafe698f5c543e20d4c52659545677bf *inst/doc/vegan.bib
-8790e1afcfbf88c374d6c87928eab54f *inst/doc/veganjss.sty
e2d32a2a53e75e8be60574c7e1cc3239 *man/BCI.Rd
33db614085aa448f4241cd79ddc62461 *man/CCorA.Rd
525d1213753747626c919c22d14073f5 *man/MDSrotate.Rd
fd218be03aa2591e5123d11780ccba1a *man/MOStest.Rd
f2823a48acb6f861404b6682b3f52a45 *man/RsquareAdj.Rd
-eb6df0e2eba46d2bbdc056baff276481 *man/SSarrhenius.Rd
+73f141f28a1aca961cd4e992d8610934 *man/SSarrhenius.Rd
d7499407f3dd1cc977ea094eaa2af35e *man/add1.cca.Rd
-f7a0445e698dc21782cd113d867f7142 *man/adipart.Rd
-88eaec1454840ff74dc06a22da6da672 *man/adonis.Rd
+ee4d14cea6c51078a02a43978f4f5e9d *man/adipart.Rd
+a2fa01618dd236031de91527f7902ce9 *man/adonis.Rd
0443d02a7f37af2e14e745c3c1eb3aee *man/anosim.Rd
-427787a2ec7a1cd49df31a08cfa1d74b *man/anova.cca.Rd
+79ade6b5344d65d7cb6b4306dde6576f *man/anova.cca.Rd
c57af27fa11dadcd48981fcf42b2d221 *man/as.mlm.Rd
8e3718248ff8d48e724654ab17caa2e2 *man/beals.Rd
-362efe66c82eee9e301f516cfb8ab25f *man/betadisper.Rd
+a90bf10d979c393a099a4ae3ccb0b18d *man/betadisper.Rd
1336f0afb69a05bee9f6e7706d81d038 *man/betadiver.Rd
b04c2fae35dba2d97cb248814d5e2fe9 *man/bgdispersal.Rd
890f6ec54dcf7962cbaa197ef7be8339 *man/bioenv.Rd
1eab4a6369fa1d203a4a3f41f4ee4c06 *man/biplot.rda.Rd
88602656153ee95f10335487273e132d *man/capscale.Rd
d3c1067cb5e4dc6f6b9a1c7d94e70ab5 *man/cascadeKM.Rd
-01df6d53d022485e95f39e7c29d2d61d *man/cca.Rd
+460a434181bc442836ad7f287289e815 *man/cca.Rd
97385598d1197eeaf8c987bf34329013 *man/cca.object.Rd
-0a27f941c844520672e5ca370fda6719 *man/clamtest.Rd
+3d77fcd7ce12271fcabbaf0f080c030c *man/clamtest.Rd
335d0f7691ad9d0c48fffce9f9db6201 *man/contribdiv.Rd
c41033fb9c572365490cc23b9870c950 *man/decorana.Rd
00a34002a7464d1008b2ba63526a4afe *man/decostand.Rd
-5a48fad137cfbbc09ff287edb5170542 *man/density.adonis.Rd
+bda32a146ba37c0193a850b9358e4ef8 *man/density.adonis.Rd
22e3451a1cc9e294c2ad0e1a4531b136 *man/designdist.Rd
c01e0664652fbc8ef4963059bee4e422 *man/deviance.cca.Rd
f58b474141a1b0fdf438bfe6dd8da0c9 *man/dispindmorisita.Rd
@@ -499,7 +498,7 @@ b9e1c696647b4029f944e830184eb2c9 *man/diversity.Rd
5bdeafda9c2d62feec3bde6b4cd49e3b *man/dune.taxon.Rd
5f5f8c7df063606ccde6124c5dbe8add *man/eigenvals.Rd
516c0b3d11d2746d15ead8919a35803c *man/envfit.Rd
-919976c144bda3a083af284255ea3695 *man/eventstar.Rd
+cffbfaef219e46846902deef9271bccd *man/eventstar.Rd
5b7ba3db111582ad3e1f646bc8061ea8 *man/fisherfit.Rd
841b3f32510ed2c3f64186d623f858ae *man/goodness.cca.Rd
4d5e44b51132481ab920292b2651041c *man/goodness.metaMDS.Rd
@@ -508,41 +507,41 @@ c8fea575af3da292987d4f8c4aa831b0 *man/indpower.Rd
cebefbf4e3090e7f7605c2f5ce303da2 *man/isomap.Rd
5f2c36639ab3e98a5fbb03bb8c8adda9 *man/kendall.global.Rd
e473a6d2589993b85fc1176866fdde78 *man/linestack.Rd
-a83cd418e2a052ea32ef431bce2e3787 *man/make.cepnames.Rd
+59ce2773a5d92535708137747a52f358 *man/make.cepnames.Rd
e8a27e8ace7bd56776794ebfd8391d64 *man/mantel.Rd
-f5db928e02639d251389edb1cd36ff13 *man/mantel.correlog.Rd
+54f6de61cde7c8bd03110cf1dd1358e1 *man/mantel.correlog.Rd
f0f939023236abf04e5af5e2a3652082 *man/metaMDS.Rd
4cfb02239809fa03b28e10ec8e8c9c6b *man/mite.Rd
-0d0876437491b3701e4d20cbbf0d1b6f *man/model.matrix.cca.Rd
-09bf57e9d9ae0178eca8facf3f9d20b7 *man/monoMDS.Rd
-6ebc1e9be42fd2ffc21f4d8a81512f91 *man/mrpp.Rd
+c50bd45c9e8c6e892d2dd8f7fe5f0bd9 *man/model.matrix.cca.Rd
+682de6d686378a35abbe1442129c1ce2 *man/monoMDS.Rd
+274abac4b2e57f30f1fb2bcb809c3c0f *man/mrpp.Rd
382e99ee5b67d89f2f9ad440236929f5 *man/mso.Rd
-56a812e640082ccf928224114330130b *man/multipart.Rd
+838a98b67e2015061513c32731732608 *man/multipart.Rd
646fcb9015f0f3dc520ab2be0db5c042 *man/nestedtemp.Rd
-2907c7465be1247d2ed930025b877403 *man/nobs.adonis.Rd
-ba28e7e71d0637fd962d53d1e23488c0 *man/oecosimu.Rd
+0746338956acbf265148314e40c37587 *man/nobs.adonis.Rd
+90239dffda8fb82e8e8f3e6b46b0be7a *man/oecosimu.Rd
3e6f6e4c473e4ea91c18d34bf487ff0c *man/ordiarrows.Rd
03aab4cb7ca71141281d2abd3e810231 *man/ordihull.Rd
8f8a34c5fcfcc1fe9f88ca16e84a1da6 *man/ordilabel.Rd
994cfc973f88c682b741e48377e1b9b4 *man/ordiplot.Rd
b88713c8f69a6a0e677d406b51d2062e *man/ordiplot3d.Rd
-ca2ed47e3adb6f4ab9aa861872b07e4b *man/ordipointlabel.Rd
+61d4e0e9ab3c3cd566d541f6954b0cda *man/ordipointlabel.Rd
d4d27a34b2e7d9d1b732a0d06cb9d9f4 *man/ordiresids.Rd
-6bd225981e288d67974938ac56fcc7cf *man/ordistep.Rd
-7b62153e759a450cfececacbd385cd63 *man/ordisurf.Rd
+2939ccc8e48c8c393ed8a8d6bd0ddd5d *man/ordistep.Rd
+4df251d6d187ce05663f58b0ef6fb742 *man/ordisurf.Rd
42dfa56db8adbd0a44e716086dee6d7d *man/orditkplot.Rd
8785cc44c56d1b24fbcbde8de9e325d5 *man/orditorp.Rd
d971701b3c6f89b3a6b358a3966a43d2 *man/ordixyplot.Rd
-59c7d8943e1e82c1ed771ee91eef3e66 *man/pcnm.Rd
+adc9628edf2079867649bbaa68daee53 *man/pcnm.Rd
864ed25d069da12a2226310240f1f740 *man/permatfull.Rd
807092c467db330149046d1dc9e9ab91 *man/permutations.Rd
fb24c58ca61caf767ced5bd79dbff57e *man/permutest.betadisper.Rd
47898b675bb6d36fce6961e6a70d8d57 *man/plot.cca.Rd
-9f296f0830397598ee4849fc006762d1 *man/prc.Rd
-165334d6ad139cadd36957afd6d10923 *man/predict.cca.Rd
+7b4d950fcf9d3f4591a217ae9b5ccf7e *man/prc.Rd
+37cad2f61855e0cc430943ac98885069 *man/predict.cca.Rd
80aa98f140babc312081f0a01ad3a77d *man/procrustes.Rd
01a6ca946df5ad493adfb54003ad8e00 *man/pyrifos.Rd
-26f6e755b8b18407ed6c30dbf7887533 *man/radfit.Rd
+f61f64cc1be643149fd02f08a0cd7f9f *man/radfit.Rd
3e70bfa0a8ae5d4c3c60dba77500b584 *man/rankindex.Rd
64342c9ea7e7b2607d433c3346f9726a *man/raupcrick.Rd
2867f5f71a47da498cbadf9aaa01b2b6 *man/read.cep.Rd
@@ -553,7 +552,7 @@ c1ffd9ca78ad968e1da11fdba007cbe8 *man/renyi.Rd
45cd418b2264b4eb6abc89cc11a7877f *man/simulate.rda.Rd
b34910fa6ed6c9bfbd90a7f7443a135f *man/sipoo.Rd
d7dd63e022633049766cffdaf6cac723 *man/spantree.Rd
-8d9d2fe132aaa595df4d7652dbe68c54 *man/specaccum.Rd
+ef48716a5ed02feeb8da58c293596362 *man/specaccum.Rd
53818a4edb1d52d425065bea76963021 *man/specpool.Rd
5b9e51c85395f80f8504954e4175f877 *man/stepacross.Rd
0aac5f5c8f58fc8fe1cb6c0ba819b196 *man/taxondive.Rd
@@ -561,13 +560,13 @@ d7dd63e022633049766cffdaf6cac723 *man/spantree.Rd
bfe306a0cb659930e17e46d191f7629f *man/treedive.Rd
5a1c08a3f35d82027259b3000e94cd2e *man/tsallis.Rd
033dd7d7917185cea81e4d7afcd59df9 *man/varechem.Rd
-be68944c43a32540e71a0e0b215be64b *man/varpart.Rd
+e7717c542e5c0372ca2ff71bcc26d8b0 *man/varpart.Rd
699122da39bdbbfbfeb6a1f8f078242c *man/vegan-defunct.Rd
c8e9610be158d93af56d7db754e560d9 *man/vegan-deprecated.Rd
-e8d8b52de649979b17b484d03775c5c0 *man/vegan-internal.Rd
-ec9c7e972e815897f61fb3fdd16a008b *man/vegan-package.Rd
+c0b323b085b93d3f57bac7f38a7868de *man/vegan-internal.Rd
+1798f9f9db805ac6e3a71c953eae8364 *man/vegan-package.Rd
f6f284ceb3b9a39e7b079936f9400cc2 *man/vegandocs.Rd
-197fe8ed2fe66db294381cb3c08325e1 *man/vegdist.Rd
+bb223296c8d1135c12cee29532d9e696 *man/vegdist.Rd
982fdb71847d8b7338c7effc5432027d *man/vegemite.Rd
c3209a8eff0fe638d3a43b25ea5bec16 *man/wascores.Rd
7d16b5020895bf5ead253010c733e7e5 *man/wcmdscale.Rd
@@ -581,3 +580,15 @@ e19f79f4b3fef915a3ece2db284475f6 *src/monoMDS.f
31bdbe9b08340e1662a62cf6e61ade6a *src/pnpoly.c
b9b647fcf8a3e59e10b9351fae60ec06 *src/stepacross.c
87233fad519f344865adfc74c92c2a1a *src/vegdist.c
+e864afa3351b069bc8898598f7963a14 *vignettes/FAQ-vegan.pdf
+7d9cb640d68ea4c935a7c3e1590c5532 *vignettes/FAQ-vegan.texi
+45ce50de9edf3aeacd8d11d1483f764c *vignettes/Makefile
+e4063a155721a54563fbac418581ea77 *vignettes/NEWS.html
+fce7a85b3e7f348fb12812758dc45d5c *vignettes/decision-vegan.Rnw
+ff9e75f6d8456d17109cb2f5ea2c8496 *vignettes/decision-vegan.tex
+d0e8beedbfe2f77f8a6934e4a459674d *vignettes/diversity-vegan.Rnw
+7e73ba0ba0eb2e798da23421c0b61b2f *vignettes/diversity-vegan.tex
+66c024cfa42524d1649f7033286c52b0 *vignettes/intro-vegan.Rnw
+45c079193646c54dec64b19556e623fc *vignettes/intro-vegan.tex
+0c229cd8dbde571130ff2f4b516414e5 *vignettes/vegan.bib
+fd58fa43e5e36d0ddcddd26dac1c7e31 *vignettes/vegan.sty
diff --git a/NAMESPACE b/NAMESPACE
index 58f6829..78ceafd 100644
--- a/NAMESPACE
+++ b/NAMESPACE
@@ -62,8 +62,10 @@ export(metaMDSrotate)
## Registration of S3 methods
import(stats)
import(graphics)
+import(lattice)
+import(permute)
importFrom(utils, head, tail)
-importFrom(lattice, densityplot)
+importFrom(tools, Rd2txt, startDynamicHelp)
## nobs only exists in R 2.13.0 -- import from permute with older R
if (getRversion() < "2.13.0") {
importFrom(permute, nobs)
@@ -254,6 +256,7 @@ S3method(plot, monoMDS)
S3method(plot, nestednodf)
S3method(plot, nestedtemp)
S3method(plot, ordisurf)
+S3method(plot, ordipointlabel)
S3method(plot, orditkplot)
S3method(plot, permat)
S3method(plot, poolaccum)
diff --git a/R/adipart.default.R b/R/adipart.default.R
index d3b8c20..28691f2 100644
--- a/R/adipart.default.R
+++ b/R/adipart.default.R
@@ -24,7 +24,7 @@ function(y, x, index=c("richness", "shannon", "simpson"),
## check proper design of the model frame
l1 <- sapply(rhs, function(z) length(unique(z)))
if (!any(sapply(2:nlevs, function(z) l1[z] <= l1[z-1])))
- stop("number of levels are inapropriate, check sequence")
+ stop("number of levels are inappropriate, check sequence")
rval <- list()
rval[[1]] <- rhs[,nlevs]
nCol <- nlevs - 1
diff --git a/R/anova.ccabyaxis.R b/R/anova.ccabyaxis.R
index aff4b18..86b533f 100644
--- a/R/anova.ccabyaxis.R
+++ b/R/anova.ccabyaxis.R
@@ -10,7 +10,8 @@
## Handle missing values in scores, both "omit" and "exclude" to
## match dims with data.
if (!is.null(object$na.action)) {
- u <- stats:::napredict.exclude(object$na.action, object$CCA$u)
+ u <- napredict(structure(object$na.action, class="exclude"),
+ object$CCA$u)
} else {
u <- object$CCA$u
}
diff --git a/R/as.mlm.cca.R b/R/as.mlm.cca.R
index d51a33e..86e3e46 100644
--- a/R/as.mlm.cca.R
+++ b/R/as.mlm.cca.R
@@ -5,10 +5,6 @@
wa <- x$CCA$wa
wa <- sweep(wa, 1, sqrt(w), "*")
X <- qr.X(x$CCA$QR)
- ## qr.X gives wrong column names now, and they are fixed here
- ## (hopefully fixed in 2.12.1, but that's only a wish).
- if (getRversion() <= "2.12.0")
- colnames(X)[x$CCA$QR$pivot] <- colnames(X)
lm(wa ~ . - 1, data = as.data.frame(X))
}
diff --git a/R/as.mlm.rda.R b/R/as.mlm.rda.R
index 909de48..2d789cd 100644
--- a/R/as.mlm.rda.R
+++ b/R/as.mlm.rda.R
@@ -2,10 +2,6 @@
function (x)
{
X <- qr.X(x$CCA$QR)
- ## We hope that column names will be fixed in R 2.12.1 (but
- ## perhaps in vain).
- if (getRversion() <= "2.12.0")
- colnames(X)[x$CCA$QR$pivot] <- colnames(X)
lm(x$CCA$wa ~ . - 1, data = as.data.frame(X))
}
diff --git a/R/betadisper.R b/R/betadisper.R
index 1fc660c..41549de 100644
--- a/R/betadisper.R
+++ b/R/betadisper.R
@@ -18,6 +18,18 @@
spMedNeg <- ordimedian(vectors, group, choices = axes[!pos])
cbind(spMedPos, spMedNeg)
}
+ ## inline function for centroids
+ centroidFUN <- function(vec, group) {
+ cent <- apply(vec, 2,
+ function(x, group) tapply(x, INDEX = group, FUN = mean),
+ group = group)
+ if(!is.matrix(cent)) { ## if only 1 group, cent is vector
+ cent <- matrix(cent, nrow = 1,
+ dimnames = list(as.character(levels(group)),
+ paste0("Dim", seq_len(NCOL(vec)))))
+ }
+ cent
+ }
## inline function for distance computation
Resids <- function(x, c) {
if(is.matrix(c))
@@ -69,7 +81,6 @@
warning("Missing observations due to 'd' removed.")
}
x <- x + t(x)
- storage.mode(x) <- "double"
x <- dblcen(x)
e <- eigen(-x/2, symmetric = TRUE)
vectors <- e$vectors
@@ -84,7 +95,7 @@
## group centroids in PCoA space
centroids <-
switch(type,
- centroid = apply(vectors, 2, function(x) tapply(x, group, mean)),
+ centroid = centroidFUN(vectors, group),
median = spatialMed(vectors, group, pos)
)
## for each of the groups, calculate distance to centroid for
diff --git a/R/betadiver.R b/R/betadiver.R
index 9d1a8af..a563098 100644
--- a/R/betadiver.R
+++ b/R/betadiver.R
@@ -11,8 +11,8 @@
}
beta <- list("w"="(b+c)/(2*a+b+c)", "-1"="(b+c)/(2*a+b+c)", "c"="(b+c)/2",
"wb"="b+c", "r"="2*b*c/((a+b+c)^2-2*b*c)",
- "I"="log(2*a+b+c)-2*a*log(2)/(2*a+b+c)-((a+b)*log(a+b)+(a+c)*log(a+c))/(2*a+b+c)",
- "e"="exp(log(2*a+b+c)-2*a*log(2)/(2*a+b+c)-((a+b)*log(a+b)+(a+c)*log(a+c))/(2*a+b+c))-1",
+ "I"="log(2*a+b+c) - 2*a*log(2)/(2*a+b+c) - ((a+b)*log(a+b) + (a+c)*log(a+c)) / (2*a+b+c)",
+ "e"="exp(log(2*a+b+c) - 2*a*log(2)/(2*a+b+c) - ((a+b)*log(a+b) + (a+c)*log(a+c)) / (2*a+b+c))-1",
"t"="(b+c)/(2*a+b+c)", "me"="(b+c)/(2*a+b+c)",
"j"="a/(a+b+c)", "sor"="2*a/(2*a+b+c)",
"m"="(2*a+b+c)*(b+c)/(a+b+c)",
@@ -27,8 +27,9 @@
"z"="(log(2)-log(2*a+b+c)+log(a+b+c))/log(2)"
)
if (help) {
- for (i in 1:length(beta))
- cat(i, " \"", names(beta[i]),"\" = ", beta[[i]], "\n", sep="")
+ for (i in 1:length(beta))
+ writeLines(strwrap(paste(i, " \"", names(beta[i]),
+ "\" = ", beta[[i]], "\n", sep="")))
return(invisible(NULL))
}
x <- ifelse(x > 0, 1, 0)
diff --git a/R/capscale.R b/R/capscale.R
index 029a240..77fbb11 100644
--- a/R/capscale.R
+++ b/R/capscale.R
@@ -79,8 +79,6 @@
if (add) {
X <- cmdscale(X, k = k, eig = TRUE, add = add)
## All eigenvalues *should* be positive, but see that they are
- if (getRversion() < "2.13.0")
- X$points <- X$points[, X$eig[-(k+1)] > 0]
X$eig <- X$eig[X$eig > 0]
}
else
diff --git a/R/density.anosim.R b/R/density.anosim.R
index 4dff5bb..a84b3e5 100644
--- a/R/density.anosim.R
+++ b/R/density.anosim.R
@@ -39,7 +39,6 @@
`densityplot.adonis` <-
function(x, data, xlab = "Null", ...)
{
- require(lattice) || stop("requires package 'lattice'")
obs <- x$aov.tab$F.Model
obs <- obs[!is.na(obs)]
sim <- rbind(obs, x$f.perms)
diff --git a/R/densityplot.oecosimu.R b/R/densityplot.oecosimu.R
index 2700fe5..95b53be 100644
--- a/R/densityplot.oecosimu.R
+++ b/R/densityplot.oecosimu.R
@@ -1,7 +1,6 @@
`densityplot.oecosimu` <-
function(x, data, xlab = "Simulated", ...)
{
- require(lattice) || stop("requires package 'lattice'")
obs <- x$oecosimu$statistic
sim <- rbind(obs, t(x$oecosimu$simulated))
nm <- names(obs)[col(sim)]
diff --git a/R/eigenvals.R b/R/eigenvals.R
index de2b860..7a6313b 100644
--- a/R/eigenvals.R
+++ b/R/eigenvals.R
@@ -20,15 +20,14 @@
else if (length(x) == 3 && all(names(x) %in% c("d", "u", "v")))
out <- x$d^2
## cmdscale() will return all eigenvalues from R 2.12.1
- else if (getRversion() > "2.12.0" &&
- all(c("points","eig","GOF") %in% names(x)))
+ else if (all(c("points","eig","GOF") %in% names(x)))
out <- x$eig
}
class(out) <- "eigenvals"
out
}
-## squares of sdev
+## squares of sdev
`eigenvals.prcomp` <-
function(x, ...)
{
@@ -78,6 +77,13 @@
out
}
+## betadisper (vegan)
+`eigenvals.betadisper` <- function(x, ...) {
+ out <- x$eig
+ class(out) <- "eigenvals"
+ out
+}
+
## dudi objects of ade4
`eigenvals.dudi` <-
@@ -112,7 +118,7 @@
class(out) <- "eigenvals"
out
}
-
+
`print.eigenvals` <-
function(x, ...)
diff --git a/R/hiersimu.default.R b/R/hiersimu.default.R
index 621bbc0..ce07bed 100644
--- a/R/hiersimu.default.R
+++ b/R/hiersimu.default.R
@@ -18,7 +18,7 @@ relative = FALSE, drop.highest = FALSE, nsimul=99, ...)
## check proper design of the model frame
l1 <- sapply(rhs, function(z) length(unique(z)))
if (!any(sapply(2:nlevs, function(z) l1[z] <= l1[z-1])))
- stop("number of levels are inapropriate, check sequence")
+ stop("number of levels are inappropriate, check sequence")
rval <- list()
rval[[1]] <- rhs[,nlevs]
nCol <- nlevs - 1
diff --git a/R/indpower.R b/R/indpower.R
index e173a68..415be23 100644
--- a/R/indpower.R
+++ b/R/indpower.R
@@ -8,7 +8,7 @@ function(x, type=0)
if (!(type %in% 0:2))
stop("'type' must be in c(0, 1, 2)")
n <- nrow(x)
- j <- t(x) %*% x
+ j <- crossprod(x) ## faster t(x) %*% x
ip1 <- sweep(j, 1, diag(j), "/")
ip2 <- 1 - sweep(-sweep(j, 2, diag(j), "-"), 1, n - diag(j), "/")
out <- switch(as.character(type),
diff --git a/R/intersetcor.R b/R/intersetcor.R
index e90d282..6c22cf3 100644
--- a/R/intersetcor.R
+++ b/R/intersetcor.R
@@ -8,8 +8,5 @@ intersetcor <- function(object)
wa <- sweep(object$CCA$wa, 1, sqrt(w), "*")
}
X <- qr.X(object$CCA$QR)
- ## current R (2.12.0) uses wrong column names in pivoted qr.X()
- if (getRversion() <= "2.12.0")
- colnames(X)[object$CCA$QR$pivot] <- colnames(X)
cor(X, wa)
}
diff --git a/R/multipart.default.R b/R/multipart.default.R
index c146295..eee0343 100644
--- a/R/multipart.default.R
+++ b/R/multipart.default.R
@@ -26,7 +26,7 @@
## check proper design of the model frame
l1 <- sapply(rhs, function(z) length(unique(z)))
if (!any(sapply(2:nlevs, function(z) l1[z] <= l1[z-1])))
- stop("number of levels are inapropriate, check sequence")
+ stop("number of levels are inappropriate, check sequence")
rval <- list()
rval[[1]] <- rhs[,nlevs]
nCol <- nlevs - 1
diff --git a/R/oecosimu.R b/R/oecosimu.R
index 78afe75..ba5b17e 100644
--- a/R/oecosimu.R
+++ b/R/oecosimu.R
@@ -102,8 +102,8 @@
z <- (indstat - means)/sd
if (any(sd < sqrt(.Machine$double.eps)))
z[sd < sqrt(.Machine$double.eps)] <- 0
- pless <- rowSums(indstat <= simind, na.rm = TRUE)
- pmore <- rowSums(indstat >= simind, na.rm = TRUE)
+ pless <- rowSums(indstat >= simind, na.rm = TRUE)
+ pmore <- rowSums(indstat <= simind, na.rm = TRUE)
if (any(is.na(simind))) {
warning("some simulated values were NA and were removed")
nsimul <- nsimul - rowSums(is.na(simind))
diff --git a/R/ordiArrowTextXY.R b/R/ordiArrowTextXY.R
new file mode 100644
index 0000000..08c4393
--- /dev/null
+++ b/R/ordiArrowTextXY.R
@@ -0,0 +1,27 @@
+### Location of the text at the point of the arrow. 'vect' are the
+### coordinates of the arrow heads, and 'labels' are the text used to
+### label these heads, '...' passes arguments (such as 'cex') to
+### strwidth() and strheight().
+`ordiArrowTextXY` <-
+ function (vect, labels, ...)
+{
+ w <- strwidth(labels, ...)
+ h <- strheight(labels, ...)
+ ## slope of arrows
+ b <- vect[,2]/vect[,1]
+ ## offset based on string dimensions
+ off <- cbind(sign(vect[,1]) * (w/2 + h/4), 0.75 * h * sign(vect[,2]))
+ ## move the centre of the string to the continuation of the arrow
+ for(i in 1:nrow(vect)) {
+ move <- off[i,2] / b[i]
+ ## arrow points to the top/bottom of the text box
+ if (is.finite(move) && abs(move) <= abs(off[i, 1]))
+ off[i, 1] <- move
+ else {
+ ## arrow points to a side of the text box
+ move <- b[i] * off[i,1]
+ off[i, 2] <- move
+ }
+ }
+ off + vect
+}
diff --git a/R/ordicloud.R b/R/ordicloud.R
index c8e229d..9183f5a 100644
--- a/R/ordicloud.R
+++ b/R/ordicloud.R
@@ -4,7 +4,6 @@
prepanel = "prepanel.ordi3d", ...)
{
localCloud <- function(..., shrink, origin, scaling) cloud(...)
- require(lattice) || stop("requires package 'lattice'")
x <- as.data.frame(scores(x, display = display, choices = choices, ...))
if (!is.null(data))
x <- cbind(x, data)
diff --git a/R/ordilabel.R b/R/ordilabel.R
index e50e08d..918c4af 100644
--- a/R/ordilabel.R
+++ b/R/ordilabel.R
@@ -29,10 +29,6 @@
else
col <- par("fg")
for (i in 1:nrow(x)) {
- ## polygon(x[i,1] + c(-1,1,1,-1)*w[i], x[i,2] + c(-1,-1,1,1)*h[i],
- ## col = fill, border = border, xpd = xpd)
- ## text(x[i,1], x[i,2], labels = labels[i], cex = cex, col = col,
- ## xpd = xpd, ...)
ordiArgAbsorber(x[i,1] + c(-1,1,1,-1)*w[i], x[i,2] + c(-1,-1,1,1)*h[i],
col = fill, border = border, xpd = xpd,
FUN = polygon, ...)
diff --git a/R/ordipointlabel.R b/R/ordipointlabel.R
index eaffcd5..92ca1e4 100644
--- a/R/ordipointlabel.R
+++ b/R/ordipointlabel.R
@@ -88,9 +88,13 @@
sol <- optim(par = pos, fn = fn, gr = gr, method="SANN",
control=list(maxit=nit))
if (!add)
- points(xy, pch = pch, col = col, cex=cex, ...)
+ ##points(xy, pch = pch, col = col, cex=cex, ...)
+ ordiArgAbsorber(xy, pch = pch, col = col, cex = cex, FUN = points,
+ ...)
lab <- xy + makeoff(sol$par, box)
- text(lab, labels=labels, col = col, cex = cex, font = font, ...)
+ ##text(lab, labels=labels, col = col, cex = cex, font = font, ...)
+ ordiArgAbsorber(lab, labels=labels, col = col, cex = cex, font = font,
+ FUN = text, ...)
pl <- list(points = xy)
pl$labels <- lab
attr(pl$labels, "font") <- font
diff --git a/R/ordiresids.R b/R/ordiresids.R
index 498ae2e..729bd52 100644
--- a/R/ordiresids.R
+++ b/R/ordiresids.R
@@ -2,7 +2,6 @@
function(x, kind = c("residuals", "scale", "qqmath"), residuals = "working",
type = c("p", "smooth", "g"), formula, ...)
{
- require(lattice) || stop("requires package lattice")
kind <- match.arg(kind)
if (!inherits(x, "cca") || is.null(x$CCA) || x$CCA$rank == 0)
stop("function is only available for constrained ordination")
diff --git a/R/ordisplom.R b/R/ordisplom.R
index af922b1..6f52a99 100644
--- a/R/ordisplom.R
+++ b/R/ordisplom.R
@@ -3,7 +3,6 @@
panel = "panel.ordi", type = "p", ...)
{
localSplom <- function(..., shrink, origin, scaling) splom(...)
- require(lattice) || stop("requires package 'lattice'")
x <- as.data.frame(scores(x, display = display, choices = choices, ...))
if (is.null(data))
data <- x
diff --git a/R/ordisurf.R b/R/ordisurf.R
index 0f3eea2..755416a 100644
--- a/R/ordisurf.R
+++ b/R/ordisurf.R
@@ -17,17 +17,23 @@
`ordisurf.default` <-
function (x, y, choices = c(1, 2), knots = 10, family = "gaussian",
- col = "red", thinplate = TRUE, add = FALSE, display = "sites",
- w = weights(x), main, nlevels = 10, levels, labcex = 0.6,
- bubble = FALSE, cex = 1, select = FALSE,
- method = "GCV.Cp", gamma = 1, plot = TRUE, ...)
+ col = "red", isotropic = TRUE, thinplate = TRUE, bs = "tp",
+ fx = FALSE, add = FALSE, display = "sites", w = weights(x),
+ main, nlevels = 10, levels, npoints = 31, labcex = 0.6,
+ bubble = FALSE, cex = 1, select = TRUE, method = "REML",
+ gamma = 1, plot = TRUE, lwd.cl = par("lwd"), ...)
{
weights.default <- function(object, ...) NULL
- GRID = 31
+ if(!missing(thinplate)) {
+ warning("Use of 'thinplate' is deprecated and will soon be removed;\nuse 'isotropic' instead.")
+ isotropic <- thinplate
+ }
+ ## GRID no user-definable - why 31?
+ GRID <- npoints
w <- eval(w)
if (!is.null(w) && length(w) == 1)
w <- NULL
- require(mgcv) || stop("Requires package 'mgcv'")
+ require(mgcv) || stop("Requires package 'mgcv'")
X <- scores(x, choices = choices, display = display, ...)
## The original name of 'y' may be lost in handling NA: save for
## plots
@@ -40,21 +46,76 @@
}
x1 <- X[, 1]
x2 <- X[, 2]
- if (knots <= 0)
- mod <- gam(y ~ x1 + x2, family = family, weights = w)
- else if (knots == 1)
- mod <- gam(y ~ poly(x1, 1) + poly(x2, 1),
- family = family, weights = w, method = method)
- else if (knots == 2)
- mod <- gam(y ~ poly(x1, 2) + poly(x2, 2) + poly(x1, 1):poly(x2, 1),
- family = family, weights = w, method = method)
- else if (thinplate)
- mod <- gam(y ~ s(x1, x2, k = knots), family = family,
- weights = w, select = select, method = method,
- gamma = gamma)
- else mod <- gam(y ~ s(x1, k = knots) + s(x2, k = knots), family = family,
- weights = w, select = select, method = method,
- gamma = gamma)
+ ## handle fx - allow vector of length up to two
+ if(!(missfx <- missing(fx)) && missing(knots))
+ warning("Requested fixed d.f. splines but without specifying 'knots'.\nSwitching to 'fx = FALSE'.")
+ if (length(fx) > 2L)
+ warning("Length of 'fx' supplied exceeds '2'. Using the first two.")
+ ## expand fx robustly, no matter what length supplied
+ fx <- rep(fx, length.out = 2)
+ ## can't have `fx = TRUE` and `select = TRUE`
+ if(!missfx) { ## fx set by user
+ if((miss.select <- missing(select)) && any(fx)) {
+ warning("'fx = TRUE' requested; using 'select = FALSE'")
+ select <- FALSE
+ } else if(!miss.select && isTRUE(select)){
+ stop("Fixed d.f. splines ('fx = TRUE') incompatible with 'select = TRUE'")
+ }
+ }
+ ## handle knots - allow vector of length up to two
+ if (length(knots) > 2L)
+ warning("Length of 'knots' supplied exceeds '2'. Using the first two.")
+ ## expand knots robustly, no matter what length supplied
+ knots <- rep(knots, length.out = 2)
+ ## handle the bs - we only allow some of the possible options
+ if (length(bs) > 2L)
+ warning("Number of basis types supplied exceeds '2'. Only using the first two.")
+ bs <- rep(bs, length.out = 2)
+ ## check allowed types
+ BS <- c("tp","ts","cr","cs","ds","ps","ad")
+ want <- match(bs, BS)
+ user.bs <- bs ## store supplied (well expanded supplied ones)
+ bs <- BS[want]
+ if (any(wrong <- is.na(bs))) {
+ stop(paste("Supplied basis type of",
+ paste(sQuote(unique(user.bs[wrong])), collapse = ", "),
+ "not supported."))
+ }
+ ## can't use "cr", "cs", "ps" in 2-d smoother with s()
+ if(isTRUE(isotropic) && any(bs %in% c("cr", "cs", "ps"))) {
+ stop("Bases \"cr\", \"cs\", and \"ps\" not allowed in isotropic smooths.")
+ }
+ ## Build formula
+ if (knots[1] <= 0) {
+ f <- formula(y ~ x1 + x2)
+ } else if (knots[1] == 1) { ## why do we treat this differently?
+ f <- formula(y ~ poly(x1, 1) + poly(x2, 1))
+ } else if (knots[1] == 2) {
+ f <- formula(y ~ poly(x1, 2) + poly(x2, 2) + poly(x1, 1):poly(x2, 1))
+ } else if (isotropic) {
+ f <- formula(paste0("y ~ s(x1, x2, k = ", knots[1],
+ ", bs = \"", bs[1], "\", fx = ", fx[1],")"))
+ } else {
+ if (any(bs %in% c("ad"))) {
+ ## only "ad" for now, but "fs" should also not be allowed
+ f <- formula(paste0("y ~ s(x1, k = ", knots[1],
+ ", bs = \"", bs[1],
+ "\", fx = ", fx[1], ") + s(x2, k = ",
+ knots[2], ", bs = \"", bs[2],
+ "\", fx = ", fx[2], ")"))
+ } else {
+ f <- formula(paste0("y ~ te(x1, x2, k = c(",
+ paste0(knots, collapse = ", "),
+ "), bs = c(",
+ paste0("\"", bs, "\"", collapse = ", "),
+ "), fx = c(",
+ paste0(fx, collapse = ", "),
+ "))"))
+ }
+ }
+ ## fit model
+ mod <- gam(f, family = family, weights = w, select = select,
+ method = method, gamma = gamma)
xn1 <- seq(min(x1), max(x1), len=GRID)
xn2 <- seq(min(x2), max(x2), len=GRID)
newd <- expand.grid(x1 = xn1, x2 = xn2)
@@ -62,14 +123,17 @@
poly <- chull(cbind(x1,x2))
## Move out points of the convex hull to have contour for all data
## points
- xhull1 <- x1[poly] + sign(x1[poly] - mean(x1[poly])) * diff(range(x1))/(GRID - 1)
- xhull2 <- x2[poly] + sign(x2[poly] - mean(x2[poly])) * diff(range(x2))/(GRID - 1)
+ xhull1 <- x1[poly] + sign(x1[poly] - mean(x1[poly])) *
+ diff(range(x1))/(GRID - 1)
+ xhull2 <- x2[poly] + sign(x2[poly] - mean(x2[poly])) *
+ diff(range(x2))/(GRID - 1)
npol <- length(poly)
np <- nrow(newd)
inpoly <- numeric(np)
- inpoly <- .C("pnpoly", as.integer(npol), as.double(xhull1), as.double(xhull2),
- as.integer(np), as.double(newd[,1]), as.double(newd[,2]),
- inpoly = as.integer(inpoly), PACKAGE="vegan")$inpoly
+ inpoly <- .C("pnpoly", as.integer(npol), as.double(xhull1),
+ as.double(xhull2), as.integer(np), as.double(newd[,1]),
+ as.double(newd[,2]), inpoly = as.integer(inpoly),
+ PACKAGE="vegan")$inpoly
is.na(fit) <- inpoly == 0
if(plot) {
if (!add) {
@@ -88,10 +152,12 @@
if (missing(levels))
levels <- pretty(range(fit, finite = TRUE), nlevels)
## Only plot surface is select is FALSE or (TRUE and EDF is diff from 0)
- if(!select || (select && !isTRUE(all.equal(as.numeric(summary(mod)$edf), 0))))
+ if(!select ||
+ (select && !isTRUE(all.equal(as.numeric(summary(mod)$edf), 0))))
contour(xn1, xn2, matrix(fit, nrow=GRID), col = col, add = TRUE,
levels = levels, labcex = labcex,
- drawlabels = !is.null(labcex) && labcex > 0)
+ drawlabels = !is.null(labcex) && labcex > 0,
+ lwd = lwd.cl)
}
mod$grid <- list(x = xn1, y = xn2, z = matrix(fit, nrow = GRID))
class(mod) <- c("ordisurf", class(mod))
diff --git a/R/orditkplot.R b/R/orditkplot.R
index dc994f8..a29ac08 100644
--- a/R/orditkplot.R
+++ b/R/orditkplot.R
@@ -241,9 +241,6 @@
## Should work also in R < 2.8.0 with no capabilities("tiff")
if (!isTRUE(unname(capabilities("tiff"))))
falt["tiff"] <- FALSE
- ## bmp lives only in Windows
- if (.Platform$OS.type != "windows")
- falt["bmp"] <- FALSE
ftypes <- ftypes[falt]
fname <- tkgetSaveFile(filetypes=ftypes)
if(tclvalue(fname) == "")
diff --git a/R/ordixyplot.R b/R/ordixyplot.R
index db49928..bd85ca0 100644
--- a/R/ordixyplot.R
+++ b/R/ordixyplot.R
@@ -4,7 +4,6 @@
type = c("p", "biplot"), ...)
{
localXyplot <- function(..., shrink, origin, scaling) xyplot(...)
- require(lattice) || stop("requires package 'lattice'")
p <- as.data.frame(scores(x, display = display, choices = choices, ...))
if (!is.null(data))
p <- cbind(p, data)
diff --git a/R/plot.cca.R b/R/plot.cca.R
index 3bb1610..91d7425 100644
--- a/R/plot.cca.R
+++ b/R/plot.cca.R
@@ -93,7 +93,8 @@
attr(g$biplot, "arrow.mul") <- mul
arrows(0, 0, mul * g$biplot[, 1], mul * g$biplot[, 2],
length = 0.05, col = "blue")
- text(1.1 * mul * g$biplot, rownames(g$biplot), col = "blue")
+ biplabs <- ordiArrowTextXY(mul * g$biplot, rownames(g$biplot))
+ text(biplabs, rownames(g$biplot), col = "blue")
axis(3, at = c(-mul, 0, mul), labels = rep("", 3), col = "blue")
axis(4, at = c(-mul, 0, mul), labels = c(-1, 0, 1), col = "blue")
}
diff --git a/R/plot.envfit.R b/R/plot.envfit.R
index 9a4b04c..cf5fab5 100644
--- a/R/plot.envfit.R
+++ b/R/plot.envfit.R
@@ -59,51 +59,67 @@
ax <- -c(-1, 0, 1) * arrow.mul * maxarr
}
vect <- arrow.mul * vect
- vtext <- sweep(1.1 * vect, 2, at, "+")
vect <- sweep(vect, 2, at, "+")
+ if (add) {
+ vtext <- ordiArrowTextXY(vect, labs$v, ...)
+ vtext <- sweep(vtext, 2, at, "+")
+ }
}
if (!add) {
- plot.new() ## needed for string widths and heights
- if(!is.null(vect)) {
- ## compute axis limits allowing space for labels
- sw <- strwidth(labs$v, ...)
+ plot.new()
+ ## needed for string widths and heights We need dimensions to
+ ## fit completely the names of vectors and factors with no
+ ## clipping at axes. If there are (1) factors and vectors, we
+ ## need to adjust arrow lengths, if there are (2) only factors
+ ## or only vectors, we can use their scores directly. After
+ ## finding the scores, we must expand the scores by string
+ ## widths and heights. The expansion can be only estimated
+ ## after setting plot.window with its xlim and ylim, but we
+ ## need to find xlim and ylim to set the plot.window...
+
+ if(is.null(vect) || is.null(x$factors)) {
+ ## Only factors or vectors: set preliminary plot.window
+ xstack <- rbind(vect, x$factors$centroids)
+ plot.window(xlim = range(xstack[,1], at[1]),
+ ylim = range(xstack[,2], at[2]),
+ asp = 1, ...)
+ } else {
+ ## Both vectors and factors: set preliminary plot.window
+ ## from factors only and and find arrow.mul (which is
+ ## otherwise ## arrow.mul = 1)
+ plot.window(xlim = range(x$factors$centroids[,1], at[1]),
+ ylim = range(x$factors$centroids[,2], at[2]),
+ asp = 1, ...)
+ vfill <- 0.75
+ arrow.mul <- ordiArrowMul(vect, at = at, fill = 1)
+ vect <- arrow.mul * vect
+ }
+ ## Get string dimensions (width/2, height)
+ sw <- strwidth(c(labs$v, labs$f), ...) / 2
+ sh <- strheight(c(labs$v, labs$f), ...)
+ ## Reset limits
+ xstack <- rbind(x$factors$centroids, vect)
+ xlim <- range(xstack[,1] + sw, xstack[,2] - sw)
+ ylim <- range(xstack[,2] + sh, xstack[,2] - sh)
+ plot.window(xlim = xlim, ylim = ylim, asp = 1, ...)
+ ## Re-evaluate arrow.mul, set its text and re-evaluate limits again
+ if (!is.null(vect)) {
+ arrow.mul <- ordiArrowMul(vect, at = at, fill = 1)
+ vect <- arrow.mul * vect
+ vtext <- ordiArrowTextXY(vect, labs$v, ...)
+ sw <- strwidth(labs$v, ...) / 2
sh <- strheight(labs$v, ...)
- xlim <- range(at[1], vtext[,1] + sw, vtext[,1] - sw)
- ylim <- range(at[2], vtext[,2] + sh, vtext[,2] - sh)
- if(!is.null(x$factors)) {
- ## if factors, also need to consider them
- sw <- strwidth(labs$f, ...)
- sh <- strheight(labs$f, ...)
- xlim <- range(xlim, x$factors$centroids[, choices[1]] + sw,
- x$factors$centroids[, choices[1]] - sw)
- ylim <- range(ylim, x$factors$centroids[, choices[2]] + sh,
- x$factors$centroids[, choices[2]] - sh)
- }
- ## these plotting calls will prob. generate warnings
- ## because of passing ... everywhere. localFoo needed?
+ xlim <- range(xlim, vtext[,1] + sw, vtext[,1] - sw)
+ ylim <- range(xlim, vtext[,2] + sh, vtext[,2] - sh)
plot.window(xlim = xlim, ylim = ylim, asp = 1, ...)
- axis(side = 1, ...)
- axis(side = 2, ...)
- box(...)
- alabs <- colnames(vect)
- title(..., ylab = alabs[2], xlab = alabs[1])
- } else if (!is.null(x$factors)) {
- sw <- strwidth(labs$f, ...)
- sh <- strheight(labs$f, ...)
- xlim <- range(at[1], x$factors$centroids[, choices[1]] + sw,
- x$factors$centroids[, choices[1]] - sw)
- ylim <- range(at[2], x$factors$centroids[, choices[2]] + sh,
- x$factors$centroids[, choices[2]] - sh)
- ## these plotting calls will prob. generate warnings
- ## because of passing ... everywhere. localFoo needed?
- plot.window(xlim = xlim, ylim = ylim, asp = 1, ...)
- axis(side = 1, ...)
- axis(side = 2, ...)
- box(...)
- alabs <- colnames(x$factors$centroids[, choices, drop = FALSE])
- title(..., ylab = alabs[2], xlab = alabs[1])
- } else stop("Nothing to plot")
+ }
+ axis(side = 1, ...)
+ axis(side = 2, ...)
+ box(...)
+ alabs <- colnames(vect)
+ title(..., ylab = alabs[2], xlab = alabs[1])
}
+
if (!is.null(vect)) {
arrows(at[1], at[2], vect[, 1], vect[, 2], len = 0.05,
col = col)
diff --git a/R/plot.ordipointlabel.R b/R/plot.ordipointlabel.R
new file mode 100644
index 0000000..671a14f
--- /dev/null
+++ b/R/plot.ordipointlabel.R
@@ -0,0 +1,11 @@
+plot.ordipointlabel <- function (x, ...)
+{
+ plot(x$points, pch = x$args$pch, cex = x$args$pcex, col = x$args$pcol,
+ bg = x$args$pbg, asp = 1, ...)
+ font <- attr(x$labels, "font")
+ if (is.null(font))
+ font <- par("font")
+ text(x$labels, rownames(x$labels), cex = x$args$tcex, col = x$args$tcol,
+ font = font, ...)
+ invisible(x)
+}
diff --git a/R/plot.ordisurf.R b/R/plot.ordisurf.R
index 17797dd..0850577 100644
--- a/R/plot.ordisurf.R
+++ b/R/plot.ordisurf.R
@@ -1,6 +1,7 @@
`plot.ordisurf` <- function(x, what = c("contour","persp","gam"),
add = FALSE, bubble = FALSE, col = "red", cex = 1,
- nlevels = 10, levels, labcex = 0.6, ...) {
+ nlevels = 10, levels, labcex = 0.6,
+ lwd.cl = par("lwd"), ...) {
what <- match.arg(what)
y <- x$model$y
x1 <- x$model$x1
@@ -23,7 +24,8 @@
levels <- pretty(range(x$grid$z, finite = TRUE), nlevels)
contour(X, Y, Z, col = col, add = TRUE,
levels = levels, labcex = labcex,
- drawlabels = !is.null(labcex) && labcex > 0)
+ drawlabels = !is.null(labcex) && labcex > 0,
+ lwd = lwd.cl)
} else if(isTRUE(all.equal(what, "persp"))) {
persp(X, Y, Z, col = col, cex = cex, ...)
} else {
diff --git a/R/plot.poolaccum.R b/R/plot.poolaccum.R
index 80a38d9..ee0c08a 100644
--- a/R/plot.poolaccum.R
+++ b/R/plot.poolaccum.R
@@ -1,7 +1,6 @@
`plot.poolaccum` <-
function(x, alpha = 0.05, type = c("l","g"), ...)
{
- require(lattice) || stop("Needs package 'lattice'")
m <- summary(x, alpha = alpha, ...)
n <- nrow(m[[1]])
Size <- as.vector(sapply(m, function(x) c(x[,1], x[,1], rev(x[,1]))))
diff --git a/R/plot.radfit.frame.R b/R/plot.radfit.frame.R
index 28fd521..a9316b0 100644
--- a/R/plot.radfit.frame.R
+++ b/R/plot.radfit.frame.R
@@ -2,7 +2,6 @@
function (x, order.by, BIC = FALSE, model, legend = TRUE, as.table = TRUE,
...)
{
- require(lattice)
modnam <- names(x[[1]]$models)
if (!missing(model))
pick <- pmatch(model, modnam, nomatch = FALSE)
diff --git a/R/plot.renyi.R b/R/plot.renyi.R
index 2be514a..35dbdc9 100644
--- a/R/plot.renyi.R
+++ b/R/plot.renyi.R
@@ -1,7 +1,6 @@
`plot.renyi` <-
function(x, ...)
{
- require(lattice) || stop("requires lattice")
if (inherits(x, "data.frame")) {
plt <- factor(rep(rownames(x), ncol(x)), levels=rownames(x))
alp <- factor(rep(colnames(x), each=nrow(x)), levels=colnames(x))
diff --git a/R/plot.renyiaccum.R b/R/plot.renyiaccum.R
index bc8812a..ae5744c 100644
--- a/R/plot.renyiaccum.R
+++ b/R/plot.renyiaccum.R
@@ -1,7 +1,6 @@
`plot.renyiaccum` <-
function (x, what=c("mean", "Qnt 0.025", "Qnt 0.975"), type = "l", ...)
{
- require(lattice) || stop("requires package lattice")
if (any(what %in% colnames(x[,1,])))
x <- x[,,what]
dm <- dim(x)
diff --git a/R/prepanel.ordi3d.R b/R/prepanel.ordi3d.R
index 09879d5..005fdde 100644
--- a/R/prepanel.ordi3d.R
+++ b/R/prepanel.ordi3d.R
@@ -2,5 +2,5 @@
function(xlim = xlim, ylim = ylim, zlim = zlim, aspect = c(1,1), ...)
{
aspect = c(diff(ylim)/diff(xlim), diff(zlim)/diff(xlim))
- lattice:::prepanel.default.cloud(xlim = xlim, ylim = ylim, zlim = zlim, aspect = aspect, ...)
+ prepanel.default.cloud(xlim = xlim, ylim = ylim, zlim = zlim, aspect = aspect, ...)
}
diff --git a/R/print.betadisper.R b/R/print.betadisper.R
index db125eb..963deaa 100644
--- a/R/print.betadisper.R
+++ b/R/print.betadisper.R
@@ -1,6 +1,9 @@
`print.betadisper` <- function(x, digits = max(3, getOption("digits") - 3),
- ...)
+ ...)
{
+ ## limit number of eignvals to 8
+ ax.lim <- 8
+ ##
cat("\n")
writeLines(strwrap("Homogeneity of multivariate dispersions\n",
prefix = "\t"))
@@ -9,10 +12,12 @@
cat(paste("\nNo. of Positive Eigenvalues:", sum(x$eig > 0)))
cat(paste("\nNo. of Negative Eigenvalues:", sum(x$eig < 0)))
cat("\n\n")
- writeLines(strwrap("Average distance to centroid:\n"))
+ type <- ifelse(isTRUE(all.equal(attr(x, "type"), "median")),
+ "median", "centroid")
+ writeLines(strwrap(paste0("Average distance to ", type, ":\n")))
print.default(tapply(x$distances, x$group, mean), digits = digits)
cat("\n")
writeLines(strwrap("Eigenvalues for PCoA axes:\n"))
- print.default(round(x$eig, digits = digits))
+ print.default(round(x$eig[seq_len(ax.lim)], digits = digits))
invisible(x)
}
diff --git a/R/print.oecosimu.R b/R/print.oecosimu.R
index 45b8100..e0ff79a 100644
--- a/R/print.oecosimu.R
+++ b/R/print.oecosimu.R
@@ -13,10 +13,10 @@
cat("options: ", paste(names(att), att, collapse=", "))
}
alt.char <- switch(x$oecosimu$alternative,
- two.sided = "not equal to",
+ two.sided = "less or greater than",
less = "less than",
greater = "greater than")
- cat("\nalternative hypothesis: simulated median is", alt.char, "the statistic")
+ cat("\nalternative hypothesis: statistic is", alt.char, "simulated values")
## dim attribute is always there, but print all others
cat("\n\n")
diff --git a/R/print.vectorfit.R b/R/print.vectorfit.R
index 9144f10..c72b7ad 100644
--- a/R/print.vectorfit.R
+++ b/R/print.vectorfit.R
@@ -1,8 +1,9 @@
-"print.vectorfit" <-
+`print.vectorfit` <-
function (x, ...)
{
out <- cbind(x$arrows, r2 = x$r, "Pr(>r)" = x$pvals)
- printCoefmat(out, na.print = "", ...)
+ printCoefmat(out, na.print = "",
+ zap.ind = seq_len(ncol(out)-2), ...)
if (x$permutations) {
cat("P values based on", x$permutations, "permutations")
if (!is.null(x$strata))
diff --git a/R/radlattice.R b/R/radlattice.R
index 5c8c0bf..9f11741 100644
--- a/R/radlattice.R
+++ b/R/radlattice.R
@@ -3,7 +3,6 @@
{
if (!inherits(x, "radfit"))
stop("function only works with 'radfit' results for single site")
- require(lattice) || stop("requires package 'lattice'")
y <- x$y
fv <- unlist(fitted(x))
mods <- names(x$models)
diff --git a/R/raupcrick.R b/R/raupcrick.R
index 187fb09..b4a97b9 100644
--- a/R/raupcrick.R
+++ b/R/raupcrick.R
@@ -12,7 +12,7 @@
## but is much slower
sol <- oecosimu(comm, function(x) tcrossprod(x)[tri], method = null,
nsimul = nsimul,
- alternative = if (chase) "greater" else "less")
+ alternative = if (chase) "less" else "greater")
## Chase et al. way, or the standard way
if (chase)
out <- 1 - sol$oecosimu$pval
diff --git a/R/stressplot.R b/R/stressplot.R
index a3118cd..ec97d9b 100644
--- a/R/stressplot.R
+++ b/R/stressplot.R
@@ -61,10 +61,15 @@
## Stress as R2
rstress <- 1 - object$stress^2
ralscal <- if(object$iregn == 3) ralscal/2 else ralscal/object$ngrp
- lab <- paste("Non-metric fit, R2 =", format(rstress, digits=3),
- "\nLinear fit, R2 =", format(ralscal, digits=3))
- text(min(x), 0.95*max(y), lab, pos=4)
- invisible(list("x" = x, "y" = y, "yf" = yf))
+ Rst <- format(rstress, digits = 3)
+ Ral <- format(ralscal, digits = 3)
+ lab1 <- bquote("Non-metric fit, " * R^2 == .(Rst))
+ lab2 <- bquote("Linear fit, " * R^2 == .(Ral))
+ text(min(x), 0.95*max(y), lab1, pos=4)
+ text(min(x), 0.95*max(y) - strheight(lab1), lab2, pos=4)
+ ## we want to have invisible return lists in the input order
+ o <- order(object$jidx, object$iidx)
+ invisible(list("x" = x[o], "y" = y[o], "yf" = yf[o]))
}
`stressplot.default` <-
@@ -87,8 +92,11 @@
plot(shep, pch = pch, col = p.col, xlab = "Observed Dissimilarity",
ylab = "Ordination Distance", ...)
lines(shep$x, shep$yf, type = "S", col = l.col, lwd = lwd, ...)
- lab <- paste("Non-metric fit, R2 =", format(rstress, digits=3),
- "\nLinear fit, R2 =", format(ralscal, digits=3))
- text(min(shep$x), 0.95*max(shep$y), lab, pos=4)
+ Rst <- format(rstress, digits = 3)
+ Ral <- format(ralscal, digits = 3)
+ lab1 <- bquote("Non-metric fit, " * R^2 == .(Rst))
+ lab2 <- bquote("Linear fit, " * R^2 == .(Ral))
+ text(min(shep$x), 0.95*max(shep$y), lab1, pos=4)
+ text(min(shep$x), 0.95*max(shep$y) - strheight(lab1), lab2, pos=4)
invisible(shep)
}
diff --git a/R/text.cca.R b/R/text.cca.R
index 87ce7dd..90cfc6a 100644
--- a/R/text.cca.R
+++ b/R/text.cca.R
@@ -29,7 +29,7 @@
pts <- pts * arrow.mul
arrows(0, 0, pts[, 1], pts[, 2], length = head.arrow,
...)
- pts <- pts * 1.1
+ pts <- ordiArrowTextXY(pts, rownames(pts), ...)
if (axis.bp) {
axis(side = 3, at = c(-arrow.mul, 0, arrow.mul),
labels = rep("", 3))
diff --git a/R/vegandocs.R b/R/vegandocs.R
index bee751a..998adfd 100644
--- a/R/vegandocs.R
+++ b/R/vegandocs.R
@@ -16,12 +16,11 @@
## Try html
helptype <- getOption("help_type")
if (length(helptype) && helptype == "html") {
- if (!tools:::httpdPort)
- tools:::startDynamicHelp()
- browseURL(paste("http://127.0.0.1:", tools:::httpdPort,
- "/library/vegan/doc/NEWS.html", sep=""))
+ browseURL(paste("file://",
+ system.file(package="vegan", "doc", "NEWS.html"),
+ sep=""))
} else {
- file.show(tools:::Rd2txt(file.path(system.file(package="vegan"),
+ file.show(Rd2txt(file.path(system.file(package="vegan"),
"NEWS.Rd"), tempfile()))
}
} else {
diff --git a/R/vegdist.R b/R/vegdist.R
index b249c03..f82784e 100644
--- a/R/vegdist.R
+++ b/R/vegdist.R
@@ -21,7 +21,7 @@
warning("results may be meaningless because data have negative entries in method ",
dQuote(inm))
if (method == 11 && any(colSums(x) == 0))
- warning("data have empty species which influence the results im method ",
+ warning("data have empty species which influence the results in method ",
dQuote(inm))
if (method == 6) # gower, but no altGower
x <- decostand(x, "range", 2, na.rm = TRUE, ...)
diff --git a/build/vignette.rds b/build/vignette.rds
new file mode 100644
index 0000000..e6bf2f2
Binary files /dev/null and b/build/vignette.rds differ
diff --git a/inst/ChangeLog b/inst/ChangeLog
index 088da3c..21a62bf 100644
--- a/inst/ChangeLog
+++ b/inst/ChangeLog
@@ -1,8 +1,57 @@
-$Date: 2013-03-09 17:35:10 +0200 (Sat, 09 Mar 2013) $
+$Date: 2013-09-25 09:53:42 +0300 (Wed, 25 Sep 2013) $
VEGAN RELEASE VERSIONS at http://cran.r-project.org/
-Version 2.0-7 (opened February 17, 2013)
+Version 2.0-9 (released September 25, 2013)
+
+ * merge 2618: a typo.
+ * merge 2613: 'medoid' to 'median' in betadisper output and doc.
+ * merge 2605, 7: FAQ about La.svd errors in cca/rda/capscale.
+ * merge 2604: print.vectorfit zaps zeros.
+ * merge 2600: remove tools::: in vegandocs().
+ * merge 2599: remove workarounds for R <= 2.13.0.
+ * merge 2598: remove workarounds for R <= 2.12.0.
+ * merge 2597: move vignettes from inst/doc to vignettes/; depend
+ on R 2.14.0.
+ * merge 2593: remove stats::: in anova.ccabyaxis().
+ * merge 2592: expand varpart.Rd to avoid questions.
+ * merge 2590: typos.
+ * merge r2588: remove unneeded utils::: in vegandocs (some remain).
+ * merge 2584,6: vegan Depends on lattice, avoid lattice:::
+ * merge r2583,7: remove cross-references to disappear in R-3.0-2.
+ * merge r2580,1: literature refs in specaccum.Rd and
+ betadisper.Rd.
+ * merge r2571: aspell fixes in Rd files (stressplot.wcmdscale.Rd,
+ commsim.Rd and nullmodel.Rd did not exist in 2.0 and were
+ excluded).
+ * merge r2570: aspell fixes in R files.
+ * merge r2568: aspell fixes in Rd files.
+ * merge r2564: line wrapping in betadiver(help=TRUE).
+ * merge r2562, 2563, 2565-7, 2572-6: edit and reformat Rnw file;
+ decision-vegan.Rnw required hand-editing due to conflicts in
+ text on parallel processing that was not merged.
+ * merge r2558: ordiktplot bmp device in all platforms.
+
+Version 2.0-8 (released July 10, 2013)
+
+ * merge r2540: remove hard-coded inconsolata fonts.
+ * merge r2539: stressplot return data in input order.
+ * merge r2538: use expression(R^2) in stressplot.
+ * merge r2537, 2541: add plot.ordipointlabel.
+ * merge r2535, 2536: better positioning of arrow labels.
+ * merge r2534: lwd in ordisurf.
+ * merge r2533: ordipointlabel uses ordiArgAbsorber.
+ * merge r2532: clean up ordilabel.
+ * merge r2504: notation in adipart.Rd.
+ * merge r2498: adapt raupcrick to r2495.
+ * merge r2497: avoid visible ~ in .Rnw.
+ * merge r2496: use crossprod() in indpower.
+ * merge r2495: fix twisted test direction in oecosimu.
+ * merge r2490 thru 2493: ordisurf new options.
+ * merge r2484 thru 2486: betadisper fixes (centroid with one
+ group, call it medoid).
+
+Version 2.0-7 (released March 19, 2013)
* merge r2476: take back part of 2434 and return matrix from
wcmdscale unless eigenvalues are requested.
diff --git a/inst/NEWS.Rd b/inst/NEWS.Rd
index 98e8778..97df479 100644
--- a/inst/NEWS.Rd
+++ b/inst/NEWS.Rd
@@ -2,7 +2,59 @@
\title{vegan News}
\encoding{UTF-8}
-\section{Changes in version 2.0.7}{
+\section{Changes in version 2.0-9}{
+
+\itemize{
+
+ \item This version is released due to changes in programming
+ interface and testing procedures in \R{} 3.0.2. If you are using an
+ older version of \R, there is no need to upgrade \pkg{vegan}. There
+ are no new features nor bug fixes. The only user-visible changes
+ are in documentation and in output messages and formatting. Because
+ of \R{} changes, this version is dependent on \R{} version 2.14.0
+ or newer and on \pkg{lattice} package.
+
+ }
+}
+
+\section{Changes in version 2.0-8}{
+
+ \subsection{GENERAL}{
+ \itemize{
+
+ \item This is a maintenance release that fixes some issues
+ raised by changed in \R{} toolset for processing vignettes. In
+ the same we also fix some typographic issues in the vignettes.
+
+ }
+ } % general
+
+ \subsection{NEW FEATURES}{
+ \itemize{
+
+ \item \code{ordisurf} gained new arguments for more flexible
+ definition of fitted models to better utilize the
+ \pkg{mgcv}\code{::gam} function.
+
+ The linewidth of contours can
+ now be set with the argument \code{lwd}.
+
+ \item Labels to arrows are positioned in a better way in
+ \code{plot} functions for the results of \code{envfit},
+ \code{cca}, \code{rda} and \code{capscale}. The labels should no
+ longer overlap the arrow tips.
+
+ \item The setting test direction is clearer in \code{oecosimu}.
+
+ \item \code{ordipointlabel} gained a \code{plot} method that can
+ be used to replot the saved result.
+
+ }
+ } % new features
+
+}
+
+\section{Changes in version 2.0-7}{
\subsection{NEW FUNCTIONS}{
\itemize{
diff --git a/inst/doc/FAQ-vegan.pdf b/inst/doc/FAQ-vegan.pdf
index 1115bbf..538c746 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 cdf3c15..f565471 100644
--- a/inst/doc/NEWS.html
+++ b/inst/doc/NEWS.html
@@ -8,7 +8,69 @@
<h2>vegan News</h2>
-<h3>Changes in version 2.0.7</h3>
+<h3>Changes in version 2.0-9</h3>
+
+
+<ul>
+<li><p> This version is released due to changes in programming
+interface and testing procedures in <font face="Courier New,Courier" color="#666666"><b>R</b></font> 3.0.2. If you are using an
+older version of <font face="Courier New,Courier" color="#666666"><b>R</b></font>, there is no need to upgrade <span class="pkg">vegan</span>. There
+are no new features nor bug fixes. The only user-visible changes
+are in documentation and in output messages and formatting. Because
+of <font face="Courier New,Courier" color="#666666"><b>R</b></font> changes, this version is dependent on <font face="Courier New,Courier" color="#666666"><b>R</b></font> version 2.14.0
+or newer and on <span class="pkg">lattice</span> package.
+</p>
+</li></ul>
+
+
+
+<h3>Changes in version 2.0-8</h3>
+
+
+
+<h4>GENERAL</h4>
+
+
+<ul>
+<li><p> This is a maintenance release that fixes some issues
+raised by changed in <font face="Courier New,Courier" color="#666666"><b>R</b></font> toolset for processing vignettes. In
+the same we also fix some typographic issues in the vignettes.
+</p>
+</li></ul>
+
+
+
+
+<h4>NEW FEATURES</h4>
+
+
+<ul>
+<li> <p><code>ordisurf</code> gained new arguments for more flexible
+definition of fitted models to better utilize the
+<span class="pkg">mgcv</span><code>::gam</code> function.
+</p>
+<p>The linewidth of contours can
+now be set with the argument <code>lwd</code>.
+</p>
+</li>
+<li><p> Labels to arrows are positioned in a better way in
+<code>plot</code> functions for the results of <code>envfit</code>,
+<code>cca</code>, <code>rda</code> and <code>capscale</code>. The labels should no
+longer overlap the arrow tips.
+</p>
+</li>
+<li><p> The setting test direction is clearer in <code>oecosimu</code>.
+</p>
+</li>
+<li> <p><code>ordipointlabel</code> gained a <code>plot</code> method that can
+be used to replot the saved result.
+</p>
+</li></ul>
+
+
+
+
+<h3>Changes in version 2.0-7</h3>
diff --git a/inst/doc/decision-vegan.R b/inst/doc/decision-vegan.R
new file mode 100644
index 0000000..5e9f01a
--- /dev/null
+++ b/inst/doc/decision-vegan.R
@@ -0,0 +1,152 @@
+### R code from vignette source 'decision-vegan.Rnw'
+
+###################################################
+### code chunk number 1: decision-vegan.Rnw:21-26
+###################################################
+figset <- function() par(mar=c(4,4,1,1)+.1)
+options(SweaveHooks = list(fig = figset))
+options("prompt" = "> ", "continue" = " ")
+options(width = 55)
+require(vegan)
+
+
+###################################################
+### code chunk number 2: decision-vegan.Rnw:50-61
+###################################################
+getOption("SweaveHooks")[["fig"]]()
+data(sipoo)
+mod <- nestedtemp(sipoo)
+plot(mod, "i")
+x <- mod$c["Falcsubb"]
+y <- 1 - mod$r["Svartholm"]
+points(x,y, pch=16, cex=1.5)
+abline(x+y, -1, lty=2)
+f <- function(x, p) (1-(1-x)^p)^(1/p)
+cross <- function(x, a, p) f(x,p) - a + x
+r <- uniroot(cross, c(0,1), a = x+y, p = mod$p)$root
+arrows(x,y, r, f(r, mod$p), lwd=4)
+
+
+###################################################
+### code chunk number 3: decision-vegan.Rnw:418-422
+###################################################
+library(vegan)
+data(varespec)
+data(varechem)
+orig <- cca(varespec ~ Al + K, varechem)
+
+
+###################################################
+### code chunk number 4: a
+###################################################
+plot(orig, dis=c("lc","bp"))
+
+
+###################################################
+### code chunk number 5: decision-vegan.Rnw:431-432
+###################################################
+getOption("SweaveHooks")[["fig"]]()
+plot(orig, dis=c("lc","bp"))
+
+
+###################################################
+### code chunk number 6: decision-vegan.Rnw:441-443
+###################################################
+i <- sample(nrow(varespec))
+shuff <- cca(varespec[i,] ~ Al + K, varechem)
+
+
+###################################################
+### code chunk number 7: decision-vegan.Rnw:446-447
+###################################################
+getOption("SweaveHooks")[["fig"]]()
+plot(shuff, dis=c("lc","bp"))
+
+
+###################################################
+### code chunk number 8: a
+###################################################
+plot(procrustes(scores(orig, dis="lc"),
+ scores(shuff, dis="lc")))
+
+
+###################################################
+### code chunk number 9: decision-vegan.Rnw:460-461
+###################################################
+getOption("SweaveHooks")[["fig"]]()
+plot(procrustes(scores(orig, dis="lc"),
+ scores(shuff, dis="lc")))
+
+
+###################################################
+### code chunk number 10: decision-vegan.Rnw:469-472
+###################################################
+tmp1 <- rda(varespec ~ Al + K, varechem)
+i <- sample(nrow(varespec)) # Different shuffling
+tmp2 <- rda(varespec[i,] ~ Al + K, varechem)
+
+
+###################################################
+### code chunk number 11: decision-vegan.Rnw:475-477
+###################################################
+getOption("SweaveHooks")[["fig"]]()
+plot(procrustes(scores(tmp1, dis="lc"),
+ scores(tmp2, dis="lc")))
+
+
+###################################################
+### code chunk number 12: decision-vegan.Rnw:494-496
+###################################################
+orig
+shuff
+
+
+###################################################
+### code chunk number 13: decision-vegan.Rnw:501-502
+###################################################
+getOption("SweaveHooks")[["fig"]]()
+plot(procrustes(orig, shuff))
+
+
+###################################################
+### code chunk number 14: decision-vegan.Rnw:515-520
+###################################################
+tmp1 <- rda(varespec ~ ., varechem)
+tmp2 <- rda(varespec[i,] ~ ., varechem)
+proc <- procrustes(scores(tmp1, dis="lc", choi=1:14),
+ scores(tmp2, dis="lc", choi=1:14))
+max(residuals(proc))
+
+
+###################################################
+### code chunk number 15: decision-vegan.Rnw:532-535
+###################################################
+data(dune)
+data(dune.env)
+orig <- cca(dune ~ Moisture, dune.env)
+
+
+###################################################
+### code chunk number 16: decision-vegan.Rnw:540-541
+###################################################
+getOption("SweaveHooks")[["fig"]]()
+plot(orig, dis="lc")
+
+
+###################################################
+### code chunk number 17: a
+###################################################
+plot(orig, display="wa", type="points")
+ordispider(orig, col="red")
+text(orig, dis="cn", col="blue")
+
+
+###################################################
+### code chunk number 18: decision-vegan.Rnw:565-566
+###################################################
+getOption("SweaveHooks")[["fig"]]()
+plot(orig, display="wa", type="points")
+ordispider(orig, col="red")
+text(orig, dis="cn", col="blue")
+
+
diff --git a/inst/doc/decision-vegan.Rnw b/inst/doc/decision-vegan.Rnw
index 6e2e642..cc42763 100644
--- a/inst/doc/decision-vegan.Rnw
+++ b/inst/doc/decision-vegan.Rnw
@@ -1,58 +1,52 @@
% -*- mode: noweb; noweb-default-code-mode: R-mode; -*-
%\VignetteIndexEntry{Design decisions and implementation}
-\documentclass[article,nojss]{jss}
-\usepackage{veganjss} % package options and redefinitions
-\usepackage{amsmath}
-%\usepackage{ucs}
-%\usepackage[utf8x]{inputenc}
-%\usepackage[T1]{fontenc}
-\usepackage{sidecap}
-\renewcommand{\floatpagefraction}{0.8}
-\renewcommand{\cite}{\citep}
+\documentclass[a4paper,10pt,twocolumn]{article}
+\usepackage{vegan} % package options and redefinitions
\author{Jari Oksanen}
\title{Design decisions and implementation details in vegan}
-\Abstract{
- This document describes design decisions, and discusses implementation
-and algorithmic details in some vegan functions. The proper FAQ is
-another document.
- }
- \Keywords{nestdness, matrix temperature, community null models, scaling of PCA and RDA, WA
- and LC scores}
-%% hijack Address for version info
-\Address{$ $Id: decision-vegan.Rnw 1709 2011-08-10 15:48:21Z jarioksa $ $
+
+\date{\footnotesize{$ $Id: decision-vegan.Rnw 2616 2013-09-11 08:34:17Z jarioksa $ $
processed with vegan
\Sexpr{packageDescription("vegan", field="Version")}
-in \Sexpr{R.version.string} on \today}
-\Footername{About this version}
+in \Sexpr{R.version.string} on \today}}
-%% need no \usepackage{Sweave.sty}
+%% need no \usepackage{Sweave}
\begin{document}
+\bibliographystyle{jss}
+
\SweaveOpts{strip.white=true}
-\setkeys{Gin}{width=0.55\linewidth}
+
<<echo=false,results=hide>>=
figset <- function() par(mar=c(4,4,1,1)+.1)
options(SweaveHooks = list(fig = figset))
-options("prompt" = "R> ", "continue" = "+ ")
+options("prompt" = "> ", "continue" = " ")
+options(width = 55)
require(vegan)
@
+\maketitle
-\tableofcontents
+\begin{abstract}
+ This document describes design decisions, and discusses implementation
+and algorithmic details in some vegan functions. The proper FAQ is
+another document.
+\end{abstract}
+\tableofcontents
\section{Nestedness and Null models}
-Some indicators of nestedness and null models of communities are only
-described in general terms, and they could be implemented in various
-ways. Here I discuss the implementation in \pkg{vegan}.
+Some published indices of nestedness and null models of communities
+are only described in general terms, and they could be implemented in
+various ways. Here I discuss the implementation in \pkg{vegan}.
\subsection{Matrix temperature}
The matrix temperature is intuitively simple
(Fig. \ref{fig:nestedtemp}), but the the exact calculations were not
explained in the original publication \cite{AtmarPat93}.
-\begin{SCfigure}
+\begin{figure}
<<fig=true,echo=false,results=hide>>=
data(sipoo)
mod <- nestedtemp(sipoo)
@@ -75,7 +69,7 @@ arrows(x,y, r, f(r, mod$p), lwd=4)
the fill line. The ``surprise'' for this point is $u = (d/D)^2$ and
the matrix temperature is based on the sum of surprises: presences
outside the fill line or absences within the fill line.}
-\end{SCfigure}
+\end{figure}
The function can be implemented in many ways following the general
principles. \citet{RodGir06} have seen the original code and reveal
more details of calculations, and their explanation is the basis of
@@ -90,12 +84,12 @@ in the source code of \code{nestedtemp}.
\begin{itemize}
\item Species and sites are put into unit square \citep{RodGir06}. The
- coordinates for $n$ item will be $(k-0.5)/n$ for $k=1 \ldots n$, so
- that there are no points in the corners or the margins of the unit
- square, and a diagonal line can be drawn through any point. I do not
- know how the rows and columns are converted to the unit square in
- other software, and this may be a considerable source of differences
- among implementations.
+ row and column coordinates will be $(k-0.5)/n$ for $k=1 \ldots n$,
+ so that there are no points in the corners or the margins of the
+ unit square, and a diagonal line can be drawn through any point. I
+ do not know how the rows and columns are converted to the unit
+ square in other software, and this may be a considerable source of
+ differences among implementations.
\item Species and sites are ordered alternately using indices
\citep{RodGir06}:
\begin{equation}
@@ -134,7 +128,7 @@ in the source code of \code{nestedtemp}.
\citep{RodGir06}. Small details in the fill line combined with
differences in scores used in the unit square (especially in the
corners) can cause large differences in the results.
- \item A line with slope $-1$ is drawn through the point and the $x$
+ \item A line with slope\,$= -1$ is drawn through the point and the $x$
coordinate of the intersection of this line and the fill line is
found using function \code{uniroot}. The difference of this
intersection and the row coordinate gives the argument $d$ of matrix
@@ -199,7 +193,7 @@ of singular value decomposition (\textsc{svd}). Functions
\code{rda} and \code{prcomp} even use \textsc{svd} internally in
their algorithm.
-In \textsc{svd} a centred data matrix is decomposed into orthogonal
+In \textsc{svd} a centred data matrix $\mathbf{X} = \{x_{ij}\}$ is decomposed into orthogonal
components so that $x_{ij} = \sum_k \sigma_k u_{ik} v_{jk}$, where
$u_{ik}$ and $v_{jk}$ are orthonormal coefficient matrices and
$\sigma_k$ are singular values. Orthonormality means that sums of
@@ -225,7 +219,7 @@ data. The orthonormal matrix $\mathbf{V}$ of \textsc{svd} can be
found indirectly as well, so that we have the same components in both
methods.
-The coefficients $u_{ik}$ and $v_{jk}$ are scaled similarly for all
+The coefficients $u_{ik}$ and $v_{jk}$ are scaled to unit length for all
axes $k$. Singular values $\sigma_k$ or eigenvalues $\lambda_k$ give
the information of the importance of axes, or the `axis lengths.'
Instead of the orthonormal coefficients, or equal length axes, it is
@@ -237,7 +231,8 @@ components analysis in all cases, and in redundancy analysis, they
apply to species scores and constraints or linear combination scores;
weighted averaging scores have somewhat wider dispersion.
-\begin{table}
+\begin{table*}[t]
+ \centering
\caption{\label{tab:scales} Alternative scalings for \textsc{rda} used
in the functions \code{prcomp} and \code{princomp}, and the
one used in the \pkg{vegan} function \code{rda}
@@ -251,9 +246,12 @@ weighted averaging scores have somewhat wider dispersion.
is derived
dividing each species by its standard deviation $s_j$ (possibly
with some additional constant multiplier). }
-\begin{tabular}{lcc}
+ \begin{tabular}{lcc}
+ \\
+ \toprule
& \textbf{Site scores} $u_{ik}^*$ &
\textbf{Species scores} $v_{jk}^*$ \\
+\midrule
\code{prcomp, princomp} &
$u_{ik} \sqrt{n-1} \sqrt{\lambda_k}$ &
$v_{jk}$ \\
@@ -270,7 +268,7 @@ $v_{jk} \sqrt[4]{\lambda_k/ \sum \lambda_k} \times \mathrm{const}$ \\
\code{rda, scaling < 0} &
$u_{ik}^*$ &
$\sqrt{\sum \lambda_k /(n-1)} s_j^{-1} v_{jk}^*$
-% \\
+\\
% \code{Canoco 3, scaling=-1} &
% $u_{ik} \sqrt{n-1} \sqrt{\lambda_k / \sum \lambda_k}$ &
% $v_{jk} \sqrt{n}$ \\
@@ -281,8 +279,11 @@ $\sqrt{\sum \lambda_k /(n-1)} s_j^{-1} v_{jk}^*$
% \code{Canoco 3, scaling=-3} &
% $u_{ik} \sqrt{n-1} \sqrt[4]{\lambda_k / \sum \lambda_k}$ &
% $v_{jk} \sqrt{n} \sqrt[4]{\lambda_k / \sum \lambda_k}$
+\bottomrule
\end{tabular}
-\end{table}
+\end{table*}
+
+
In community ecology, it is common to plot both species and sites in
the same graph. If this graph is a graphical display of \textsc{svd},
@@ -330,21 +331,27 @@ the scaling constant to any desired values. It is also possible to
have two separate scaling constants: the first for the species, and
the second for sites and friends, and this allows getting scores of
other software or \proglang{R} functions (Table \ref{tab:rdaconst}).
-\begin{table}
+
+\begin{table*}[t]
+ \centering
\caption{\label{tab:rdaconst} Values of the \code{const} argument in
\textbf{vegan} to get the scores that are equal to those from
other functions and software. Number of sites (rows) is $n$,
the number of species (columns) is $m$, and the sum of all
eigenvalues is $\sum_k \lambda_k$ (this is saved as the item
\code{tot.chi} in the \code{rda} result)}.
-\begin{tabular}{lccc}
+ \begin{tabular}{lccc}
+ \\
+ \toprule
& \textbf{Scaling} &\textbf{Species constant} & \textbf{Site constant} \\
+\midrule
\pkg{vegan} & any & $\sqrt[4]{(n-1) \sum \lambda_k}$ & $\sqrt[4]{(n-1) \sum \lambda_k}$\\
\code{prcomp}, \code{princomp} & \code{1} & $1$ & $\sqrt{(n-1) \sum_k \lambda_k}$\\
\proglang{Canoco\,v3} & \code{-1, -2, -3} & $\sqrt{n-1}$ & $\sqrt{n}$\\
-\proglang{Canoco\,v4} & \code{-1, -2, -3} & $\sqrt{m}$ & $\sqrt{n}$
+\proglang{Canoco\,v4} & \code{-1, -2, -3} & $\sqrt{m}$ & $\sqrt{n}$\\
+\bottomrule
\end{tabular}
-\end{table}
+\end{table*}
In this chapter, I used always centred data matrices. In principle
\textsc{svd} could be done with original, non-centred data, but
@@ -379,25 +386,23 @@ WA or Weighted Averages Scores which are such weighted averages of
species scores that are as similar to LC scores as possible.
\end{itemize}
Many computer programs for constrained ordinations give only or
-primarily LC scores, following Mike Palmer's recommendation
-\cite{Palmer93}. However, functions \code{cca} and \code{rda} in
+primarily LC scores following recommendation of
+\citet{Palmer93}. However, functions \code{cca} and \code{rda} in
the \pkg{vegan} package use primarily WA scores. This chapter
explains the reasons for this choice.
Briefly, the main reasons are that
\begin{itemize}
-\item
-LC scores \emph{are} linear combinations, so they give us only the
-(scaled) environmental variables. This means that they are
-independent of vegetation and cannot be found from the species
-composition. Moreover, identical combinations of environmental
-variables give identical LC scores irrespective of vegetation.
-\item
-Bruce McCune has demonstrated that noisy environmental variables
-result in deteriorated LC scores whereas WA scores tolerate some errors
-in environmental variables \cite{McCune97}. All environmental
-measurements contain some errors, and therefore it is safer to use WA
-scores.
+\item LC scores \emph{are} linear combinations, so they give us only
+ the (scaled) environmental variables. This means that they are
+ independent of vegetation and cannot be found from the species
+ composition. Moreover, identical combinations of environmental
+ variables give identical LC scores irrespective of vegetation.
+\item \citet{McCune97} has demonstrated that noisy environmental
+ variables result in deteriorated LC scores whereas WA scores
+ tolerate some errors in environmental variables. All environmental
+ measurements contain some errors, and therefore it is safer to use
+ WA scores.
\end{itemize}
This article studies mainly the first point. The users of
\pkg{vegan} have a choice of either LC or WA (default) scores, but
@@ -422,13 +427,13 @@ default. So we must specifically ask for LC scores
<<a,fig=false>>=
plot(orig, dis=c("lc","bp"))
@
-\begin{SCfigure}
+\begin{figure}
<<fig=true,echo=false>>=
<<a>>
@
\caption{LC scores in CCA of the original data.}
\label{fig:ccalc}
-\end{SCfigure}
+\end{figure}
What would happen to linear combinations of LC scores if we shuffle
the ordering of sites in species data? Function \code{sample()} below
@@ -437,26 +442,27 @@ shuffles the indices.
i <- sample(nrow(varespec))
shuff <- cca(varespec[i,] ~ Al + K, varechem)
@
-\begin{SCfigure}
+\begin{figure}
<<fig=true,echo=false>>=
plot(shuff, dis=c("lc","bp"))
@
\caption{LC scores of shuffled species data.}
\label{fig:ccashuff}
-\end{SCfigure}
+\end{figure}
It seems that site scores are fairly similar, but oriented differently
(Fig. \ref{fig:ccashuff}). We can use Procrustes rotation to see how
similar the site scores indeed are (Fig. \ref{fig:ccaproc}).
<<a,fig=false>>=
-plot(procrustes(scores(orig, dis="lc"), scores(shuff, dis="lc")))
+plot(procrustes(scores(orig, dis="lc"),
+ scores(shuff, dis="lc")))
@
-\begin{SCfigure}
+\begin{figure}
<<fig=true,echo=false>>=
<<a>>
@
\caption{Procrustes rotation of LC scores from CCA of original and shuffled data.}
\label{fig:ccaproc}
-\end{SCfigure}
+\end{figure}
There is a small difference, but this will disappear if we use
Redundancy Analysis (RDA) instead of CCA
(Fig. \ref{fig:rdaproc}). Here we use a new shuffling as well.
@@ -465,13 +471,14 @@ tmp1 <- rda(varespec ~ Al + K, varechem)
i <- sample(nrow(varespec)) # Different shuffling
tmp2 <- rda(varespec[i,] ~ Al + K, varechem)
@
-\begin{SCfigure}
+\begin{figure}
<<fig=true,echo=false>>=
-plot(procrustes(scores(tmp1, dis="lc"), scores(tmp2, dis="lc")))
+plot(procrustes(scores(tmp1, dis="lc"),
+ scores(tmp2, dis="lc")))
@
\caption{Procrustes rotation of LC scores in RDA of the original and shuffled data.}
\label{fig:rdaproc}
-\end{SCfigure}
+\end{figure}
LC scores indeed are linear combinations of constraints (environmental
variables) and \emph{independent of species data}: You can
@@ -483,23 +490,21 @@ this can cause changes in LC scores. The magnitude of changes depends
on the variability of site totals.
The original data and shuffled data differ in their goodness of
-fit\footnote{Or probably differ: The randomization is done while
-generating this article, and different versions may have different
-randomizations.}.
+fit:
<<>>=
orig
shuff
@
Similarly their WA scores will be (probably) very different
(Fig. \ref{fig:ccawa}).
-\begin{SCfigure}
+\begin{figure}
<<fig=true,echo=false>>=
plot(procrustes(orig, shuff))
@
\caption{Procrustes rotation of WA scores of CCA with the original and
shuffled data.}
\label{fig:ccawa}
-\end{SCfigure}
+\end{figure}
The example used only two environmental variables so that we can
easily plot all constrained axes. With a larger number of
@@ -510,7 +515,8 @@ remain within numerical accuracy:
<<>>=
tmp1 <- rda(varespec ~ ., varechem)
tmp2 <- rda(varespec[i,] ~ ., varechem)
-proc <- procrustes(scores(tmp1, dis="lc", choi=1:14), scores(tmp2, dis="lc", choi=1:14))
+proc <- procrustes(scores(tmp1, dis="lc", choi=1:14),
+ scores(tmp2, dis="lc", choi=1:14))
max(residuals(proc))
@
In \code{cca} the difference would be somewhat larger than now
@@ -526,19 +532,18 @@ following example uses the classical dune meadow data \cite{Jongman87}:
<<>>=
data(dune)
data(dune.env)
-summary(dune.env)
orig <- cca(dune ~ Moisture, dune.env)
@
When the results are plotted using LC scores, sample plots fall only
in four alternative positions (Fig. \ref{fig:factorlc}).
-\begin{SCfigure}
+\begin{figure}
<<fig=TRUE,echo=false>>=
plot(orig, dis="lc")
@
\caption{LC scores of the dune meadow data using only one factor as a
constraint.}
\label{fig:factorlc}
-\end{SCfigure}
+\end{figure}
In the previous chapter we saw that this happens because LC scores
\emph{are} the environmental variables, and they can be distinct only
if the environmental variables are distinct. However, normally the user
@@ -556,14 +561,14 @@ plot(orig, display="wa", type="points")
ordispider(orig, col="red")
text(orig, dis="cn", col="blue")
@
-\begin{SCfigure}
+\begin{figure}
<<fig=TRUE,echo=false>>=
<<a>>
@
\caption{A ``spider plot'' connecting WA scores to corresponding LC
scores. The shorter the web segments, the better the ordination.}
\label{fig:walcspider}
-\end{SCfigure}
+\end{figure}
This is the standard way of displaying results of discriminant
analysis, too. Moisture classes \code{1} and \code{2} seem to be
overlapping, and cannot be completely separated by their
diff --git a/inst/doc/decision-vegan.pdf b/inst/doc/decision-vegan.pdf
index bc5376e..f93ed46 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
new file mode 100644
index 0000000..5965def
--- /dev/null
+++ b/inst/doc/diversity-vegan.R
@@ -0,0 +1,254 @@
+### R code from vignette source 'diversity-vegan.Rnw'
+
+###################################################
+### code chunk number 1: diversity-vegan.Rnw:21-26
+###################################################
+par(mfrow=c(1,1))
+options(width=55)
+figset <- function() par(mar=c(4,4,1,1)+.1)
+options(SweaveHooks = list(fig = figset))
+options("prompt" = "> ", "continue" = " ")
+
+
+###################################################
+### code chunk number 2: diversity-vegan.Rnw:58-60
+###################################################
+library(vegan)
+data(BCI)
+
+
+###################################################
+### code chunk number 3: diversity-vegan.Rnw:78-79
+###################################################
+H <- diversity(BCI)
+
+
+###################################################
+### code chunk number 4: diversity-vegan.Rnw:86-87
+###################################################
+J <- H/log(specnumber(BCI))
+
+
+###################################################
+### code chunk number 5: diversity-vegan.Rnw:113-115
+###################################################
+k <- sample(nrow(BCI), 6)
+R <- renyi(BCI[k,])
+
+
+###################################################
+### code chunk number 6: diversity-vegan.Rnw:122-123
+###################################################
+getOption("SweaveHooks")[["fig"]]()
+print(plot(R))
+
+
+###################################################
+### code chunk number 7: diversity-vegan.Rnw:134-135
+###################################################
+alpha <- fisher.alpha(BCI)
+
+
+###################################################
+### code chunk number 8: diversity-vegan.Rnw:171-172
+###################################################
+quantile(rowSums(BCI))
+
+
+###################################################
+### code chunk number 9: diversity-vegan.Rnw:175-176
+###################################################
+Srar <- rarefy(BCI, min(rowSums(BCI)))
+
+
+###################################################
+### code chunk number 10: diversity-vegan.Rnw:184-185
+###################################################
+S2 <- rarefy(BCI, 2)
+
+
+###################################################
+### code chunk number 11: diversity-vegan.Rnw:189-190
+###################################################
+all(rank(Srar) == rank(S2))
+
+
+###################################################
+### code chunk number 12: diversity-vegan.Rnw:196-197
+###################################################
+range(diversity(BCI, "simp") - (S2 -1))
+
+
+###################################################
+### code chunk number 13: diversity-vegan.Rnw:258-262
+###################################################
+data(dune)
+data(dune.taxon)
+taxdis <- taxa2dist(dune.taxon, varstep=TRUE)
+mod <- taxondive(dune, taxdis)
+
+
+###################################################
+### code chunk number 14: diversity-vegan.Rnw:265-266
+###################################################
+getOption("SweaveHooks")[["fig"]]()
+plot(mod)
+
+
+###################################################
+### code chunk number 15: diversity-vegan.Rnw:292-294
+###################################################
+tr <- hclust(taxdis, "aver")
+mod <- treedive(dune, tr)
+
+
+###################################################
+### code chunk number 16: diversity-vegan.Rnw:316-319
+###################################################
+k <- sample(nrow(BCI), 1)
+fish <- fisherfit(BCI[k,])
+fish
+
+
+###################################################
+### code chunk number 17: diversity-vegan.Rnw:322-323
+###################################################
+getOption("SweaveHooks")[["fig"]]()
+plot(fish)
+
+
+###################################################
+### code chunk number 18: diversity-vegan.Rnw:338-339
+###################################################
+confint(fish)
+
+
+###################################################
+### code chunk number 19: diversity-vegan.Rnw:362-363
+###################################################
+prestondistr(BCI[k,])
+
+
+###################################################
+### code chunk number 20: diversity-vegan.Rnw:394-396
+###################################################
+rad <- radfit(BCI[k,])
+rad
+
+
+###################################################
+### code chunk number 21: diversity-vegan.Rnw:399-400
+###################################################
+getOption("SweaveHooks")[["fig"]]()
+print(radlattice(rad))
+
+
+###################################################
+### code chunk number 22: a
+###################################################
+sac <- specaccum(BCI)
+plot(sac, ci.type="polygon", ci.col="yellow")
+
+
+###################################################
+### code chunk number 23: diversity-vegan.Rnw:469-470
+###################################################
+getOption("SweaveHooks")[["fig"]]()
+sac <- specaccum(BCI)
+plot(sac, ci.type="polygon", ci.col="yellow")
+
+
+###################################################
+### code chunk number 24: diversity-vegan.Rnw:498-499
+###################################################
+ncol(BCI)/mean(specnumber(BCI)) - 1
+
+
+###################################################
+### code chunk number 25: diversity-vegan.Rnw:516-518
+###################################################
+beta <- vegdist(BCI, binary=TRUE)
+mean(beta)
+
+
+###################################################
+### code chunk number 26: diversity-vegan.Rnw:525-526
+###################################################
+betadiver(help=TRUE)
+
+
+###################################################
+### code chunk number 27: diversity-vegan.Rnw:544-546
+###################################################
+z <- betadiver(BCI, "z")
+quantile(z)
+
+
+###################################################
+### code chunk number 28: diversity-vegan.Rnw:556-561
+###################################################
+data(dune)
+data(dune.env)
+z <- betadiver(dune, "z")
+mod <- with(dune.env, betadisper(z, Management))
+mod
+
+
+###################################################
+### code chunk number 29: diversity-vegan.Rnw:564-565
+###################################################
+getOption("SweaveHooks")[["fig"]]()
+boxplot(mod)
+
+
+###################################################
+### code chunk number 30: diversity-vegan.Rnw:622-623
+###################################################
+specpool(BCI)
+
+
+###################################################
+### code chunk number 31: diversity-vegan.Rnw:628-630
+###################################################
+s <- sample(nrow(BCI), 25)
+specpool(BCI[s,])
+
+
+###################################################
+### code chunk number 32: diversity-vegan.Rnw:641-642
+###################################################
+estimateR(BCI[k,])
+
+
+###################################################
+### code chunk number 33: diversity-vegan.Rnw:678-680
+###################################################
+veiledspec(prestondistr(BCI[k,]))
+veiledspec(BCI[k,])
+
+
+###################################################
+### code chunk number 34: diversity-vegan.Rnw:694-695
+###################################################
+smo <- beals(BCI)
+
+
+###################################################
+### code chunk number 35: 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")
+
+
+###################################################
+### code chunk number 36: diversity-vegan.Rnw:708-709
+###################################################
+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")
+
+
diff --git a/inst/doc/diversity-vegan.Rnw b/inst/doc/diversity-vegan.Rnw
index 3b8c590..70178fe 100644
--- a/inst/doc/diversity-vegan.Rnw
+++ b/inst/doc/diversity-vegan.Rnw
@@ -1,52 +1,43 @@
% -*- mode: noweb; noweb-default-code-mode: R-mode; -*-
%\VignetteIndexEntry{Diversity analysis in vegan}
-\documentclass[article,nojss]{jss}
-\usepackage{veganjss} %% vegan setup
-\usepackage{ucs}
-\usepackage[utf8x]{inputenc}
-\usepackage[T1]{fontenc}
-\usepackage{sidecap}
-\usepackage{amsmath}
-\usepackage{amssymb} % \gtrapprox
+\documentclass[a4paper,10pt,twocolumn]{article}
+\usepackage{vegan} %% vegan setup
+%% TODO: SSarrhenius, adipart, beals update, betadisper
+%% expansion (+ permutest), contribdiv, eventstar, multipart, refer to
+%% FD, check Kindt reference to specaccum, check estimateR ref
\title{Vegan: ecological diversity} \author{Jari Oksanen}
-\Abstract{ This document explains diversity related methods in
- \pkg{vegan}. The methods are briefly described, and the equations
- used them are given often in more detail than in their help
- pages. The methods discussed include common diversity indices and
- rarefaction, families of diversity indices, species abundance
- models, species accumulation models and beta diversity, extrapolated
- richness and probability of being a member of the species pool. The
- document is still incomplete and does not cover all diversity
- methods in \pkg{vegan}.}
-
-\Keywords{diversity, Shannon, Simpson, R{\'e}nyi, Hill number,
- Tsallis, rarefaction, species accumulation, beta diversity, species
- abundance, Fisher alpha, Fisher logarithmic series, Preston
- log-normal model, species abundance models, Whittaker plots,
- extended richness, taxonomic diversity, functional divesity, species
- pool}
-
-%% misuse next for scm data
-\Address{$ $Id: diversity-vegan.Rnw 2346 2013-01-07 11:42:36Z jarioksa $ $
+\date{\footnotesize{$ $Id: diversity-vegan.Rnw 2597 2013-08-28 08:56:55Z jarioksa $ $
processed with vegan \Sexpr{packageDescription("vegan", field="Version")}
- in \Sexpr{R.version.string} on \today}
-\Footername{About this version}
+ in \Sexpr{R.version.string} on \today}}
%% need no \usepackage{Sweave}
\begin{document}
-\setkeys{Gin}{width=0.55\linewidth}
+\bibliographystyle{jss}
+
\SweaveOpts{strip.white=true}
<<echo=false>>=
par(mfrow=c(1,1))
-options(width=72)
+options(width=55)
figset <- function() par(mar=c(4,4,1,1)+.1)
options(SweaveHooks = list(fig = figset))
-options("prompt" = "R> ", "continue" = "+ ")
+options("prompt" = "> ", "continue" = " ")
@
+\maketitle
+\begin{abstract}
+ This document explains diversity related methods in
+ \pkg{vegan}. The methods are briefly described, and the equations
+ used them are given often in more detail than in their help
+ pages. The methods discussed include common diversity indices and
+ rarefaction, families of diversity indices, species abundance
+ models, species accumulation models and beta diversity, extrapolated
+ richness and probability of being a member of the species pool. The
+ document is still incomplete and does not cover all diversity
+ methods in \pkg{vegan}.
+\end{abstract}
\tableofcontents
@@ -72,7 +63,7 @@ data(BCI)
\section{Diversity indices}
Function \code{diversity} finds the most commonly used diversity
-indices:
+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}\\
@@ -99,7 +90,7 @@ where \code{specnumber} is a simple \pkg{vegan} function to find
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:
+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
\end{equation}
@@ -108,7 +99,7 @@ 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 =
- \log(\sum p_i^2)$, and $H_\infty = - \log(\max p_i)$.
-Tsallis diversity of order $q$ is:
+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}
@@ -127,10 +118,7 @@ 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}).
-<<echo=false,results=hide>>=
-require(lattice, quietly=TRUE)
-@
-\begin{SCfigure}
+\begin{figure}
<<fig=true,echo=false>>=
print(plot(R))
@
@@ -139,10 +127,10 @@ print(plot(R))
show the values for sites, and the lines the extremes and median in
the data set.}
\label{fig:renyi}
-\end{SCfigure}
+\end{figure}
Finally, the $\alpha$ parameter of Fisher's log-series can be used as
-a diversity index:
+a diversity index \citep{FisherEtal43}:
<<>>=
alpha <- fisher.alpha(BCI)
@
@@ -153,24 +141,24 @@ Species richness increases with sample size, and differences in
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:
-\begin{equation}
+rarefied from $N$ to $n$ individuals is \citep{Hurlbert71}:
+\begin{multline}
\label{eq:rare}
-\hat S_n = \sum_{i=1}^S (1 - q_i),\quad \text{where} \quad q_i = {N-x_i
+\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{equation}
+\end{multline}
where $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
other cases $q_i = 0$ or the species is sure to occur in the sample.
-The variance of rarefied richness is:
-\begin{equation}
+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
+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]
-\end{equation}
+\end{multline}
Equation \ref{eq:rarevar} actually is of the same form as the variance
of sum of correlated variables:
\begin{equation}
@@ -200,31 +188,31 @@ This will not give equal rank order with the previous rarefaction
richness:
<<>>=
all(rank(Srar) == rank(S2))
-@
+@
Moreover, the rarefied richness for two individuals is a finite
-sample variant of Simpson's diversity index (or, more precisely of
-$D_1 + 1$), and these two are almost identical in BCI:
+sample variant of Simpson's diversity index \citep{Hurlbert71}\,--\,or
+more precisely of $D_1 + 1$, and these two are almost identical in
+BCI:
<<>>=
range(diversity(BCI, "simp") - (S2 -1))
-@
+@
Rarefaction is sometimes presented as an ecologically meaningful
-alternative to dubious diversity indices, but the differences really
-seem to be small.
+alternative to dubious diversity indices \citep{Hurlbert71}, but the
+differences really seem to be small.
\section{Taxonomic and functional diversity}
Simple diversity indices only consider species identity: all different
species are equally different. In contrast, taxonomic and functional
-diversity indices judge the differences of species
-are. Taxonomic and functional diversities are used in different fields
-of science, but they really have very similar reasoning, and either
-could be used either with taxonomic or functional properties of
-species.
+diversity indices judge the differences of species. Taxonomic and
+functional diversities are used in different fields of science, but
+they really have very similar reasoning, and either could be used
+either with taxonomic or functional traits of species.
-\subsection{Taxonomic diversity: average distance of properties}
+\subsection{Taxonomic diversity: average distance of traits}
-The two basic indices are called taxonomic diversity ($\Delta$) and
-taxonomic distinctness ($\Delta^*$):
+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}
@@ -240,23 +228,23 @@ richness\footnote{This text normally uses upper case letter $S$ for
species richness, but lower case $s$ is used here in accordance with
the original papers on taxonomic diversity}
to give $s \Delta^+$, or it can be used to estimate an index of
-variation in taxonomic distinctness $\Lambda^+$:
+variation in taxonomic distinctness $\Lambda^+$ \citep{ClarkeWarwick01}:
\begin{equation}
\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
-calculate the indices. These can be any
-distance structure among species, but usually it is found from
-established hierarchic taxonomy. Typical coding is that differences
-among species in the same genus is $1$, among the same family it is
-$2$ etc. However, the taxonomic differences are scaled to maximum
-$100$ for easier comparison between different data sets and
-taxonomies. Alternatively, it is possible to scale steps between
-taxonomic level proportional to the reduction in the number of
-categories: if almost all genera have only one species, it does not
-make a great difference if two individuals belong to a different
-species or to a different genus.
+calculate the indices. These can be any distance structure among
+species, but usually it is found from established hierarchic
+taxonomy. Typical coding is that differences among species in the same
+genus is $1$, among the same family it is $2$ etc. However, the
+taxonomic differences are scaled to maximum $100$ for easier
+comparison between different data sets and taxonomies. Alternatively,
+it is possible to scale steps between taxonomic level proportional to
+the reduction in the number of categories \citep{ClarkeWarwick99}: if
+almost all genera have only one species, it does not make a great
+difference if two individuals belong to a different species or to a
+different genus.
Function \code{taxondive} implements indices of taxonomic diversity,
and \code{taxa2dist} can be used to convert classification tables to
@@ -273,7 +261,7 @@ data(dune.taxon)
taxdis <- taxa2dist(dune.taxon, varstep=TRUE)
mod <- taxondive(dune, taxdis)
@
-\begin{SCfigure}
+\begin{figure}
<<fig=true,echo=false>>=
plot(mod)
@
@@ -281,25 +269,26 @@ plot(mod)
points are diversity values of single sites, and the funnel is their
approximate confidence intervals ($2 \times$ standard error).}
\label{fig:taxondive}
-\end{SCfigure}
+\end{figure}
-\subsection{Functional diversity: the height of property tree}
+\subsection{Functional diversity: the height of trait tree}
In taxonomic diversity the primary data were taxonomic trees which
were transformed to pairwise distances among species. In functional
-diversity the primary data are species properties which are translated
-to pairwise distances among species and then to clustering trees of
-species properties. The argument for trees is that in this way a
+diversity the primary data are species traits which are translated to
+pairwise distances among species and then to clustering trees of
+species traits. The argument for using trees is that in this way a
single deviant species will have a small influence, since its
difference is evaluated only once instead of evaluating its distance
-to all other species.
+to all other species \citep{PetcheyGaston06}.
Function \code{treedive} implements functional diversity defined as
the total branch length in a trait dendrogram connecting all species,
-but excluding the unnecessary root segments of the tree. The example
-uses the taxonomic distances of the previous chapter. These are first
-converted to a hierarchic clustering (which actually were their
-original form before \code{taxa2dist} converted them into distances)
+but excluding the unnecessary root segments of the tree
+\citep{PetcheyGaston02, PetcheyGaston06}. The example uses the
+taxonomic distances of the previous chapter. These are first converted
+to a hierarchic clustering (which actually were their original form
+before \code{taxa2dist} converted them into distances)
<<>>=
tr <- hclust(taxdis, "aver")
mod <- treedive(dune, tr)
@@ -316,7 +305,7 @@ several models for species abundance distribution.
\subsection{Fisher and Preston}
In Fisher's log-series, the expected number of species $\hat f$ with $n$
-individuals is:
+individuals is \citep{FisherEtal43}:
\begin{equation}
\hat f_n = \frac{\alpha x^n}{n}
\end{equation}
@@ -329,14 +318,14 @@ k <- sample(nrow(BCI), 1)
fish <- fisherfit(BCI[k,])
fish
@
-\begin{SCfigure}
+\begin{figure}
<<fig=true,echo=false>>=
plot(fish)
@
\caption{Fisher's log-series fitted to one randomly selected site
(\Sexpr{k}).}
\label{fig:fisher}
-\end{SCfigure}
+\end{figure}
We already saw $\alpha$ as a diversity index. Now we also obtained
estimate of standard error of $\alpha$ (these also are optionally
available in \code{fisher.alpha}). The standard errors are based on
@@ -351,26 +340,25 @@ confint(fish)
@
Preston's log-normal model is the main challenger to Fisher's
-log-series. Instead of plotting species by frequencies, it bins
-species into frequency classes of increasing sizes. As a result,
-upper bins with high range of frequencies become more common, and
-sometimes the result looks similar to Gaussian distribution truncated
-at the left.
+log-series \citep{Preston48}. Instead of plotting species by
+frequencies, it bins species into frequency classes of increasing
+sizes. As a result, upper bins with high range of frequencies become
+more common, and sometimes the result looks similar to Gaussian
+distribution truncated at the left.
There are two alternative functions for the log-normal model:
-\code{prestonfit} and \code{prestondistr}. Function
-\code{prestonfit} uses traditionally binning approach, and is burdened
-with arbitrary choices of binning limits and treatment of ties. It
-seems that Preston split ties between adjacent octaves: only half of
-the species observed once were in the first octave, and half were
-transferred to the next octave, and the same for all species at the
-octave limits occuring 2, 4, 8, 16\ldots times. Function
+\code{prestonfit} and \code{prestondistr}. Function \code{prestonfit}
+uses traditionally binning approach, and is burdened with arbitrary
+choices of binning limits and treatment of ties. It seems that Preston
+split ties between adjacent octaves: only half of the species observed
+once were in the first octave, and half were transferred to the next
+octave, and the same for all species at the octave limits occurring 2,
+4, 8, 16\ldots times \citep{WilliamsonGaston05}. Function
\code{prestonfit} can either split the ties or keep all limit cases in
-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 \Sexpr{k}):
+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 \Sexpr{k}):
<<>>=
prestondistr(BCI[k,])
@
@@ -379,11 +367,11 @@ prestondistr(BCI[k,])
An alternative approach to species abundance distribution is to plot
logarithmic abundances in decreasing order, or against ranks of
-species. These are known as ranked abundance
+species \citep{Whittaker65}. These are known as ranked abundance
distribution curves, species abundance curves, dominance--diversity
-curves or Whittaker plots.
-Function \code{radfit} fits some of the most popular models using
-maximum likelihood estimation:
+curves or Whittaker plots. Function \code{radfit} fits some of the
+most popular models \citep{Bastow91} using maximum likelihood
+estimation:
\begin{align}
\hat a_r &= \frac{N}{S} \sum_{k=r}^S \frac{1}{k} &\text{brokenstick}\\
\hat a_r &= N \alpha (1-\alpha)^{r-1} & \text{preemption} \\
@@ -407,14 +395,14 @@ set gives (Fig. \ref{fig:rad}):
rad <- radfit(BCI[k,])
rad
@
-\begin{SCfigure}
+\begin{figure}
<<fig=true,echo=false>>=
print(radlattice(rad))
@
\caption{Ranked abundance distribution models for a random plot
(no. \Sexpr{k}). The best model has the lowest \textsc{aic}.}
\label{fig:rad}
-\end{SCfigure}
+\end{figure}
Function \code{radfit} compares the models using alternatively
Akaike's or Schwartz's Bayesian information criteria. These are based
@@ -445,23 +433,24 @@ several alternative methods, including accumulating sites in the order
they happen to be, and repeated accumulation in random order. In
addition, there are three analytic models. Rarefaction pools
individuals together, and applies rarefaction equation (\ref{eq:rare})
-to these individuals. Kindt's exact accumulator resembles rarefaction:
-\begin{equation}
+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
+\hat S_n = \sum_{i=1}^S (1 - p_i), \, \\ \text{where} \quad p_i = {N- f_i
\choose n} \Bigm / {N \choose n}
-\end{equation}
+\end{multline}
where $f_i$ is the frequency of species $i$. Approximate variance
estimator is:
-\begin{equation}
+\begin{multline}
\label{eq:kindtvar}
-s^2 = p_i (1 - p_i) + 2 \sum_{i=1}^S \sum_{j>i} \left( r_{ij}
+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)
-\end{equation}
+\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
-analytic method was suggested by Coleman:
+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}
@@ -476,28 +465,28 @@ The recommended is Kindt's exact method (Fig. \ref{fig:sac}):
sac <- specaccum(BCI)
plot(sac, ci.type="polygon", ci.col="yellow")
@
-\begin{SCfigure}
+\begin{figure}
<<fig=true,echo=false>>=
<<a>>
@
\caption{Species accumulation curve for the BCI data; exact method.}
\label{fig:sac}
-\end{SCfigure}
+\end{figure}
\subsection{Beta diversity}
-Whittaker divided diversity into various components. The best known
-are diversity in one spot that he called alpha diversity, and the
-diversity along gradients that he called beta diversity. The basic
-diversity indices are indices of alpha diversity. Beta diversity
-should be studied with respect to gradients, but almost everybody
-understand that as a measure of general heterogeneity: how many more
-species do you have in a collection of sites compared to an average
-site.
+\citet{Whittaker60} divided diversity into various components. The
+best known are diversity in one spot that he called alpha diversity,
+and the diversity along gradients that he called beta diversity. The
+basic diversity indices are indices of alpha diversity. Beta diversity
+should be studied with respect to gradients \citep{Whittaker60}, but
+almost everybody understand that as a measure of general heterogeneity
+\citep{Tuomisto10a, Tuomisto10b}: how many more species do you have in
+a collection of sites compared to an average site.
The best known index of beta diversity is based on the ratio of total
-number of species in a collection of sites ($S$) and the average
-richness per one site ($\bar \alpha$):
+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
@@ -512,8 +501,8 @@ ncol(BCI)/mean(specnumber(BCI)) - 1
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. Whittaker noticed this, and suggested the index to be
-found from pairwise comparison of sites. If the number of shared
+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:
@@ -531,8 +520,8 @@ 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
-\code{betadiver}. The indices in \code{betadiver} can be referred
-to by subscript name, or index number:
+\code{betadiver} \citep{KoleffEtal03}. The indices in \code{betadiver}
+can be referred to by subscript name, or index number:
<<>>=
betadiver(help=TRUE)
@
@@ -560,10 +549,10 @@ The size $X$ and parameter $c$ cancel out, and the index gives the
estimate $z$ for any pair of sites.
Function \code{betadisper} can be used to analyse beta diversities
-with respect to classes or factors. 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}):
+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}):
<<>>=
data(dune)
data(dune.env)
@@ -571,7 +560,7 @@ z <- betadiver(dune, "z")
mod <- with(dune.env, betadisper(z, Management))
mod
@
-\begin{SCfigure}
+\begin{figure}
<<fig=true,echo=false>>=
boxplot(mod)
@
@@ -579,7 +568,7 @@ boxplot(mod)
($z$) of the species area curve in the Arrhenius model $S = cX^z$ in
Management classes of dune meadows.}
\label{fig:betadisper}
-\end{SCfigure}
+\end{figure}
\section{Species pool}
\subsection{Number of unseen species}
@@ -595,12 +584,12 @@ species is related to the number of rare species, or species seen only
once or twice.
Function \code{specpool} implements the following models to estimate
-the pool size $S_p$:
+the pool size $S_p$ \citep{SmithVanBelle84, Chao87}:
\begin{align}
S_p &= S_o + \frac{f_1^2}{2 f_2} & \text{Chao}\\
-S_p &= S_o + f_1 \frac{N-1}{N} & \text{1st order Jackknife}\\
-S_p & = S_o + f_1 \frac{2N-3}{N} + f_2 \frac{(N-2)^2}{N(N-1)} &
-\text{2nd order Jackknife}\\
+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
@@ -610,27 +599,24 @@ 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 estimators of Chao is:
+The variance the estimator of \citet{Chao87} is:
\begin{equation}
s^2 = f_2 \left(\frac{G^4}{4} + G^3 + \frac{G^2}{2} \right), \,
\text{where}\quad G = \frac{f_1}{f_2}
\end{equation}
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:
+plots \citep{SmithVanBelle84}:
\begin{equation}
s^2 = \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:
-\begin{equation}
-\begin{split}
-s^2 = \sum_{i=1}^{S_o} q_i (1-q_i) + 2 \sum \sum Z_p , \quad \text{where} \\
-Z_p = \dots
-\end{split}
-\end{equation}
+new variable $q_i = (1-p_i)^N$ for each species \citep{SmithVanBelle84}:
+\begin{multline}
+s^2 = \sum_{i=1}^{S_o} q_i (1-q_i) + 2 \sum \sum Z_p ,\\ \text{where}\; Z_p = \dots
+\end{multline}
The extrapolated richness values for the whole BCI data are:
<<>>=
@@ -660,7 +646,7 @@ equation. \textsc{ace} is based on rare species also:
\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}\\
+\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}}
@@ -703,7 +689,8 @@ missing species could occur in a site, or which sites are suitable for
a species. The probability for each species at each site is assessed
from other species occurring on the site.
-Function \code{beals} implement Beals smoothing:
+Function \code{beals} implement Beals smoothing \citep{McCune87,
+ DeCaceresLegendre08}:
<<>>=
smo <- beals(BCI)
@
@@ -713,14 +700,18 @@ only one species, and to avoid circular reasoning we do not include
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")
+plot(beals(BCI, species=j, include=FALSE), BCI[,j],
+ main="Ceiba pentandra", xlab="Probability of occurrence",
+ ylab="Occurrence")
@
-\begin{SCfigure}
+\begin{figure}
<<fig=true,echo=false>>=
<<a>>
@
\caption{Beals smoothing for \emph{Ceiba pentandra}.}
\label{fig:beals}
-\end{SCfigure}
+\end{figure}
+
+\bibliography{vegan}
\end{document}
diff --git a/inst/doc/diversity-vegan.pdf b/inst/doc/diversity-vegan.pdf
index bd395ac..375d17f 100644
Binary files a/inst/doc/diversity-vegan.pdf and b/inst/doc/diversity-vegan.pdf differ
diff --git a/inst/doc/intro-vegan.R b/inst/doc/intro-vegan.R
new file mode 100644
index 0000000..99957b9
--- /dev/null
+++ b/inst/doc/intro-vegan.R
@@ -0,0 +1,195 @@
+### R code from vignette source 'intro-vegan.Rnw'
+
+###################################################
+### code chunk number 1: intro-vegan.Rnw:18-23
+###################################################
+par(mfrow=c(1,1))
+options(width=72)
+figset <- function() par(mar=c(4,4,1,1)+.1)
+options(SweaveHooks = list(fig = figset))
+options("prompt" = "> ", "continue" = " ")
+
+
+###################################################
+### code chunk number 2: intro-vegan.Rnw:71-74
+###################################################
+library(vegan)
+data(dune)
+ord <- decorana(dune)
+
+
+###################################################
+### code chunk number 3: intro-vegan.Rnw:77-78
+###################################################
+ord
+
+
+###################################################
+### code chunk number 4: intro-vegan.Rnw:101-103
+###################################################
+ord <- metaMDS(dune)
+ord
+
+
+###################################################
+### code chunk number 5: a
+###################################################
+plot(ord)
+
+
+###################################################
+### code chunk number 6: intro-vegan.Rnw:118-119
+###################################################
+getOption("SweaveHooks")[["fig"]]()
+plot(ord)
+
+
+###################################################
+### code chunk number 7: a
+###################################################
+plot(ord, type = "n")
+points(ord, display = "sites", cex = 0.8, pch=21, col="red", bg="yellow")
+text(ord, display = "spec", cex=0.7, col="blue")
+
+
+###################################################
+### code chunk number 8: intro-vegan.Rnw:140-141
+###################################################
+getOption("SweaveHooks")[["fig"]]()
+plot(ord, type = "n")
+points(ord, display = "sites", cex = 0.8, pch=21, col="red", bg="yellow")
+text(ord, display = "spec", cex=0.7, col="blue")
+
+
+###################################################
+### code chunk number 9: intro-vegan.Rnw:205-207
+###################################################
+data(dune.env)
+attach(dune.env)
+
+
+###################################################
+### code chunk number 10: a
+###################################################
+plot(ord, disp="sites", type="n")
+ordihull(ord, Management, col="blue")
+ordiellipse(ord, Management, col=3,lwd=2)
+ordispider(ord, Management, col="red", label = TRUE)
+points(ord, disp="sites", pch=21, col="red", bg="yellow", cex=1.3)
+
+
+###################################################
+### code chunk number 11: intro-vegan.Rnw:217-218
+###################################################
+getOption("SweaveHooks")[["fig"]]()
+plot(ord, disp="sites", type="n")
+ordihull(ord, Management, col="blue")
+ordiellipse(ord, Management, col=3,lwd=2)
+ordispider(ord, Management, col="red", label = TRUE)
+points(ord, disp="sites", pch=21, col="red", bg="yellow", cex=1.3)
+
+
+###################################################
+### code chunk number 12: intro-vegan.Rnw:248-250
+###################################################
+ord.fit <- envfit(ord ~ A1 + Management, data=dune.env, perm=1000)
+ord.fit
+
+
+###################################################
+### code chunk number 13: a
+###################################################
+plot(ord, dis="site")
+plot(ord.fit)
+
+
+###################################################
+### code chunk number 14: b
+###################################################
+ordisurf(ord, A1, add=TRUE)
+
+
+###################################################
+### code chunk number 15: intro-vegan.Rnw:266-268
+###################################################
+getOption("SweaveHooks")[["fig"]]()
+plot(ord, dis="site")
+plot(ord.fit)
+ordisurf(ord, A1, add=TRUE)
+
+
+###################################################
+### code chunk number 16: intro-vegan.Rnw:288-290
+###################################################
+ord <- cca(dune ~ A1 + Management, data=dune.env)
+ord
+
+
+###################################################
+### code chunk number 17: a
+###################################################
+plot(ord)
+
+
+###################################################
+### code chunk number 18: intro-vegan.Rnw:297-298
+###################################################
+getOption("SweaveHooks")[["fig"]]()
+plot(ord)
+
+
+###################################################
+### code chunk number 19: intro-vegan.Rnw:315-316
+###################################################
+cca(dune ~ ., data=dune.env)
+
+
+###################################################
+### code chunk number 20: intro-vegan.Rnw:325-326
+###################################################
+anova(ord)
+
+
+###################################################
+### code chunk number 21: intro-vegan.Rnw:340-341
+###################################################
+anova(ord, by="term", permu=200)
+
+
+###################################################
+### code chunk number 22: intro-vegan.Rnw:347-348
+###################################################
+anova(ord, by="mar")
+
+
+###################################################
+### code chunk number 23: a
+###################################################
+anova(ord, by="axis", perm=500)
+
+
+###################################################
+### code chunk number 24: intro-vegan.Rnw:365-367
+###################################################
+ord <- cca(dune ~ A1 + Management + Condition(Moisture), data=dune.env)
+ord
+
+
+###################################################
+### code chunk number 25: intro-vegan.Rnw:372-373
+###################################################
+anova(ord, by="term", perm=500)
+
+
+###################################################
+### code chunk number 26: intro-vegan.Rnw:378-379
+###################################################
+anova(ord, by="term", perm=500, strata=Moisture)
+
+
+###################################################
+### code chunk number 27: intro-vegan.Rnw:383-384
+###################################################
+detach(dune.env)
+
+
diff --git a/inst/doc/intro-vegan.Rnw b/inst/doc/intro-vegan.Rnw
index 8918fec..8a253ce 100644
--- a/inst/doc/intro-vegan.Rnw
+++ b/inst/doc/intro-vegan.Rnw
@@ -1,58 +1,44 @@
% -*- mode: noweb; noweb-default-code-mode: R-mode; -*-
%\VignetteIndexEntry{Introduction to ordination in vegan}
-\documentclass[article,nojss]{jss}
-\usepackage{veganjss} % vegan settings
-\usepackage{ucs} %% needed for R output: signif stars etc, quotes
-\usepackage[utf8x]{inputenc}
-\usepackage[T1]{fontenc}
-\usepackage{sidecap}
-\usepackage{amsmath}
-
-\renewcommand{\floatpagefraction}{0.8}
-
+\documentclass[a4paper,10pt]{article}
+\usepackage{vegan} % vegan settings
\title{Vegan: an introduction to ordination}
-
\author{Jari Oksanen}
-\Abstract{The document describes typical, simple work pathways of
- vegetation ordination. Unconstrained ordination uses as examples
- detrended correspondence analysis and non-metric multidimensional
- scaling, and shows how to interpret their results by fitting
- environmental vectors and factors or smooth environmental surfaces
- to the graph. The basic plotting command, and more advanced plotting
- commands for congested plots are also discussed, as well as adding
- items such as ellipses, convex hulls, and other items for
- classes. The constrained ordination uses constrained (canonical)
- correspondence analysis as an example. It is first shown how a model
- is defined, then the document discusses model building and
- signficance tests of the whole analysis, single constraints and
- axes.}
-
-\Keywords{ordination, correspondence analysis, non-metric
- multidimensional scaling, CCA, RDA, NMDS, fitted environmental
- vector, fitted environmental surface, permutation tests}
-
-%% misuse of the address field for revision data
-\Address{$ $Id: intro-vegan.Rnw 2346 2013-01-07 11:42:36Z jarioksa $ $
+\date{\footnotesize{$ $Id: intro-vegan.Rnw 2597 2013-08-28 08:56:55Z jarioksa $ $
processed with vegan
\Sexpr{packageDescription("vegan", field="Version")}
-in \Sexpr{R.version.string} on \today}
-\Footername{About this version}
+in \Sexpr{R.version.string} on \today}}
%% need no \usepackage{Sweave}
\begin{document}
-\setkeys{Gin}{width=0.55\linewidth}
\SweaveOpts{strip.white=true}
<<echo=false>>=
par(mfrow=c(1,1))
options(width=72)
figset <- function() par(mar=c(4,4,1,1)+.1)
options(SweaveHooks = list(fig = figset))
-options("prompt" = "R> ", "continue" = "+ ")
+options("prompt" = "> ", "continue" = " ")
@
+\maketitle
+\begin{abstract}
+ The document describes typical, simple work pathways of
+ vegetation ordination. Unconstrained ordination uses as examples
+ detrended correspondence analysis and non-metric multidimensional
+ scaling, and shows how to interpret their results by fitting
+ environmental vectors and factors or smooth environmental surfaces
+ to the graph. The basic plotting command, and more advanced plotting
+ commands for congested plots are also discussed, as well as adding
+ items such as ellipses, convex hulls, and other items for
+ classes. The constrained ordination uses constrained (canonical)
+ correspondence analysis as an example. It is first shown how a model
+ is defined, then the document discusses model building and
+ signficance tests of the whole analysis, single constraints and
+ axes.
+\end{abstract}
\tableofcontents
\vspace{3ex}
@@ -128,13 +114,13 @@ All ordination results of \pkg{vegan} can be displayed with a
<<a>>=
plot(ord)
@
-\begin{SCfigure}
+\begin{figure}
<<fig=true,echo=false>>=
<<a>>
@
\caption{Default ordination plot.}
\label{fig:plot}
-\end{SCfigure}
+\end{figure}
Default \code{plot} command uses either black circles for sites and
red pluses for species, or black and red text for sites and species,
resp. The choices depend on the number of items in the plot and
@@ -150,14 +136,14 @@ plot(ord, type = "n")
points(ord, display = "sites", cex = 0.8, pch=21, col="red", bg="yellow")
text(ord, display = "spec", cex=0.7, col="blue")
@
-\begin{SCfigure}
+\begin{figure}
<<fig=true,echo=false>>=
<<a>>
@
\caption{A more colourful ordination plot where sites are points, and
species are text.}
\label{fig:plot.args}
-\end{SCfigure}
+\end{figure}
All \pkg{vegan} ordination methods have a specific \code{plot}
function. In addition, \pkg{vegan} has an alternative plotting
@@ -227,14 +213,14 @@ ordiellipse(ord, Management, col=3,lwd=2)
ordispider(ord, Management, col="red", label = TRUE)
points(ord, disp="sites", pch=21, col="red", bg="yellow", cex=1.3)
@
-\begin{SCfigure}
+\begin{figure}
<<fig=true,echo=false>>=
<<a>>
@
\caption{Convex hull, standard error ellipse and a spider web diagram
for Management levels in ordination.}
\label{fig:ordihull}
-\end{SCfigure}
+\end{figure}
In addition, you can overlay a cluster dendrogram from \code{hclust}
using \code{ordicluster} or a minimum spanning tree from
\code{spantree} with its \code{lines} function. Segmented arrows
@@ -276,7 +262,7 @@ ordination, but it returns the result of the fitted thinplate spline
<<b,fig=false>>=
ordisurf(ord, A1, add=TRUE)
@
-\begin{SCfigure}
+\begin{figure}
<<fig=true,echo=false,results=hide>>=
<<a>>
<<b>>
@@ -284,7 +270,7 @@ ordisurf(ord, A1, add=TRUE)
\caption{Fitted vector and smooth surface for the thickness of A1
horizon (\code{A1}, in cm), and centroids of Management levels.}
\label{fig:envfit}
-\end{SCfigure}
+\end{figure}
\section{Constrained ordination}
@@ -307,13 +293,13 @@ The results can be plotted with (Fig. \ref{fig:cca}):
<<a>>=
plot(ord)
@
-\begin{SCfigure}
+\begin{figure}
<<fig=true,echo=false>>=
<<a>>
@
\caption{Default plot from constrained correspondence analysis.}
\label{fig:cca}
-\end{SCfigure}
+\end{figure}
There are three groups of items: sites, species and centroids (and
biplot arrows) of environmental variables. All these can be added
individually to an empty plot, and all previously explained tricks of
diff --git a/inst/doc/intro-vegan.pdf b/inst/doc/intro-vegan.pdf
index b04d784..b3ccbbb 100644
Binary files a/inst/doc/intro-vegan.pdf and b/inst/doc/intro-vegan.pdf differ
diff --git a/inst/doc/vegan.bib b/inst/doc/vegan.bib
deleted file mode 100644
index e27f367..0000000
--- a/inst/doc/vegan.bib
+++ /dev/null
@@ -1,99 +0,0 @@
- at Book{Sedgewick90,
- author = {R. Sedgewick},
- title = {Algorithms in {C}},
- publisher = {Addison Wesley},
- year = 1990}
-
- at Article{MiklosPod04,
- author = {I. Mikl{\'o}s and J. Podani},
- title = {Randomization of presence--absence matrices:
- comments and new algorithms},
- journal = {Ecology},
- year = 2004,
- volume = 85,
- pages = {86-92}}
-
- at Article{GotelliEnt01,
- author = {N. J. Gotelli and G. L. Entsminger},
- title = {Swap and fill algorithms in null model analysis:
- rethinking the knight's tour},
- journal = {Oecologia},
- year = 2001,
- volume = 129,
- pages = {281-291}}
-
- at Article{AtmarPat93,
- author = {W. Atmar and B. D. Patterson},
- title = {The measure of order and disorder in the
- distribution of species in fragmented habitat},
- journal = {Oecologia},
- year = 1993,
- volume = 96,
- pages = {373-382}
-}
-
- at Article{RodGir06,
- author = {M. A. Rodr{\'i}guez-Giron{\'e}s and L. Santamaria},
- title = {A new algorithm to calculate the nestedness
- temperature of presence--absence matrices},
- journal = {Journal of Biogeography},
- year = 2006,
- volume = 33,
- pages = {921-935}}
-
- at article{Palmer93,
- author = {M. W. Palmer},
- title = {Putting things in even better order: The advantages
- of canonical correspondence analysis},
- journal = {Ecology},
- volume = {74},
- pages = {2215-2230},
- year = {1993}
-}
- at article{McCune97,
- author = {B. McCune},
- title = {Influence of noisy environmental data on canonical
- correspondence analysis},
- journal = {Ecology},
- volume = {78},
- pages = {2617-2623},
- year = {1997}
-}
- at article{Braak86,
- author = {C. J. F. ter Braak},
- title = {Canonical correspondence analysis: a new eigenvector
- technique for multivariate direct gradient analysis},
- journal = {Ecology},
- volume = {67},
- pages = {1167-1179},
- year = {1986}
-}
- at Book{Legendre-Legendre98,
- author = {P. Legendre and L. Legendre},
- title = {Numerical ecology},
- publisher = {Elsevier},
- year = 1998,
- number = 20,
- series = {Developments in Environmental Modelling},
- address = {Amsterdam},
- edition = {2nd}
-}
- at book{Jongman87,
- author = {R. H. Jongman and C. J. F. ter Braak and
- O. F. R. van Tongeren},
- title = {Data analysis in community and landscape ecology},
- pages = {299},
- publisher = {Pudoc},
- address = {Wageningen},
- year = {1987}
-}
- at Manual{CANOCO4,
- title = {CANOCO reference manual and user's guide to Canoco
- for Windows: Software for canonical community
- ordination (version 4)},
- author = {C. J. F ter Braak and P. {\v S}milauer},
- organization = {Microcomputer Power},
- address = {Ithaca, NY},
- year = 1998
-}
-
diff --git a/inst/doc/veganjss.sty b/inst/doc/veganjss.sty
deleted file mode 100644
index 43f2773..0000000
--- a/inst/doc/veganjss.sty
+++ /dev/null
@@ -1,24 +0,0 @@
-%% macros to typeset vegan vignettes with jss.cls
-
-%% jss.cls does not collect toc info, but we redefine jss section and
-%% subsection commands to add contents line. Line of pdfbookmark can
-%% be removed, since toc is used for the purpose.
-\renewcommand{\jsssec}[2][default]{\vskip \preXLskip%
- %\pdfbookmark[1]{#1}{Section.\thesection.#1}%
- \refstepcounter{section}%
- \addcontentsline{toc}{section}{\protect\numberline{\thesection}#1}%
- \centerline{\textbf{\Large \thesection. #2}} \nopagebreak
- \vskip \postMskip \nopagebreak
-}
-\renewcommand{\jsssubsec}[2][default]{\vskip \preMskip%
- %\pdfbookmark[2]{#1}{Subsection.\thesubsection.#1}%
- \refstepcounter{subsection}%
- \addcontentsline{toc}{subsection}{\protect\numberline{\thesubsection}#1}%
- \textbf{\large \thesubsection. #2} \nopagebreak
- \vskip \postSskip \nopagebreak}
-
-%% use inconsolata fonts for code and examples
-\usepackage{inconsolata}
-%% smaller examples
-\renewenvironment{Schunk}{\par\small}{}
-
diff --git a/man/SSarrhenius.Rd b/man/SSarrhenius.Rd
index 05a976f..65bfa71 100644
--- a/man/SSarrhenius.Rd
+++ b/man/SSarrhenius.Rd
@@ -58,8 +58,8 @@ SSlomolino(area, Asym, xmid, slope)
The Lomolino model (\code{SSlomolino}) is
\code{Asym/(1 + slope^log(xmid/area))} (Lomolino 2000, Dengler 2009).
Parameter \code{Asym} is the asymptotic maximum number of species,
- \code{slope} is the maximum slope of increse of richness, and
- \code{xmid} is the area where half of the maximum richess is
+ \code{slope} is the maximum slope of increase of richness, and
+ \code{xmid} is the area where half of the maximum richness is
achieved.
In addition to these models, several other models studied by Dengler
diff --git a/man/adipart.Rd b/man/adipart.Rd
index 851b321..aabf01b 100644
--- a/man/adipart.Rd
+++ b/man/adipart.Rd
@@ -36,7 +36,7 @@ hiersimu(...)
gamma diversities.}
\item{formula}{A two sided model formula in the form \code{y ~ x},
where \code{y} is the community data matrix with samples as rows and
- species as column. Right hand side (\code{x}) must grouping vaiables
+ species as column. Right hand side (\code{x}) must be grouping variables
referring to levels of sampling hierarchy, terms from right to left
will be treated as nested (first column is the lowest, last is the
highest level, at least two levels specified). Interaction terms are
@@ -93,7 +93,7 @@ hiersimu(...)
At the highest sampling level, the diversity components are calculated
as \deqn{\beta_m = \gamma - \alpha_m}{beta_m = gamma - alpha_m} For
each lower sampling level as \deqn{\beta_i = \alpha_{i+1} -
- \alpha_i}{beta_i = alpha_i+1 - alpha_i} Then, the additive partition
+ \alpha_i}{beta_i = alpha_(i+1) - alpha_i} Then, the additive partition
of diversity is \deqn{\gamma = \alpha_1 + \sum_{i=1}^m \beta_i}{gamma
= alpha_1 + sum(beta_i)}
diff --git a/man/adonis.Rd b/man/adonis.Rd
index b7a21c1..0835e8b 100644
--- a/man/adonis.Rd
+++ b/man/adonis.Rd
@@ -127,7 +127,7 @@ overview of rules.
\item{coef.sites}{ matrix of coefficients of the linear model, with
rows representing sources of variation and columns representing
sites; each column represents a fit of a sites distances (from all
- other sites) to the linear model.These are what you get when you
+ other sites) to the linear model. These are what you get when you
fit distances of one site to
your predictors. }
\item{f.perms}{ an \eqn{N} by \eqn{m} matrix of the null \eqn{F}
@@ -199,7 +199,6 @@ dat
Agropyron <- with(dat, as.numeric(field) + as.numeric(NO3)+2) +rnorm(12)/2
Schizachyrium <- with(dat, as.numeric(field) - as.numeric(NO3)+2) +rnorm(12)/2
total <- Agropyron + Schizachyrium
-library(lattice)
dotplot(total ~ NO3, dat, jitter.x=TRUE, groups=field,
type=c('p','a'), xlab="NO3", auto.key=list(columns=3, lines=TRUE) )
diff --git a/man/anova.cca.Rd b/man/anova.cca.Rd
index 626bfaa..01fd184 100644
--- a/man/anova.cca.Rd
+++ b/man/anova.cca.Rd
@@ -132,9 +132,8 @@ permutest(x, ...)
\code{"permutest.cca"}, which has its own \code{print} method. The
distribution of permuted \eqn{F} values can be inspected with
\code{\link{density.permutest.cca}} function. The function
- \code{anova.cca} calls \code{permutest.cca}, fills an
- \code{\link{anova}} table and uses \code{\link{print.anova}} for
- printing.
+ \code{anova.cca} calls \code{permutest.cca} and fills an
+ \code{\link{anova}} table.
}
\note{
diff --git a/man/betadisper.Rd b/man/betadisper.Rd
index b34d087..2156299 100644
--- a/man/betadisper.Rd
+++ b/man/betadisper.Rd
@@ -6,6 +6,7 @@
\alias{plot.betadisper}
\alias{boxplot.betadisper}
\alias{TukeyHSD.betadisper}
+\alias{eigenvals.betadisper}
\alias{ordimedian}
\title{Multivariate homogeneity of groups dispersions (variances)}
@@ -33,6 +34,8 @@ betadisper(d, group, type = c("median","centroid"), bias.adjust = FALSE)
\method{scores}{betadisper}(x, display = c("sites", "centroids"),
choices = c(1,2), \dots)
+\method{eigenvals}{betadisper}(x, \dots)
+
\method{plot}{betadisper}(x, axes = c(1,2), cex = 0.7, hull = TRUE,
ylab, xlab, main, sub, \dots)
@@ -125,7 +128,7 @@ betadisper(d, group, type = c("median","centroid"), bias.adjust = FALSE)
comparison of group dispersions, is to calculate Tukey's Honest
Significant Differences between groups, via
\code{TukeyHSD.betadisper}. This is a simple wrapper to
- \code{\link{TukeyHSD.aov}}. The user is directed to read the help file
+ \code{\link{TukeyHSD}}. The user is directed to read the help file
for \code{\link{TukeyHSD}} before using this function. In particular,
note the statement about using the function with
unbalanced designs.
@@ -143,7 +146,7 @@ betadisper(d, group, type = c("median","centroid"), bias.adjust = FALSE)
will be biased downward. This bias matters most when comparing diversity
among treatments with small, unequal numbers of samples. Setting
\code{bias.adjust=TRUE} when using \code{betadisper} imposes a
- \eqn{\sqrt{n/(n-1)}}{sqrt(n/(n-1))} correction (Stier et al. 2012).
+ \eqn{\sqrt{n/(n-1)}}{sqrt(n/(n-1))} correction (Stier et al. 2013).
}
\value{
The \code{anova} method returns an object of class \code{"anova"}
@@ -160,6 +163,8 @@ betadisper(d, group, type = c("median","centroid"), bias.adjust = FALSE)
The \code{boxplot} function invisibly returns a list whose components
are documented in \code{\link[graphics]{boxplot}}.
+ \code{eigenvals.betadisper} returns a named vector of eigenvalues.
+
\code{TukeyHSD.betadisper} returns a list. See \code{\link{TukeyHSD}}
for further details.
@@ -209,9 +214,9 @@ betadisper(d, group, type = c("median","centroid"), bias.adjust = FALSE)
Test of Homogeneity of Variance. \emph{Australian & New Zealand Journal of
Statistics} \strong{42}, 81-–100.
- Stier, A.C., Geange, S.W., Hanson, K.M., & Bolker, B.M. (2012) Predator
- density and timing of arrival affect reef fish community assembly. Ms.
- in revision, \emph{Oikos}.
+ Stier, A.C., Geange, S.W., Hanson, K.M., & Bolker, B.M. (2013) Predator
+ density and timing of arrival affect reef fish community
+ assembly. \emph{Ecology} \strong{94}, 1057--1068.
}
\author{Gavin L. Simpson; bias correction by Adrian Stier and Ben Bolker.}
\seealso{\code{\link{permutest.betadisper}}, \code{\link[stats]{anova.lm}},
@@ -251,6 +256,23 @@ plot(mod, axes = c(3,1))
## Draw a boxplot of the distances to centroid for each group
boxplot(mod)
+## `scores` and `eigenvals` also work
+scrs <- scores(mod)
+str(scrs)
+head(scores(mod, 1:4, display = "sites"))
+# group centroids/medians
+scores(mod, 1:4, display = "centroids")
+# eigenvalues from the underlying principal coordinates analysis
+eigenvals(mod)
+
+## try out bias correction; compare with mod3
+(mod3B <- betadisper(dis, groups, type = "median", bias.adjust=TRUE))
+
+## should always work for a single group
+group <- factor(rep("grazed", NROW(varespec)))
+(tmp <- betadisper(dis, group, type = "median"))
+(tmp <- betadisper(dis, group, type = "centroid"))
+
## simulate missing values in 'd' and 'group'
## using spatial medians
groups[c(2,20)] <- NA
@@ -272,9 +294,6 @@ plot(mod3)
boxplot(mod3)
plot(TukeyHSD(mod3))
-## try out bias correction; compare with mod3
-(mod3B <- betadisper(dis, groups, type = "median", bias.adjust=TRUE))
-
}
\keyword{methods}
\keyword{multivariate}
diff --git a/man/cca.Rd b/man/cca.Rd
index 59cbcd0..ba58041 100644
--- a/man/cca.Rd
+++ b/man/cca.Rd
@@ -228,7 +228,7 @@
finding influence statistics (\code{\link{lm.influence}},
\code{\link{cooks.distance}} etc.).
- Permutation based signficance for the overall model, single
+ Permutation based significance for the overall model, single
constraining variables or axes can be found with
\code{\link{anova.cca}}. Automatic model building with \R{}
\code{\link{step}} function is possible with
@@ -239,7 +239,7 @@
\code{\link{simulate.cca}}.
Separate methods based on constrained ordination model are principal
- response curves (\code{\link{prc}}) and variance partioning between
+ response curves (\code{\link{prc}}) and variance partitioning between
several components (\code{\link{varpart}}).
Design decisions are explained in \code{\link{vignette}}
diff --git a/man/clamtest.Rd b/man/clamtest.Rd
index ec1279e..3d65d76 100644
--- a/man/clamtest.Rd
+++ b/man/clamtest.Rd
@@ -132,7 +132,7 @@ The original method (Chazdon et al. 2011) has two major problems:
\item The original authors suggest that multiple testing adjustment
for multiple testing should be based on the number of points
(\code{npoints}) used to draw the critical lines on the plot,
- whereas the adjustment should be based on the number tests (i.e,
+ whereas the adjustment should be based on the number of tests (i.e.,
tested species). The function uses the same numerical values as
the original paper, but there is no automatic connection between
\code{npoints} and \code{alpha} arguments, but you must work out
diff --git a/man/density.adonis.Rd b/man/density.adonis.Rd
index e6ec5f0..c8acf6d 100644
--- a/man/density.adonis.Rd
+++ b/man/density.adonis.Rd
@@ -72,10 +72,10 @@
standard \code{plot} of \code{densiy} objects, but can also add a
vertical line for the observed statistic.
- Functions that can return several permuted statistics simultaenously
+ Functions that can return several permuted statistics simultaneously
also have \code{\link[lattice]{densityplot}} method
- (\code{\link{adonis}}, \code{\link{oecosimu}} and diversity partioning
- functions based on \code{oecosimu}). The standard
+ (\code{\link{adonis}}, \code{\link{oecosimu}} and diversity
+ partitioning functions based on \code{oecosimu}). The standard
\code{\link{density}} can only handle univariate data, and a warning
is issued if the function is used for a model with several observed
statistics. The \code{\link[lattice]{densityplot}} method is available
@@ -106,7 +106,6 @@ data(dune)
data(dune.env)
mod <- adonis(dune ~ Management, data = dune.env)
plot(density(mod))
-library(lattice)
mod <- adonis(dune ~ Management * Moisture, dune.env)
densityplot(mod)
}
diff --git a/man/eventstar.Rd b/man/eventstar.Rd
index 722f962..c5378fd 100644
--- a/man/eventstar.Rd
+++ b/man/eventstar.Rd
@@ -34,7 +34,7 @@ This value was proposed by Mendes et al. (2008) as \eqn{q^*}{q*}.
The \eqn{q^\ast}{q*} index represents the scale parameter of
the one parameter Tsallis diversity family that leads to
the greatest deviation from the maximum equitability given the relative
-abundance vactor of a community.
+abundance vector of a community.
The value of \eqn{q^\ast}{q*} is found by identifying the minimum
of the evenness profile over scaling factor \eqn{q}{q} by
diff --git a/man/make.cepnames.Rd b/man/make.cepnames.Rd
index 4ffca95..bd3c384 100644
--- a/man/make.cepnames.Rd
+++ b/man/make.cepnames.Rd
@@ -26,7 +26,7 @@ make.cepnames(names, seconditem = FALSE)
formed by taking four first letters of the generic name and four
first letters of the specific or subspecific epithet. The current
function first makes valid \R names using \code{\link{make.names}},
- and then splits these into elemets. The CEP name is made by taking
+ and then splits these into elements. The CEP name is made by taking
the four first letters of the first element, and four first letters
of the last (default) or the second element (with
\code{seconditem = TRUE}). If there was only one name element, it is
diff --git a/man/mantel.correlog.Rd b/man/mantel.correlog.Rd
index 745e4f4..a5141c9 100644
--- a/man/mantel.correlog.Rd
+++ b/man/mantel.correlog.Rd
@@ -168,4 +168,5 @@ plot(mite.correlog2)
}
-\keyword{ multivariate }
\ No newline at end of file
+\keyword{ multivariate }
+
diff --git a/man/model.matrix.cca.Rd b/man/model.matrix.cca.Rd
index e25a144..edb5040 100644
--- a/man/model.matrix.cca.Rd
+++ b/man/model.matrix.cca.Rd
@@ -37,8 +37,8 @@
of the original model are unavailable.
}
\value{
- Returns a data frame (\code{model.frame}) or an unnnamed matrix or a list
- of two matrices called \code{Constraints} and \code{Conditions}
+ Returns a data frame (\code{model.frame}) or an unnamed matrix or a
+ list of two matrices called \code{Constraints} and \code{Conditions}
(\code{model.matrix}).
}
\author{
diff --git a/man/monoMDS.Rd b/man/monoMDS.Rd
index 1b20709..ffa4c62 100644
--- a/man/monoMDS.Rd
+++ b/man/monoMDS.Rd
@@ -137,7 +137,7 @@ monoMDS(dist, y, k = 2, model = c("global", "local", "linear", "hybrid"),
square and to rotate the axes (argument \code{pc}) to principal
components so that the first dimension shows the major variation.
It is possible to rotate the solution so that the first axis is
- parallel to a given environmental variable using fuction
+ parallel to a given environmental variable using function
\code{\link{metaMDSrotate}}.
}
diff --git a/man/mrpp.Rd b/man/mrpp.Rd
index b874e40..027b2bc 100644
--- a/man/mrpp.Rd
+++ b/man/mrpp.Rd
@@ -98,7 +98,7 @@ meandist(dist, grouping, ...)
counts. Function \code{summary} finds the within-class, between-class
and overall means of these dissimilarities, and the MRPP statistics
with all \code{weight.type} options and the Classification Strength,
- CS (Van Sickle and Hughes, 2000). CS is defined for dissimiliraties as
+ CS (Van Sickle and Hughes, 2000). CS is defined for dissimilarities as
\eqn{\bar{B} - \bar{W}}{Bbar-Wbar}, where \eqn{\bar{B}}{Bbar} is the
mean between cluster dissimilarity and \eqn{\bar{W}}{Wbar} is the mean
within cluster dissimilarity with \code{weight.type = 1}. The function
@@ -113,7 +113,7 @@ meandist(dist, grouping, ...)
function \code{\link{hclust}}. The terminal segments hang to
within-cluster dissimilarity. If some of the clusters are more
heterogeneous than the combined class, the leaf segment are reversed.
- The histograms are based on dissimilarites, but ore otherwise similar
+ The histograms are based on dissimilarities, but ore otherwise similar
to those of Van Sickle and Hughes (2000): horizontal line is drawn at
the level of mean between-cluster dissimilarity and vertical lines
connect within-cluster dissimilarities to this line. }
diff --git a/man/multipart.Rd b/man/multipart.Rd
index eace009..1ea62c8 100644
--- a/man/multipart.Rd
+++ b/man/multipart.Rd
@@ -25,7 +25,7 @@ multipart(...)
all rows are in the same group in the second level.}
\item{formula}{A two sided model formula in the form \code{y ~ x}, where \code{y}
is the community data matrix with samples as rows and species as column. Right
- hand side (\code{x}) must grouping vaiables referring to levels of sampling hierarchy,
+ hand side (\code{x}) must be grouping variables referring to levels of sampling hierarchy,
terms from right to left will be treated as nested (first column is the lowest,
last is the highest level, at least two levels specified). Interaction terms are not allowed.}
\item{data}{A data frame where to look for variables defined in the right hand side
diff --git a/man/nobs.adonis.Rd b/man/nobs.adonis.Rd
index 5450728..e7eca9c 100644
--- a/man/nobs.adonis.Rd
+++ b/man/nobs.adonis.Rd
@@ -38,7 +38,7 @@
\code{\link{isomap}}, \code{\link{metaMDS}}, \code{\link{pcnm}},
\code{\link{procrustes}}, \code{\link{radfit}},
\code{\link{varpart}} and \code{\link{wcmdscale}}. } \value{ A
- single number, normally an interger, giving the number of
+ single number, normally an integer, giving the number of
observations. }
\author{
diff --git a/man/oecosimu.Rd b/man/oecosimu.Rd
index ce4ef5e..238a359 100644
--- a/man/oecosimu.Rd
+++ b/man/oecosimu.Rd
@@ -251,14 +251,17 @@ commsimulator(x, method, thin=1)
## Use the first eigenvalue of correspondence analysis as an index
## of structure: a model for making your own functions.
data(sipoo)
-out <- oecosimu(sipoo, decorana, "swap", burnin=100, thin=10, statistic="evals")
+## Traditional nestedness statistics (number of checkerboard units)
+oecosimu(sipoo, nestedchecker, "r0")
+## sequential model, one-sided test, a vector statistic
+out <- oecosimu(sipoo, decorana, "swap", burnin=100, thin=10,
+ statistic="evals", alt = "greater")
out
## Inspect the swap sequence as a time series object
plot(as.ts(out))
lag.plot(as.ts(out))
acf(as.ts(out))
-## Density plot: needs lattice
-require(lattice)
+## Density plot
densityplot(out, as.table = TRUE)
## Use quantitative null models to compare
## mean Bray-Curtis dissimilarities
diff --git a/man/ordipointlabel.Rd b/man/ordipointlabel.Rd
index 8f6c0db..b49f209 100644
--- a/man/ordipointlabel.Rd
+++ b/man/ordipointlabel.Rd
@@ -1,5 +1,6 @@
\name{ordipointlabel}
\alias{ordipointlabel}
+\alias{plot.ordipointlabel}
\title{ Ordination Plots with Points and Optimized Locations for Text }
\description{
@@ -13,10 +14,14 @@
ordipointlabel(x, display = c("sites", "species"), choices = c(1, 2),
col = c(1, 2), pch = c("o", "+"), font = c(1, 1),
cex = c(0.8, 0.8), add = FALSE, select, ...)
+
+\method{plot}{ordipointlabel}(x, ...)
}
\arguments{
- \item{x}{A result object from ordination. }
+ \item{x}{For \code{ordipointlabel()} a result object from an
+ ordination function. For \code{plot.ordipointlabel} an object
+ resulting from a call to \code{ordipointlabel()}.}
\item{display}{Scores displayed in the plot. }
\item{choices}{Axes shown. }
\item{col, pch, font, cex}{Colours, point types, font style and
@@ -56,9 +61,14 @@ ordipointlabel(x, display = c("sites", "species"), choices = c(1, 2),
label. In addition, it returns the result of \code{\link{optim}} as
an attribute \code{"optim"}. The unit of overlap is the area
of character \code{"m"}, and with variable \code{cex} it is the
- smallest alternative. The result object inherits from
- \code{\link{orditkplot}} result, and can be replotted with its
- \code{plot} command. It may be possible to further edit the result
+ smallest alternative.
+
+ There is a \code{plot} method based on \code{orditkplot} but which
+ does not alter nor reset the graphical parameters via \code{par}.
+
+ The result object from \code{ordipointlabel} inherits from
+ \code{\link{orditkplot}}, and can also be replotted with its
+ \code{plot} method. It may be possible to further edit the result
object with \code{\link{orditkplot}}, but for good results it is
necessary that the points span the whole horizontal axis without empty
margins.
@@ -74,7 +84,18 @@ ordipointlabel(x, display = c("sites", "species"), choices = c(1, 2),
\examples{
data(dune)
ord <- cca(dune)
-ordipointlabel(ord)
+plt <- ordipointlabel(ord)
+
+## set scaling - should be no warnings!
+ordipointlabel(ord, scaling = 1)
+
+## plot then add
+plot(ord, scaling = 3, type = "n")
+ordipointlabel(ord, display = "species", scaling = 3, add = TRUE)
+ordipointlabel(ord, display = "sites", scaling = 3, add = TRUE)
+
+## redraw plot without rerunning SANN optimisation
+plot(plt)
}
\keyword{ hplot }
\keyword{ aplot }
diff --git a/man/ordistep.Rd b/man/ordistep.Rd
index 1fb5f80..430774b 100644
--- a/man/ordistep.Rd
+++ b/man/ordistep.Rd
@@ -99,7 +99,7 @@ ordiR2step(object, scope, direction = c("both", "forward"),
al. 2008). The second criterion is ignored with option
\code{R2step = FALSE}, and the third criterion can be ignored setting
\code{Pin = 1} (or higher). The \code{direction} has choices
- \code{"forward"} and \code{"both"}, but it is very excepctional that a
+ \code{"forward"} and \code{"both"}, but it is very exceptional that a
term is dropped with the adjusted \eqn{R^2}{R2} criterion. Function
uses adjusted \eqn{R^2}{R2} as the criterion, and it cannot be used if
the criterion cannot be calculated. Therefore it is unavailable for
diff --git a/man/ordisurf.Rd b/man/ordisurf.Rd
index 2260d4c..2641c9b 100644
--- a/man/ordisurf.Rd
+++ b/man/ordisurf.Rd
@@ -11,11 +11,13 @@
plots the result on ordination diagram.
}
\usage{
-\method{ordisurf}{default}(x, y, choices=c(1, 2), knots=10, family="gaussian", col="red",
- thinplate = TRUE, add = FALSE, display = "sites",
- w = weights(x), main, nlevels = 10, levels, labcex = 0.6,
- bubble = FALSE, cex = 1, select = FALSE, method = "GCV.Cp",
- gamma = 1, plot = TRUE, ...)
+\method{ordisurf}{default}(x, y, choices = c(1, 2), knots = 10,
+ family = "gaussian", col = "red", isotropic = TRUE,
+ thinplate = TRUE, bs = "tp", fx = FALSE, add = FALSE,
+ display = "sites", w = weights(x), main, nlevels = 10,
+ levels, npoints = 31, labcex = 0.6, bubble = FALSE,
+ cex = 1, select = TRUE, method = "REML", gamma = 1,
+ plot = TRUE, lwd.cl = par("lwd"), ...)
\method{ordisurf}{formula}(formula, data, ...)
@@ -23,25 +25,46 @@
\method{plot}{ordisurf}(x, what = c("contour","persp","gam"),
add = FALSE, bubble = FALSE, col = "red", cex = 1,
- nlevels = 10, levels, labcex = 0.6, \dots)
+ nlevels = 10, levels, labcex = 0.6, lwd.cl = par("lwd"), \dots)
}
\arguments{
\item{x}{For \code{ordisurf} an ordination configuration, either a
matrix or a result known by \code{\link{scores}}. For
- \code{plot.ordisurf} and object of class \code{"ordisurf"} as
+ \code{plot.ordisurf} an object of class \code{"ordisurf"} as
returned by \code{ordisurf}.}
- \item{y}{ Variable to be plotted. }
+ \item{y}{Variable to be plotted / modelled as a function of the
+ ordination scores.}
\item{choices}{Ordination axes. }
\item{knots}{Number of initial knots in \code{\link[mgcv]{gam}} (one
more than degrees of freedom). If \code{knots = 0} or
\code{knots = 1} the function will fit a linear trend surface, and
if \code{knots = 2} the function will fit a quadratic trend surface
- instead of a smooth surface. }
- \item{family}{ Error distribution in \code{\link[mgcv]{gam}}. }
+ instead of a smooth surface. A vector of length 2 is allowed when
+ \code{isotropic = FALSE}, with the first and second elements of
+ \code{knots} referring to the first and second of ordination
+ dimensions (as indicated by \code{choices}) respectively.}
+ \item{family}{Error distribution in \code{\link[mgcv]{gam}}.}
\item{col}{ Colour of contours. }
- \item{thinplate}{Use thinplate splines in \code{\link[mgcv]{gam}}.}
- \item{add}{Add contours on an existing diagram or draw a new plot. }
+ \item{isotropic, thinplate}{Fit an isotropic smooth surface (i.e. same
+ smoothness in both ordination dimensions) via
+ \code{\link[mgcv]{gam}}. Use of \code{thinplate} is deprecated and
+ will be removed in a future version of the package.}
+ \item{bs}{a two letter character string indicating the smoothing basis
+ to use. (eg \code{"tp"} for thin plate regression spline,
+ \code{"cr"} for cubic regression spline). One of \code{c("tp", "ts",
+ "cr", "cs", "ds", "ps", "ad")}. See
+ \code{\link[mgcv]{smooth.terms}} for an over view of what these
+ refer to. The default is to use thin plate splines: \code{bs = "tp"}.}
+ \item{fx}{indicates whether the smoothers are fixed degree of freedom
+ regression splines (\code{fx = FALSE}) or penalised regression
+ splines (\code{fx = TRUE}). Can be a vector of length 2 for
+ anisotropic surfaces (\code{isotropic = FALSE}). It doesn't make
+ sense to use \code{fx = TRUE} \strong{and} \code{select = TRUE} and
+ it is an \strong{error} to do so. A warning is issued if you specify
+ \code{fx = TRUE} and forget to use \code{select = FALSE} though
+ fitting continues using \code{select = FALSE}.}
+ \item{add}{Add contours to an existing diagram or draw a new plot?}
\item{display}{Type of scores known by \code{\link{scores}}: typically
"sites" for ordinary site scores or "lc" for linear combination scores.}
\item{w}{Prior weights on the data. Concerns mainly \code{\link{cca}}
@@ -49,11 +72,14 @@
\item{main}{The main title for the plot, or as default the name of
plotted variable in a new plot.}
\item{nlevels, levels}{Either a vector of \code{levels} for which contours
- are drawn, or suggested number of contours in
- \code{nlevels} if \code{levels} are not supplied.}
+ are drawn, or suggested number of contours in \code{nlevels} if
+ \code{levels} are not supplied.}
+ \item{npoints}{numeric; the number of locations at which to evaluate
+ the fitted surface. This represents the number of locations in each
+ dimension.}
\item{labcex}{Label size in contours. Setting this zero will suppress
labels.}
- \item{bubble}{Use \dQuote{bubble plot} for points, or vary the point
+ \item{bubble}{Use a \dQuote{bubble plot} for points, or vary the point
diameter by the value of the plotted variable. If \code{bubble} is
numeric, its value is used for the maximum symbol size (as in
\code{cex}), or if \code{bubble = TRUE}, the value of \code{cex} gives
@@ -78,12 +104,14 @@
of the scale.}
\item{gamma}{Multiplier to inflate model degrees of freedom in GCV or
UBRE/AIC score by. This effectively places an extra penalty on
- complex models. An oft used value if \code{gamma = 1.4}.}
+ complex models. An oft-used value is \code{gamma = 1.4}.}
\item{plot}{logical; should any plotting be done by
\code{ordisurf}? Useful if all you want is the fitted response
surface model.}
+ \item{lwd.cl}{numeric; the \code{lwd} (line width) parameter to use
+ when drawing the contour lines.}
\item{formula, data}{Alternative definition of the fitted model as
- \code{x ~ y}, or left-hand side is the ordination \code{x} and
+ \code{x ~ y}, where left-hand side is the ordination \code{x} and
right-hand side the single fitted continuous variable
\code{y}. The variable \code{y} must be in the working environment
or in the data frame or environment given by \code{data}. All
@@ -98,44 +126,52 @@
details. \code{"gam"} plots the fitted GAM model, an object that
inherits from class \code{"gam"} returned by \code{ordisurf}, see
\code{\link[mgcv]{plot.gam}}.}
- \item{\dots}{Other parameters passed to \code{\link[mgcv]{gam}}, or
+ \item{\dots}{Other parameters passed to \code{\link{scores}}, or
to the graphical functions. See Note below for exceptions.}
}
\details{
- Function \code{ordisurf} fits a smooth surface using thinplate
+ Function \code{ordisurf} fits a smooth surface using penalised
splines (Wood 2003) in \code{\link[mgcv]{gam}}, and uses
\code{\link[mgcv]{predict.gam}} to find fitted values in a regular
grid. The smooth surface can be fitted with an extra penalty that
allows the entire smoother to be penalized back to 0 degrees of
freedom, effectively removing the term from the model (see Marra &
Wood, 2011). The addition of this extra penalty is invoked by
- setting argument \code{select} to \code{TRUE}. The function plots
- the fitted contours with convex hull of data points either over an
- existing ordination diagram or draws a new plot. If
- \code{select = TRUE} and the smooth is effectively penalised out of
+ setting argument \code{select} to \code{TRUE}. An alternative is to
+ use a spline basis that includes shrinkage (\code{bs = "ts"} or
+ \code{bs = "cs"}).
+
+ \code{ordisurf()} exposes a large number of options from
+ \code{\link[mgcv]{gam}} for specifying the basis functions used for
+ the surface. If you stray from the defaults, do read the
+ \strong{Notes} section below and relevant documentation in
+ \code{\link[mgcv]{s}} and \code{\link[mgcv]{smooth.terms}}.
+
+ The function plots the fitted contours with convex hull of data points
+ either over an existing ordination diagram or draws a new plot. If
+ \code{select = TRUE} and the smooth is effectively penalised out of
the model, no contours will be plotted.
\code{\link[mgcv]{gam}} determines the degree of smoothness for the
- fitted response surface during model fitting. Argument \code{method}
- controls how \code{\link[mgcv]{gam}} performs this smoothness
- selection. See \code{\link[mgcv]{gam}} for details of the available
- options. Using \code{"REML"} or \code{"ML"} yields p-values for
- smooths with the best coverage properties if such things matter to
- you.
+ fitted response surface during model fitting, unless \code{fx =
+ TRUE}. Argument \code{method} controls how \code{\link[mgcv]{gam}}
+ performs this smoothness selection. See \code{\link[mgcv]{gam}} for
+ details of the available options. Using \code{"REML"} or \code{"ML"}
+ yields p-values for smooths with the best coverage properties if such
+ things matter to you.
The function uses \code{\link{scores}} to extract ordination scores,
and \code{x} can be any result object known by that function.
- User can supply a vector of prior weights \code{w}. If the ordination
- object has weights, these will be used. In practise this means that
- the row totals are used as weights with
- \code{\link{cca}} or
- \code{\link{decorana}} results. If you do not like this, but want to give
- equal weights to all sites, you should set \code{w = NULL}. The
- behaviour is consistent with \code{\link{envfit}}. For complete
- accordance with constrained \code{\link{cca}}, you should set
+ The user can supply a vector of prior weights \code{w}. If the
+ ordination object has weights, these will be used. In practise this
+ means that the row totals are used as weights with \code{\link{cca}}
+ or \code{\link{decorana}} results. If you do not like this, but want
+ to give equal weights to all sites, you should set \code{w =
+ NULL}. The behaviour is consistent with \code{\link{envfit}}. For
+ complete accordance with constrained \code{\link{cca}}, you should set
\code{display = "lc"} (and possibly \code{scaling = 2}).
Function \code{calibrate} returns the fitted values of the response
@@ -146,24 +182,45 @@
}
\value{
- Function is usually called for its side effect of drawing the
- contour plot. The function returns the result object of class
+ \code{ordisurf} is usually called for its side effect of drawing the
+ contour plot. The function returns a result object of class
\code{"ordisurf"} that inherits from \code{\link[mgcv]{gam}} used
internally to fit the surface, but adds an item \code{grid} that
contains the data for the grid surface. The item \code{grid} has
elements \code{x} and \code{y} which are vectors of axis coordinates,
and element \code{z} that is a matrix of fitted values for
\code{\link{contour}}. The values outside the convex hull of observed
- points are \code{NA} in \code{z}. The \code{\link[mgcv]{gam}}
- component of the result can be used for further analysis like
- predicting new values (see \code{\link[mgcv]{predict.gam}}).
+ points are indicated as \code{NA} in \code{z}. The
+ \code{\link[mgcv]{gam}} component of the result can be used for
+ further analysis like predicting new values (see
+ \code{\link[mgcv]{predict.gam}}).
}
\author{ Dave Roberts, Jari Oksanen and Gavin L. Simpson }
\note{
- The default is to use thinplate splines. These make sense in
- ordination as they have equal smoothing in all directions and are
- rotation invariant.
+ The default is to use an isotropic smoother via
+ \code{\link[mgcv]{s}} employing thin plate regression splines
+ (\code{bs = "tp"}). These make sense in ordination as they have
+ equal smoothing in all directions and are rotation invariant. However,
+ if different degrees of smoothness along dimensions are required, an
+ anisotropic smooth surface may be more applicable. This can be
+ achieved through the use of \code{isotropic = FALSE}, wherein the
+ surface is fitted via a tensor product smoother via
+ \code{\link[mgcv]{te}} (unless \code{bs = "ad"}, in which case
+ separate splines for each dimension are fitted using
+ \code{\link[mgcv]{s}}).
+
+ Cubic regression splines and P splines can \strong{only} be used with
+ \code{isotropic = FALSE}.
+
+ Adaptive smooths (\code{bs = "ad"}), especially in two dimensions,
+ require a large number of observations; without many hundreds of
+ observations, the default complexities for the smoother will exceed
+ the number of observations and fitting will fail.
+
+ To get the old behaviour of \code{ordisurf} use \code{select = FALSE},
+ \code{method = "GCV.Cp"}, \code{fx = FALSE}, and \code{bs = "tp"}. The
+ latter two options are the current defaults.
Graphical arguments supplied to \code{plot.ordisurf} are passed on to
the underlying plotting functions, \code{contour}, \code{persp}, and
@@ -177,6 +234,20 @@
illustration of this.
}
+\section{Warning}{
+ The fitted GAM is a regression model and has the usual assumptions of
+ such models. Of particular note is the assumption of independence of
+ residuals. If the observations are not independent (e.g. they are
+ repeat measures on a set of objects, or from an experimental design,
+ \emph{inter alia}) do not trust the \emph{p}-values from the GAM
+ output.
+
+ If you need further control (i.e. to add additional fixed effects to
+ the model, or use more complex smoothers), extract the ordination
+ scores using the \code{scores} function and then generate your own
+ \code{\link[mgcv]{gam}} call.
+}
+
\references{
Marra, G.P & Wood, S.N. (2011) Practical variable selection for
@@ -200,15 +271,28 @@ vare.dist <- vegdist(varespec)
vare.mds <- monoMDS(vare.dist)
with(varechem, ordisurf(vare.mds, Baresoil, bubble = 5))
-## as above but with extra penalties on smooth terms:
-with(varechem, ordisurf(vare.mds, Baresoil, bubble = 5, col = "blue",
- add = TRUE, select = TRUE))
+## as above but without the extra penalties on smooth terms,
+## and using GCV smoothness selection (old behaviour of `ordisurf()`):
+with(varechem, ordisurf(vare.mds, Baresoil,col = "blue", add = TRUE,
+ select = FALSE, method = "GCV.Cp"))
## Cover of Cladina arbuscula
fit <- with(varespec, ordisurf(vare.mds, Cla.arb, family=quasipoisson))
## Get fitted values
calibrate(fit)
+## Variable selection via additional shrinkage penalties
+## This allows non-significant smooths to be selected out
+## of the model not just to a linear surface. There are 2
+## options available:
+## - option 1: `select = TRUE` --- the *default*
+with(varechem,
+ ordisurf(vare.mds, Baresoil, method = "REML", select = TRUE))
+## - option 2: use a basis with shrinkage
+with(varechem,
+ ordisurf(vare.mds, Baresoil, method = "REML", bs = "ts"))
+## or bs = "cs" with `isotropic = FALSE`
+
## Plot method
plot(fit, what = "contour")
@@ -217,6 +301,25 @@ plot(fit, what = "gam") ## 'col' and 'cex' not passed on
## or via plot.gam directly
plot.gam(fit, cex = 2, pch = 1, col = "blue")
## 'col' effects all objects drawn...
+
+### controlling the basis functions used
+## Use Duchon splines
+with(varechem, ordisurf(vare.mds, Baresoil, bs = "ds"))
+
+## A fixed degrees of freedom smooth, must use 'select = FALSE'
+with(varechem, ordisurf(vare.mds, Baresoil, knots = 4,
+ fx = TRUE, select = FALSE))
+
+## An anisotropic smoother with cubic regression spline bases
+with(varechem, ordisurf(vare.mds, Baresoil, isotropic = FALSE,
+ bs = "cr", knots = 4))
+
+## An anisotropic smoother with cubic regression spline with
+## shrinkage bases & different degrees of freedom in each dimension
+with(varechem, ordisurf(vare.mds, Baresoil, isotropic = FALSE,
+ bs = "cs", knots = c(3,4), fx = TRUE,
+ select = FALSE))
+
}
\keyword{ multivariate }
\keyword{ aplot }
diff --git a/man/pcnm.Rd b/man/pcnm.Rd
index c0223ab..7906479 100644
--- a/man/pcnm.Rd
+++ b/man/pcnm.Rd
@@ -33,9 +33,9 @@ pcnm(dis, threshold, w, dist.ret = FALSE)
distance has a huge influence on the PCNM vectors. The default is to
use the longest distance to keep data connected. The distances above
truncation threshold are given an arbitrary value of 4 times
- threshold. For regular data, the first PCNM vectorsshow a wide scale
+ threshold. For regular data, the first PCNM vectors show a wide scale
variation and later PCNM vectors show smaller scale variation (Borcard
- & Legendre 2002), but for irregular data the intepretation is not as
+ & Legendre 2002), but for irregular data the interpretation is not as
clear.
The PCNM functions are used to express distances in rectangular form
@@ -51,7 +51,7 @@ pcnm(dis, threshold, w, dist.ret = FALSE)
The function is based on \code{pcnm} function in Dray's unreleased
\pkg{spacemakeR} package. The differences are that the current
- function usesr \code{\link{spantree}} as an internal support
+ function uses \code{\link{spantree}} as an internal support
function. The current function also can use prior weights for rows by
using weighted metric scaling of \code{\link{wcmdscale}}. The use of
row weights allows finding orthonormal PCNMs also for correspondence
diff --git a/man/prc.Rd b/man/prc.Rd
index d9c425a..0682868 100644
--- a/man/prc.Rd
+++ b/man/prc.Rd
@@ -102,7 +102,7 @@ prc(response, treatment, time, ...)
\section{Warning }{The first level of \code{treatment} must be the
control: use function \code{\link{relevel}} to guarantee the correct
- refence level. The current version will ignore user setting of
+ reference level. The current version will ignore user setting of
\code{\link{contrasts}} and always use treatment contrasts
(\code{\link{contr.treatment}}). The \code{time} must be an unordered
factor. }
diff --git a/man/predict.cca.Rd b/man/predict.cca.Rd
index 246cb5c..f06bbd8 100644
--- a/man/predict.cca.Rd
+++ b/man/predict.cca.Rd
@@ -112,7 +112,7 @@
for sites from environmental data. In that case the new data frame
must contain all constraining and conditioning environmental variables
of the model formula. With \code{type = "response"} or
- \code{type = "working"} the new data must contain envinronmental variables
+ \code{type = "working"} the new data must contain environmental variables
if constrained component is desired, and community data matrix if
residual or unconstrained component is desired. With these types, the
function uses \code{newdata} to find new \code{"lc"} (constrained) or
diff --git a/man/radfit.Rd b/man/radfit.Rd
index 8993334..47e075e 100644
--- a/man/radfit.Rd
+++ b/man/radfit.Rd
@@ -197,7 +197,7 @@ as.rad(x)
\code{\link{coef}}, \code{\link{deviance}}, \code{\link{logLik}}. In
addition the fit results can be accessed with \code{\link{fitted}},
\code{\link{predict}} and \code{\link{residuals}} (inheriting from
- \code{\link{residuals.glm}}).The graphical functions were discussed
+ \code{\link{residuals.glm}}). The graphical functions were discussed
above in Details.
}
diff --git a/man/specaccum.Rd b/man/specaccum.Rd
index 9beacf6..896ef71 100644
--- a/man/specaccum.Rd
+++ b/man/specaccum.Rd
@@ -191,8 +191,8 @@ fitspecaccum(object, model, method = "random", ...)
Kindt R., Van Damme, P. & Simons, A.J. (2006) Patterns of species
richness at varying scales in western Kenya: planning for
- agroecosystem diversification. \emph{Biodiversity and Conservation}, online
- first: DOI 10.1007/s10531-005-0311-9
+ agroecosystem diversification. \emph{Biodiversity and Conservation},
+ 10: 3235--3249.
Ugland, K.I., Gray, J.S. & Ellingsen, K.E. (2003). The
species-accumulation curve and estimation of species richness. \emph{Journal
diff --git a/man/varpart.Rd b/man/varpart.Rd
index edee8e9..18629fb 100644
--- a/man/varpart.Rd
+++ b/man/varpart.Rd
@@ -10,12 +10,13 @@
\title{Partition the Variation of Community Matrix by 2, 3, or 4 Explanatory Matrices }
-\description{ The function partitions the variation of response table Y
-with respect to two, three, or four explanatory tables, using
-redundancy analysis ordination (RDA). If Y contains a single
-vector, partitioning is by partial regression. Collinear variables in the
-explanatory tables do NOT have to be removed prior to
-partitioning.
+\description{
+ The function partitions the variation of response table Y with
+ respect to two, three, or four explanatory tables, using adjusted
+ \eqn{R^2}{R-squared} in redundancy analysis ordination (RDA). If Y
+ contains a single vector, partitioning is by partial regression.
+ Collinear variables in the explanatory tables do NOT have to be
+ removed prior to partitioning.
}
\usage{
@@ -65,17 +66,14 @@ table. }
effects. If \code{Y} is a multicolumn data frame or
matrix, the partitioning is based on redundancy analysis (RDA, see
\code{\link{rda}}), and if \code{Y} is a single variable, the
- partitioning is based on linear regression. A simplified, fast
- version of RDA is used (function \code{simpleRDA2}). The actual
- calculations are done in functions \code{varpart2} to \code{varpart4},
- but these are not intended to be called directly by the user.
-
- The function primarily uses adjusted R squares to assess the partitions
- explained by the explanatory tables and their combinations, because
- this is the only unbiased method (Peres-Neto
- et al., 2006). The raw R squares for basic fractions are also
- displayed, but these are biased estimates of variation explained by
- the explanatory table.
+ partitioning is based on linear regression.
+
+ The function primarily uses adjusted \eqn{R^2}{R-squared} to assess
+ the partitions explained by the explanatory tables and their
+ combinations, because this is the only unbiased method (Peres-Neto
+ et al., 2006). The raw \eqn{R^2}{R-squared} for basic fractions are
+ also displayed, but these are biased estimates of variation
+ explained by the explanatory table.
The identifiable fractions are designated by lower case alphabets. The
meaning of the symbols can be found in the separate document
@@ -151,9 +149,9 @@ table. }
\itemize{
\item{Df}{Degrees of freedom of numerator of the \eqn{F}-statistic
for the fraction.}
- \item{R.square}{Raw R-squared. This is calculated only for
+ \item{R.square}{Raw \eqn{R^2}{R-squared}. This is calculated only for
\code{fract} and this is \code{NA} in other items.}
- \item{Adj.R.square}{Adjusted R-squared.}
+ \item{Adj.R.square}{Adjusted \eqn{R^2}{R-squared}.}
\item{Testable}{If the fraction can be expressed as a (partial) RDA
model, it is directly \code{Testable}, and this field is
\code{TRUE}. In that case the fraction label also gives the
@@ -186,35 +184,47 @@ Ecology 87: 2614--2625.
\author{ Pierre Legendre, Departement de Sciences Biologiques, Universite de
Montreal, Canada. Adapted to \pkg{vegan} by Jari Oksanen. }
-\note{You can use command \code{\link{vegandocs}} to display document
- "partitioning.pdf" which presents
-Venn diagrams showing the fraction names in partitioning the variation of
-Y with respect to 2, 3, and 4 tables of explanatory variables, as well
-as the equations used in variation partitioning.
-
-The functions frequently give negative estimates of variation. Adjusted
-R-squares can be negative for any fraction;
-unadjusted R squares of testable fractions always will be non-negative.
-Non-testable fractions cannot be found directly, but by subtracting
-different models, and these subtraction results can be negative.
-The fractions are orthogonal, or linearly independent, but more
-complicated or nonlinear dependencies can cause negative non-testable
-fractions.
-
-The current function will only use RDA in multivariate partitioning. It
-is much more complicated to estimate the adjusted R-squares for CCA, and
-unbiased analysis of CCA is not currently implemented.
+\note{
+
+ You can use command \code{\link{vegandocs}} to display document
+ "partitioning.pdf" which presents Venn diagrams showing the fraction
+ names in partitioning the variation of Y with respect to 2, 3, and 4
+ tables of explanatory variables, as well as the equations used in
+ variation partitioning.
+
+ The functions frequently give negative estimates of variation.
+ Adjusted \eqn{R^2}{R-squared} can be negative for any fraction;
+ unadjusted \eqn{R^2}{R-squared} of testable fractions always will be
+ non-negative. Non-testable fractions cannot be found directly, but
+ by subtracting different models, and these subtraction results can
+ be negative. The fractions are orthogonal, or linearly independent,
+ but more complicated or nonlinear dependencies can cause negative
+ non-testable fractions.
+
+ The current function will only use RDA in multivariate
+ partitioning. It is much more complicated to estimate the adjusted
+ R-squares for CCA, and unbiased analysis of CCA is not currently
+ implemented.
+
+ A simplified, fast version of RDA is used (function
+ \code{simpleRDA2}). The actual calculations are done in functions
+ \code{varpart2} to \code{varpart4}, but these are not intended to be
+ called directly by the user.
+
}
-\seealso{
+\seealso{
For analysing testable fractions, see \code{\link{rda}} and
\code{\link{anova.cca}}. For data transformation, see
\code{\link{decostand}}. Function \code{\link{inertcomp}} gives
(unadjusted) components of variation for each species or site
- separately.
- }
+ separately. Function \code{\link{rda}} displays unadjusted
+ components in its output, but \code{\link{RsquareAdj}} will give
+ adjusted \eqn{R^2}{R-squared} that are similar to the current
+ function also for partial models.
+}
- \examples{
+\examples{
data(mite)
data(mite.env)
data(mite.pcnm)
diff --git a/man/vegan-internal.Rd b/man/vegan-internal.Rd
index 1bd9666..02c6844 100644
--- a/man/vegan-internal.Rd
+++ b/man/vegan-internal.Rd
@@ -8,6 +8,7 @@
\alias{ordiTerminfo}
\alias{pasteCall}
\alias{ordiArrowMul}
+\alias{oridArrowTextXY}
\alias{ordiArgAbsorber}
\alias{veganCovEllipse}
\alias{hierParseFormula}
@@ -26,6 +27,7 @@ ordiTerminfo(d, data)
ordiNAexclude(x, excluded)
ordiNApredict(omit, x)
ordiArrowMul(x, at = c(0,0), fill = 0.75)
+ordiArrowTextXY(vect, labels, ...)
ordiArgAbsorber(..., shrink, origin, scaling, triangular,
display, choices, const, FUN)
centroids.cca(x, mf, wt)
@@ -62,6 +64,11 @@ hierParseFormula(formula, data)
\code{ordiNApredict} puts pads the result object with these or with
WA scores similarly as \code{\link{napredict}}.
+ \code{ordiArrowMul} finds a multiplier to scale a bunch of arrows to
+ fill an ordination plot, and \code{ordiArrowTextXY} finds the
+ coordinates for labels of these arrows. See \code{\link{envfit}}
+ for an application.
+
\code{ordiArgAbsorber} absorbs arguments of \code{\link{scores}}
function of \pkg{vegan} so that these do not cause superfluous
warnings in graphical function \code{FUN}. If you implement
diff --git a/man/vegan-package.Rd b/man/vegan-package.Rd
index 28095ee..68ff79f 100644
--- a/man/vegan-package.Rd
+++ b/man/vegan-package.Rd
@@ -107,4 +107,5 @@ adonis(dune ~ Management + Moisture, dune.env)
\keyword{ spatial }
\keyword{ nonparametric }
\keyword{ htest }
-\keyword{ regression }
\ No newline at end of file
+\keyword{ regression }
+
diff --git a/man/vegdist.Rd b/man/vegdist.Rd
index 2a19cb3..14e888d 100644
--- a/man/vegdist.Rd
+++ b/man/vegdist.Rd
@@ -175,7 +175,7 @@
prob(j)}, or based on the probability of observing at least \eqn{j}
species in shared in compared communities. The current function uses
analytic result from hypergeometric distribution
- (\code{\link{phyper}}) to find the probablities. This probability
+ (\code{\link{phyper}}) to find the probabilities. This probability
(and the index) is dependent on the number of species missing in both
sites, and adding all-zero species to the data or removing missing
species from the data will influence the index. The probability (and
diff --git a/vignettes/.install_extras b/vignettes/.install_extras
new file mode 100644
index 0000000..e1862b3
--- /dev/null
+++ b/vignettes/.install_extras
@@ -0,0 +1,2 @@
+FAQ-vegan.pdf
+NEWS.html
diff --git a/inst/doc/FAQ-vegan.pdf b/vignettes/FAQ-vegan.pdf
similarity index 54%
copy from inst/doc/FAQ-vegan.pdf
copy to vignettes/FAQ-vegan.pdf
index 1115bbf..538c746 100644
Binary files a/inst/doc/FAQ-vegan.pdf and b/vignettes/FAQ-vegan.pdf differ
diff --git a/inst/doc/FAQ-vegan.texi b/vignettes/FAQ-vegan.texi
similarity index 96%
rename from inst/doc/FAQ-vegan.texi
rename to vignettes/FAQ-vegan.texi
index 005103b..1e17678 100644
--- a/inst/doc/FAQ-vegan.texi
+++ b/vignettes/FAQ-vegan.texi
@@ -16,7 +16,7 @@
@ifnottex
This document contains answers to some of the most frequently asked
questions about R package @pkg{vegan}.
-This is version of $Date: 2013-02-07 19:55:39 +0200 (Thu, 07 Feb 2013) $.
+This is version of $Date: 2013-09-11 11:59:36 +0300 (Wed, 11 Sep 2013) $.
@end ifnottex
@quotation
@@ -40,7 +40,7 @@ Copyright @copyright{} 2008-2013 Jari Oksanen
@titlepage
@title @pkg{vegan} @acronym{FAQ}
@subtitle Frequently Asked Questions on R package @pkg{vegan}
- at subtitle Version of $Date: 2013-02-07 19:55:39 +0200 (Thu, 07 Feb 2013) $
+ at subtitle Version of $Date: 2013-09-11 11:59:36 +0300 (Wed, 11 Sep 2013) $
@author Jari Oksanen
@vskip 0pt plus 1fill
@@ -334,6 +334,7 @@ request to us for incorporating your changes in @pkg{vegan} releases.
* Where can I find numerical scores of ordination axes?::
* How the RDA results are scaled?::
* cca fails with ``data.frame expected'' or ``"site.env" missing''::
+* Ordination fails with ``Error in La.svd''::
* Variance explained by ordination axes::
* Can I have random effects in constrained ordination or in @code{adonis}?::
* Is it possible to have passive points in ordination?::
@@ -478,7 +479,7 @@ explained in a separate @acronym{pdf} document on ``Design decision and
implementation details in vegan'' that you can read with @pkg{vegan}
command @code{vegandocs("decision")}.
- at node cca fails with ``data.frame expected'' or ``"site.env" missing'', Variance explained by ordination axes, How the RDA results are scaled?, Ordination
+ at node cca fails with ``data.frame expected'' or ``"site.env" missing'', Ordination fails with ``Error in La.svd'', How the RDA results are scaled?, Ordination
@section cca fails with ``data.frame expected'' or ``"site.env" missing''
This is not a @pkg{vegan} error message, but it comes from the
@@ -489,7 +490,29 @@ can use the @pkg{vegan} version using command @code{vegan::cca()}. If
you do not need package @pkg{ade4}, you can detach it with command
@code{detach(package:ade4)}.
- at node Variance explained by ordination axes, Can I have random effects in constrained ordination or in @code{adonis}?, cca fails with ``data.frame expected'' or ``"site.env" missing'', Ordination
+ at node Ordination fails with ``Error in La.svd'', Variance explained by ordination axes, cca fails with ``data.frame expected'' or ``"site.env" missing'', Ordination
+ at section Ordination fails with ``Error in La.svd''
+
+Constrained ordination (@code{cca}, @code{rda}, @code{capscale}) will
+sometimes fail with error message
+ at code{Error in La.svd(x, nu, nv): error code 1 from Lapack routine 'dgesdd'.}
+
+It seems that the basic problem is in the @code{svd} function of
+ at code{LAPACK} that is used for numerical analysis in R. @code{LAPACK}
+is an external library that is beyond the control of package developers
+and R core team so that these problems may be unsolvable. It seems that
+the problems with the @code{LAPACK} code are so common that even the
+help page of @code{svd} warns about them
+
+Reducing the range of constraints (environmental variables) helps
+sometimes. For instance, multiplying constraints by a constant < 1. This
+rescaling does not influence the numerical results of constrained
+ordination, but it can complicate further analyses when values of
+constraints are needed, because the same scaling must be applied
+there. We can only hope that this problem is fixed in the future
+versions of R and @code{LAPACK}.
+
+ at node Variance explained by ordination axes, Can I have random effects in constrained ordination or in @code{adonis}?, Ordination fails with ``Error in La.svd'', Ordination
@section Variance explained by ordination axes.
In general, @pkg{vegan} does not directly give any statistics on the
diff --git a/inst/doc/Makefile b/vignettes/Makefile
similarity index 86%
rename from inst/doc/Makefile
rename to vignettes/Makefile
index 9e6c692..290c9cd 100644
--- a/inst/doc/Makefile
+++ b/vignettes/Makefile
@@ -10,6 +10,6 @@ intro-vegan.pdf: intro-vegan.tex
diversity-vegan.pdf: diversity-vegan.tex
"$(R_HOME)/bin/R" CMD texi2dvi --pdf --clean diversity-vegan.tex
-rm -f diversity-vegan-0*.* Rplots.*
-NEWS.html: ../NEWS.Rd
- "$(R_HOME)/bin/R" CMD Rd2txt -t html ../NEWS.Rd -o NEWS.html
+NEWS.html: ../inst/NEWS.Rd
+ "$(R_HOME)/bin/R" CMD Rd2txt -t html ../inst/NEWS.Rd -o NEWS.html
diff --git a/inst/doc/NEWS.html b/vignettes/NEWS.html
similarity index 93%
copy from inst/doc/NEWS.html
copy to vignettes/NEWS.html
index cdf3c15..f565471 100644
--- a/inst/doc/NEWS.html
+++ b/vignettes/NEWS.html
@@ -8,7 +8,69 @@
<h2>vegan News</h2>
-<h3>Changes in version 2.0.7</h3>
+<h3>Changes in version 2.0-9</h3>
+
+
+<ul>
+<li><p> This version is released due to changes in programming
+interface and testing procedures in <font face="Courier New,Courier" color="#666666"><b>R</b></font> 3.0.2. If you are using an
+older version of <font face="Courier New,Courier" color="#666666"><b>R</b></font>, there is no need to upgrade <span class="pkg">vegan</span>. There
+are no new features nor bug fixes. The only user-visible changes
+are in documentation and in output messages and formatting. Because
+of <font face="Courier New,Courier" color="#666666"><b>R</b></font> changes, this version is dependent on <font face="Courier New,Courier" color="#666666"><b>R</b></font> version 2.14.0
+or newer and on <span class="pkg">lattice</span> package.
+</p>
+</li></ul>
+
+
+
+<h3>Changes in version 2.0-8</h3>
+
+
+
+<h4>GENERAL</h4>
+
+
+<ul>
+<li><p> This is a maintenance release that fixes some issues
+raised by changed in <font face="Courier New,Courier" color="#666666"><b>R</b></font> toolset for processing vignettes. In
+the same we also fix some typographic issues in the vignettes.
+</p>
+</li></ul>
+
+
+
+
+<h4>NEW FEATURES</h4>
+
+
+<ul>
+<li> <p><code>ordisurf</code> gained new arguments for more flexible
+definition of fitted models to better utilize the
+<span class="pkg">mgcv</span><code>::gam</code> function.
+</p>
+<p>The linewidth of contours can
+now be set with the argument <code>lwd</code>.
+</p>
+</li>
+<li><p> Labels to arrows are positioned in a better way in
+<code>plot</code> functions for the results of <code>envfit</code>,
+<code>cca</code>, <code>rda</code> and <code>capscale</code>. The labels should no
+longer overlap the arrow tips.
+</p>
+</li>
+<li><p> The setting test direction is clearer in <code>oecosimu</code>.
+</p>
+</li>
+<li> <p><code>ordipointlabel</code> gained a <code>plot</code> method that can
+be used to replot the saved result.
+</p>
+</li></ul>
+
+
+
+
+<h3>Changes in version 2.0-7</h3>
diff --git a/inst/doc/decision-vegan.Rnw b/vignettes/decision-vegan.Rnw
similarity index 88%
copy from inst/doc/decision-vegan.Rnw
copy to vignettes/decision-vegan.Rnw
index 6e2e642..cc42763 100644
--- a/inst/doc/decision-vegan.Rnw
+++ b/vignettes/decision-vegan.Rnw
@@ -1,58 +1,52 @@
% -*- mode: noweb; noweb-default-code-mode: R-mode; -*-
%\VignetteIndexEntry{Design decisions and implementation}
-\documentclass[article,nojss]{jss}
-\usepackage{veganjss} % package options and redefinitions
-\usepackage{amsmath}
-%\usepackage{ucs}
-%\usepackage[utf8x]{inputenc}
-%\usepackage[T1]{fontenc}
-\usepackage{sidecap}
-\renewcommand{\floatpagefraction}{0.8}
-\renewcommand{\cite}{\citep}
+\documentclass[a4paper,10pt,twocolumn]{article}
+\usepackage{vegan} % package options and redefinitions
\author{Jari Oksanen}
\title{Design decisions and implementation details in vegan}
-\Abstract{
- This document describes design decisions, and discusses implementation
-and algorithmic details in some vegan functions. The proper FAQ is
-another document.
- }
- \Keywords{nestdness, matrix temperature, community null models, scaling of PCA and RDA, WA
- and LC scores}
-%% hijack Address for version info
-\Address{$ $Id: decision-vegan.Rnw 1709 2011-08-10 15:48:21Z jarioksa $ $
+
+\date{\footnotesize{$ $Id: decision-vegan.Rnw 2616 2013-09-11 08:34:17Z jarioksa $ $
processed with vegan
\Sexpr{packageDescription("vegan", field="Version")}
-in \Sexpr{R.version.string} on \today}
-\Footername{About this version}
+in \Sexpr{R.version.string} on \today}}
-%% need no \usepackage{Sweave.sty}
+%% need no \usepackage{Sweave}
\begin{document}
+\bibliographystyle{jss}
+
\SweaveOpts{strip.white=true}
-\setkeys{Gin}{width=0.55\linewidth}
+
<<echo=false,results=hide>>=
figset <- function() par(mar=c(4,4,1,1)+.1)
options(SweaveHooks = list(fig = figset))
-options("prompt" = "R> ", "continue" = "+ ")
+options("prompt" = "> ", "continue" = " ")
+options(width = 55)
require(vegan)
@
+\maketitle
-\tableofcontents
+\begin{abstract}
+ This document describes design decisions, and discusses implementation
+and algorithmic details in some vegan functions. The proper FAQ is
+another document.
+\end{abstract}
+\tableofcontents
\section{Nestedness and Null models}
-Some indicators of nestedness and null models of communities are only
-described in general terms, and they could be implemented in various
-ways. Here I discuss the implementation in \pkg{vegan}.
+Some published indices of nestedness and null models of communities
+are only described in general terms, and they could be implemented in
+various ways. Here I discuss the implementation in \pkg{vegan}.
\subsection{Matrix temperature}
The matrix temperature is intuitively simple
(Fig. \ref{fig:nestedtemp}), but the the exact calculations were not
explained in the original publication \cite{AtmarPat93}.
-\begin{SCfigure}
+\begin{figure}
<<fig=true,echo=false,results=hide>>=
data(sipoo)
mod <- nestedtemp(sipoo)
@@ -75,7 +69,7 @@ arrows(x,y, r, f(r, mod$p), lwd=4)
the fill line. The ``surprise'' for this point is $u = (d/D)^2$ and
the matrix temperature is based on the sum of surprises: presences
outside the fill line or absences within the fill line.}
-\end{SCfigure}
+\end{figure}
The function can be implemented in many ways following the general
principles. \citet{RodGir06} have seen the original code and reveal
more details of calculations, and their explanation is the basis of
@@ -90,12 +84,12 @@ in the source code of \code{nestedtemp}.
\begin{itemize}
\item Species and sites are put into unit square \citep{RodGir06}. The
- coordinates for $n$ item will be $(k-0.5)/n$ for $k=1 \ldots n$, so
- that there are no points in the corners or the margins of the unit
- square, and a diagonal line can be drawn through any point. I do not
- know how the rows and columns are converted to the unit square in
- other software, and this may be a considerable source of differences
- among implementations.
+ row and column coordinates will be $(k-0.5)/n$ for $k=1 \ldots n$,
+ so that there are no points in the corners or the margins of the
+ unit square, and a diagonal line can be drawn through any point. I
+ do not know how the rows and columns are converted to the unit
+ square in other software, and this may be a considerable source of
+ differences among implementations.
\item Species and sites are ordered alternately using indices
\citep{RodGir06}:
\begin{equation}
@@ -134,7 +128,7 @@ in the source code of \code{nestedtemp}.
\citep{RodGir06}. Small details in the fill line combined with
differences in scores used in the unit square (especially in the
corners) can cause large differences in the results.
- \item A line with slope $-1$ is drawn through the point and the $x$
+ \item A line with slope\,$= -1$ is drawn through the point and the $x$
coordinate of the intersection of this line and the fill line is
found using function \code{uniroot}. The difference of this
intersection and the row coordinate gives the argument $d$ of matrix
@@ -199,7 +193,7 @@ of singular value decomposition (\textsc{svd}). Functions
\code{rda} and \code{prcomp} even use \textsc{svd} internally in
their algorithm.
-In \textsc{svd} a centred data matrix is decomposed into orthogonal
+In \textsc{svd} a centred data matrix $\mathbf{X} = \{x_{ij}\}$ is decomposed into orthogonal
components so that $x_{ij} = \sum_k \sigma_k u_{ik} v_{jk}$, where
$u_{ik}$ and $v_{jk}$ are orthonormal coefficient matrices and
$\sigma_k$ are singular values. Orthonormality means that sums of
@@ -225,7 +219,7 @@ data. The orthonormal matrix $\mathbf{V}$ of \textsc{svd} can be
found indirectly as well, so that we have the same components in both
methods.
-The coefficients $u_{ik}$ and $v_{jk}$ are scaled similarly for all
+The coefficients $u_{ik}$ and $v_{jk}$ are scaled to unit length for all
axes $k$. Singular values $\sigma_k$ or eigenvalues $\lambda_k$ give
the information of the importance of axes, or the `axis lengths.'
Instead of the orthonormal coefficients, or equal length axes, it is
@@ -237,7 +231,8 @@ components analysis in all cases, and in redundancy analysis, they
apply to species scores and constraints or linear combination scores;
weighted averaging scores have somewhat wider dispersion.
-\begin{table}
+\begin{table*}[t]
+ \centering
\caption{\label{tab:scales} Alternative scalings for \textsc{rda} used
in the functions \code{prcomp} and \code{princomp}, and the
one used in the \pkg{vegan} function \code{rda}
@@ -251,9 +246,12 @@ weighted averaging scores have somewhat wider dispersion.
is derived
dividing each species by its standard deviation $s_j$ (possibly
with some additional constant multiplier). }
-\begin{tabular}{lcc}
+ \begin{tabular}{lcc}
+ \\
+ \toprule
& \textbf{Site scores} $u_{ik}^*$ &
\textbf{Species scores} $v_{jk}^*$ \\
+\midrule
\code{prcomp, princomp} &
$u_{ik} \sqrt{n-1} \sqrt{\lambda_k}$ &
$v_{jk}$ \\
@@ -270,7 +268,7 @@ $v_{jk} \sqrt[4]{\lambda_k/ \sum \lambda_k} \times \mathrm{const}$ \\
\code{rda, scaling < 0} &
$u_{ik}^*$ &
$\sqrt{\sum \lambda_k /(n-1)} s_j^{-1} v_{jk}^*$
-% \\
+\\
% \code{Canoco 3, scaling=-1} &
% $u_{ik} \sqrt{n-1} \sqrt{\lambda_k / \sum \lambda_k}$ &
% $v_{jk} \sqrt{n}$ \\
@@ -281,8 +279,11 @@ $\sqrt{\sum \lambda_k /(n-1)} s_j^{-1} v_{jk}^*$
% \code{Canoco 3, scaling=-3} &
% $u_{ik} \sqrt{n-1} \sqrt[4]{\lambda_k / \sum \lambda_k}$ &
% $v_{jk} \sqrt{n} \sqrt[4]{\lambda_k / \sum \lambda_k}$
+\bottomrule
\end{tabular}
-\end{table}
+\end{table*}
+
+
In community ecology, it is common to plot both species and sites in
the same graph. If this graph is a graphical display of \textsc{svd},
@@ -330,21 +331,27 @@ the scaling constant to any desired values. It is also possible to
have two separate scaling constants: the first for the species, and
the second for sites and friends, and this allows getting scores of
other software or \proglang{R} functions (Table \ref{tab:rdaconst}).
-\begin{table}
+
+\begin{table*}[t]
+ \centering
\caption{\label{tab:rdaconst} Values of the \code{const} argument in
\textbf{vegan} to get the scores that are equal to those from
other functions and software. Number of sites (rows) is $n$,
the number of species (columns) is $m$, and the sum of all
eigenvalues is $\sum_k \lambda_k$ (this is saved as the item
\code{tot.chi} in the \code{rda} result)}.
-\begin{tabular}{lccc}
+ \begin{tabular}{lccc}
+ \\
+ \toprule
& \textbf{Scaling} &\textbf{Species constant} & \textbf{Site constant} \\
+\midrule
\pkg{vegan} & any & $\sqrt[4]{(n-1) \sum \lambda_k}$ & $\sqrt[4]{(n-1) \sum \lambda_k}$\\
\code{prcomp}, \code{princomp} & \code{1} & $1$ & $\sqrt{(n-1) \sum_k \lambda_k}$\\
\proglang{Canoco\,v3} & \code{-1, -2, -3} & $\sqrt{n-1}$ & $\sqrt{n}$\\
-\proglang{Canoco\,v4} & \code{-1, -2, -3} & $\sqrt{m}$ & $\sqrt{n}$
+\proglang{Canoco\,v4} & \code{-1, -2, -3} & $\sqrt{m}$ & $\sqrt{n}$\\
+\bottomrule
\end{tabular}
-\end{table}
+\end{table*}
In this chapter, I used always centred data matrices. In principle
\textsc{svd} could be done with original, non-centred data, but
@@ -379,25 +386,23 @@ WA or Weighted Averages Scores which are such weighted averages of
species scores that are as similar to LC scores as possible.
\end{itemize}
Many computer programs for constrained ordinations give only or
-primarily LC scores, following Mike Palmer's recommendation
-\cite{Palmer93}. However, functions \code{cca} and \code{rda} in
+primarily LC scores following recommendation of
+\citet{Palmer93}. However, functions \code{cca} and \code{rda} in
the \pkg{vegan} package use primarily WA scores. This chapter
explains the reasons for this choice.
Briefly, the main reasons are that
\begin{itemize}
-\item
-LC scores \emph{are} linear combinations, so they give us only the
-(scaled) environmental variables. This means that they are
-independent of vegetation and cannot be found from the species
-composition. Moreover, identical combinations of environmental
-variables give identical LC scores irrespective of vegetation.
-\item
-Bruce McCune has demonstrated that noisy environmental variables
-result in deteriorated LC scores whereas WA scores tolerate some errors
-in environmental variables \cite{McCune97}. All environmental
-measurements contain some errors, and therefore it is safer to use WA
-scores.
+\item LC scores \emph{are} linear combinations, so they give us only
+ the (scaled) environmental variables. This means that they are
+ independent of vegetation and cannot be found from the species
+ composition. Moreover, identical combinations of environmental
+ variables give identical LC scores irrespective of vegetation.
+\item \citet{McCune97} has demonstrated that noisy environmental
+ variables result in deteriorated LC scores whereas WA scores
+ tolerate some errors in environmental variables. All environmental
+ measurements contain some errors, and therefore it is safer to use
+ WA scores.
\end{itemize}
This article studies mainly the first point. The users of
\pkg{vegan} have a choice of either LC or WA (default) scores, but
@@ -422,13 +427,13 @@ default. So we must specifically ask for LC scores
<<a,fig=false>>=
plot(orig, dis=c("lc","bp"))
@
-\begin{SCfigure}
+\begin{figure}
<<fig=true,echo=false>>=
<<a>>
@
\caption{LC scores in CCA of the original data.}
\label{fig:ccalc}
-\end{SCfigure}
+\end{figure}
What would happen to linear combinations of LC scores if we shuffle
the ordering of sites in species data? Function \code{sample()} below
@@ -437,26 +442,27 @@ shuffles the indices.
i <- sample(nrow(varespec))
shuff <- cca(varespec[i,] ~ Al + K, varechem)
@
-\begin{SCfigure}
+\begin{figure}
<<fig=true,echo=false>>=
plot(shuff, dis=c("lc","bp"))
@
\caption{LC scores of shuffled species data.}
\label{fig:ccashuff}
-\end{SCfigure}
+\end{figure}
It seems that site scores are fairly similar, but oriented differently
(Fig. \ref{fig:ccashuff}). We can use Procrustes rotation to see how
similar the site scores indeed are (Fig. \ref{fig:ccaproc}).
<<a,fig=false>>=
-plot(procrustes(scores(orig, dis="lc"), scores(shuff, dis="lc")))
+plot(procrustes(scores(orig, dis="lc"),
+ scores(shuff, dis="lc")))
@
-\begin{SCfigure}
+\begin{figure}
<<fig=true,echo=false>>=
<<a>>
@
\caption{Procrustes rotation of LC scores from CCA of original and shuffled data.}
\label{fig:ccaproc}
-\end{SCfigure}
+\end{figure}
There is a small difference, but this will disappear if we use
Redundancy Analysis (RDA) instead of CCA
(Fig. \ref{fig:rdaproc}). Here we use a new shuffling as well.
@@ -465,13 +471,14 @@ tmp1 <- rda(varespec ~ Al + K, varechem)
i <- sample(nrow(varespec)) # Different shuffling
tmp2 <- rda(varespec[i,] ~ Al + K, varechem)
@
-\begin{SCfigure}
+\begin{figure}
<<fig=true,echo=false>>=
-plot(procrustes(scores(tmp1, dis="lc"), scores(tmp2, dis="lc")))
+plot(procrustes(scores(tmp1, dis="lc"),
+ scores(tmp2, dis="lc")))
@
\caption{Procrustes rotation of LC scores in RDA of the original and shuffled data.}
\label{fig:rdaproc}
-\end{SCfigure}
+\end{figure}
LC scores indeed are linear combinations of constraints (environmental
variables) and \emph{independent of species data}: You can
@@ -483,23 +490,21 @@ this can cause changes in LC scores. The magnitude of changes depends
on the variability of site totals.
The original data and shuffled data differ in their goodness of
-fit\footnote{Or probably differ: The randomization is done while
-generating this article, and different versions may have different
-randomizations.}.
+fit:
<<>>=
orig
shuff
@
Similarly their WA scores will be (probably) very different
(Fig. \ref{fig:ccawa}).
-\begin{SCfigure}
+\begin{figure}
<<fig=true,echo=false>>=
plot(procrustes(orig, shuff))
@
\caption{Procrustes rotation of WA scores of CCA with the original and
shuffled data.}
\label{fig:ccawa}
-\end{SCfigure}
+\end{figure}
The example used only two environmental variables so that we can
easily plot all constrained axes. With a larger number of
@@ -510,7 +515,8 @@ remain within numerical accuracy:
<<>>=
tmp1 <- rda(varespec ~ ., varechem)
tmp2 <- rda(varespec[i,] ~ ., varechem)
-proc <- procrustes(scores(tmp1, dis="lc", choi=1:14), scores(tmp2, dis="lc", choi=1:14))
+proc <- procrustes(scores(tmp1, dis="lc", choi=1:14),
+ scores(tmp2, dis="lc", choi=1:14))
max(residuals(proc))
@
In \code{cca} the difference would be somewhat larger than now
@@ -526,19 +532,18 @@ following example uses the classical dune meadow data \cite{Jongman87}:
<<>>=
data(dune)
data(dune.env)
-summary(dune.env)
orig <- cca(dune ~ Moisture, dune.env)
@
When the results are plotted using LC scores, sample plots fall only
in four alternative positions (Fig. \ref{fig:factorlc}).
-\begin{SCfigure}
+\begin{figure}
<<fig=TRUE,echo=false>>=
plot(orig, dis="lc")
@
\caption{LC scores of the dune meadow data using only one factor as a
constraint.}
\label{fig:factorlc}
-\end{SCfigure}
+\end{figure}
In the previous chapter we saw that this happens because LC scores
\emph{are} the environmental variables, and they can be distinct only
if the environmental variables are distinct. However, normally the user
@@ -556,14 +561,14 @@ plot(orig, display="wa", type="points")
ordispider(orig, col="red")
text(orig, dis="cn", col="blue")
@
-\begin{SCfigure}
+\begin{figure}
<<fig=TRUE,echo=false>>=
<<a>>
@
\caption{A ``spider plot'' connecting WA scores to corresponding LC
scores. The shorter the web segments, the better the ordination.}
\label{fig:walcspider}
-\end{SCfigure}
+\end{figure}
This is the standard way of displaying results of discriminant
analysis, too. Moisture classes \code{1} and \code{2} seem to be
overlapping, and cannot be completely separated by their
diff --git a/inst/doc/decision-vegan.tex b/vignettes/decision-vegan.tex
similarity index 83%
rename from inst/doc/decision-vegan.tex
rename to vignettes/decision-vegan.tex
index 3418c9f..8c8be0a 100644
--- a/inst/doc/decision-vegan.tex
+++ b/vignettes/decision-vegan.tex
@@ -1,52 +1,45 @@
% -*- mode: noweb; noweb-default-code-mode: R-mode; -*-
%\VignetteIndexEntry{Design decisions and implementation}
-\documentclass[article,nojss]{jss}
-\usepackage{veganjss} % package options and redefinitions
-\usepackage{amsmath}
-%\usepackage{ucs}
-%\usepackage[utf8x]{inputenc}
-%\usepackage[T1]{fontenc}
-\usepackage{sidecap}
-\renewcommand{\floatpagefraction}{0.8}
-\renewcommand{\cite}{\citep}
+\documentclass[a4paper,10pt,twocolumn]{article}
+\usepackage{vegan} % package options and redefinitions
\author{Jari Oksanen}
\title{Design decisions and implementation details in vegan}
-\Abstract{
- This document describes design decisions, and discusses implementation
-and algorithmic details in some vegan functions. The proper FAQ is
-another document.
- }
- \Keywords{nestdness, matrix temperature, community null models, scaling of PCA and RDA, WA
- and LC scores}
-%% hijack Address for version info
-\Address{$ $Id: decision-vegan.Rnw 1709 2011-08-10 15:48:21Z jarioksa $ $
+
+\date{\footnotesize{$ $Id: decision-vegan.Rnw 2616 2013-09-11 08:34:17Z jarioksa $ $
processed with vegan
-2.0-7
-in R Under development (unstable) (2013-03-19 r62316) on \today}
-\Footername{About this version}
+2.0-9
+in R Under development (unstable) (2013-09-25 r63985) on \today}}
-%% need no \usepackage{Sweave.sty}
+%% need no \usepackage{Sweave}
\begin{document}
+\bibliographystyle{jss}
-\setkeys{Gin}{width=0.55\linewidth}
-\tableofcontents
+\maketitle
+
+\begin{abstract}
+ This document describes design decisions, and discusses implementation
+and algorithmic details in some vegan functions. The proper FAQ is
+another document.
+\end{abstract}
+
+\tableofcontents
\section{Nestedness and Null models}
-Some indicators of nestedness and null models of communities are only
-described in general terms, and they could be implemented in various
-ways. Here I discuss the implementation in \pkg{vegan}.
+Some published indices of nestedness and null models of communities
+are only described in general terms, and they could be implemented in
+various ways. Here I discuss the implementation in \pkg{vegan}.
\subsection{Matrix temperature}
The matrix temperature is intuitively simple
(Fig. \ref{fig:nestedtemp}), but the the exact calculations were not
explained in the original publication \cite{AtmarPat93}.
-\begin{SCfigure}
+\begin{figure}
\includegraphics{decision-vegan-002}
\label{fig:nestedtemp}
\caption{Matrix temperature for \emph{Falco subbuteo} on Sibbo
@@ -57,7 +50,7 @@ explained in the original publication \cite{AtmarPat93}.
the fill line. The ``surprise'' for this point is $u = (d/D)^2$ and
the matrix temperature is based on the sum of surprises: presences
outside the fill line or absences within the fill line.}
-\end{SCfigure}
+\end{figure}
The function can be implemented in many ways following the general
principles. \citet{RodGir06} have seen the original code and reveal
more details of calculations, and their explanation is the basis of
@@ -72,12 +65,12 @@ in the source code of \code{nestedtemp}.
\begin{itemize}
\item Species and sites are put into unit square \citep{RodGir06}. The
- coordinates for $n$ item will be $(k-0.5)/n$ for $k=1 \ldots n$, so
- that there are no points in the corners or the margins of the unit
- square, and a diagonal line can be drawn through any point. I do not
- know how the rows and columns are converted to the unit square in
- other software, and this may be a considerable source of differences
- among implementations.
+ row and column coordinates will be $(k-0.5)/n$ for $k=1 \ldots n$,
+ so that there are no points in the corners or the margins of the
+ unit square, and a diagonal line can be drawn through any point. I
+ do not know how the rows and columns are converted to the unit
+ square in other software, and this may be a considerable source of
+ differences among implementations.
\item Species and sites are ordered alternately using indices
\citep{RodGir06}:
\begin{equation}
@@ -116,7 +109,7 @@ in the source code of \code{nestedtemp}.
\citep{RodGir06}. Small details in the fill line combined with
differences in scores used in the unit square (especially in the
corners) can cause large differences in the results.
- \item A line with slope $-1$ is drawn through the point and the $x$
+ \item A line with slope\,$= -1$ is drawn through the point and the $x$
coordinate of the intersection of this line and the fill line is
found using function \code{uniroot}. The difference of this
intersection and the row coordinate gives the argument $d$ of matrix
@@ -181,7 +174,7 @@ of singular value decomposition (\textsc{svd}). Functions
\code{rda} and \code{prcomp} even use \textsc{svd} internally in
their algorithm.
-In \textsc{svd} a centred data matrix is decomposed into orthogonal
+In \textsc{svd} a centred data matrix $\mathbf{X} = \{x_{ij}\}$ is decomposed into orthogonal
components so that $x_{ij} = \sum_k \sigma_k u_{ik} v_{jk}$, where
$u_{ik}$ and $v_{jk}$ are orthonormal coefficient matrices and
$\sigma_k$ are singular values. Orthonormality means that sums of
@@ -207,7 +200,7 @@ data. The orthonormal matrix $\mathbf{V}$ of \textsc{svd} can be
found indirectly as well, so that we have the same components in both
methods.
-The coefficients $u_{ik}$ and $v_{jk}$ are scaled similarly for all
+The coefficients $u_{ik}$ and $v_{jk}$ are scaled to unit length for all
axes $k$. Singular values $\sigma_k$ or eigenvalues $\lambda_k$ give
the information of the importance of axes, or the `axis lengths.'
Instead of the orthonormal coefficients, or equal length axes, it is
@@ -219,7 +212,8 @@ components analysis in all cases, and in redundancy analysis, they
apply to species scores and constraints or linear combination scores;
weighted averaging scores have somewhat wider dispersion.
-\begin{table}
+\begin{table*}[t]
+ \centering
\caption{\label{tab:scales} Alternative scalings for \textsc{rda} used
in the functions \code{prcomp} and \code{princomp}, and the
one used in the \pkg{vegan} function \code{rda}
@@ -233,9 +227,12 @@ weighted averaging scores have somewhat wider dispersion.
is derived
dividing each species by its standard deviation $s_j$ (possibly
with some additional constant multiplier). }
-\begin{tabular}{lcc}
+ \begin{tabular}{lcc}
+ \\
+ \toprule
& \textbf{Site scores} $u_{ik}^*$ &
\textbf{Species scores} $v_{jk}^*$ \\
+\midrule
\code{prcomp, princomp} &
$u_{ik} \sqrt{n-1} \sqrt{\lambda_k}$ &
$v_{jk}$ \\
@@ -252,7 +249,7 @@ $v_{jk} \sqrt[4]{\lambda_k/ \sum \lambda_k} \times \mathrm{const}$ \\
\code{rda, scaling < 0} &
$u_{ik}^*$ &
$\sqrt{\sum \lambda_k /(n-1)} s_j^{-1} v_{jk}^*$
-% \\
+\\
% \code{Canoco 3, scaling=-1} &
% $u_{ik} \sqrt{n-1} \sqrt{\lambda_k / \sum \lambda_k}$ &
% $v_{jk} \sqrt{n}$ \\
@@ -263,8 +260,11 @@ $\sqrt{\sum \lambda_k /(n-1)} s_j^{-1} v_{jk}^*$
% \code{Canoco 3, scaling=-3} &
% $u_{ik} \sqrt{n-1} \sqrt[4]{\lambda_k / \sum \lambda_k}$ &
% $v_{jk} \sqrt{n} \sqrt[4]{\lambda_k / \sum \lambda_k}$
+\bottomrule
\end{tabular}
-\end{table}
+\end{table*}
+
+
In community ecology, it is common to plot both species and sites in
the same graph. If this graph is a graphical display of \textsc{svd},
@@ -312,21 +312,27 @@ the scaling constant to any desired values. It is also possible to
have two separate scaling constants: the first for the species, and
the second for sites and friends, and this allows getting scores of
other software or \proglang{R} functions (Table \ref{tab:rdaconst}).
-\begin{table}
+
+\begin{table*}[t]
+ \centering
\caption{\label{tab:rdaconst} Values of the \code{const} argument in
\textbf{vegan} to get the scores that are equal to those from
other functions and software. Number of sites (rows) is $n$,
the number of species (columns) is $m$, and the sum of all
eigenvalues is $\sum_k \lambda_k$ (this is saved as the item
\code{tot.chi} in the \code{rda} result)}.
-\begin{tabular}{lccc}
+ \begin{tabular}{lccc}
+ \\
+ \toprule
& \textbf{Scaling} &\textbf{Species constant} & \textbf{Site constant} \\
+\midrule
\pkg{vegan} & any & $\sqrt[4]{(n-1) \sum \lambda_k}$ & $\sqrt[4]{(n-1) \sum \lambda_k}$\\
\code{prcomp}, \code{princomp} & \code{1} & $1$ & $\sqrt{(n-1) \sum_k \lambda_k}$\\
\proglang{Canoco\,v3} & \code{-1, -2, -3} & $\sqrt{n-1}$ & $\sqrt{n}$\\
-\proglang{Canoco\,v4} & \code{-1, -2, -3} & $\sqrt{m}$ & $\sqrt{n}$
+\proglang{Canoco\,v4} & \code{-1, -2, -3} & $\sqrt{m}$ & $\sqrt{n}$\\
+\bottomrule
\end{tabular}
-\end{table}
+\end{table*}
In this chapter, I used always centred data matrices. In principle
\textsc{svd} could be done with original, non-centred data, but
@@ -361,25 +367,23 @@ WA or Weighted Averages Scores which are such weighted averages of
species scores that are as similar to LC scores as possible.
\end{itemize}
Many computer programs for constrained ordinations give only or
-primarily LC scores, following Mike Palmer's recommendation
-\cite{Palmer93}. However, functions \code{cca} and \code{rda} in
+primarily LC scores following recommendation of
+\citet{Palmer93}. However, functions \code{cca} and \code{rda} in
the \pkg{vegan} package use primarily WA scores. This chapter
explains the reasons for this choice.
Briefly, the main reasons are that
\begin{itemize}
-\item
-LC scores \emph{are} linear combinations, so they give us only the
-(scaled) environmental variables. This means that they are
-independent of vegetation and cannot be found from the species
-composition. Moreover, identical combinations of environmental
-variables give identical LC scores irrespective of vegetation.
-\item
-Bruce McCune has demonstrated that noisy environmental variables
-result in deteriorated LC scores whereas WA scores tolerate some errors
-in environmental variables \cite{McCune97}. All environmental
-measurements contain some errors, and therefore it is safer to use WA
-scores.
+\item LC scores \emph{are} linear combinations, so they give us only
+ the (scaled) environmental variables. This means that they are
+ independent of vegetation and cannot be found from the species
+ composition. Moreover, identical combinations of environmental
+ variables give identical LC scores irrespective of vegetation.
+\item \citet{McCune97} has demonstrated that noisy environmental
+ variables result in deteriorated LC scores whereas WA scores
+ tolerate some errors in environmental variables. All environmental
+ measurements contain some errors, and therefore it is safer to use
+ WA scores.
\end{itemize}
This article studies mainly the first point. The users of
\pkg{vegan} have a choice of either LC or WA (default) scores, but
@@ -394,10 +398,10 @@ variables so that we can see the constrained solution completely in
two dimensions:
\begin{Schunk}
\begin{Sinput}
-R> library(vegan)
-R> data(varespec)
-R> data(varechem)
-R> orig <- cca(varespec ~ Al + K, varechem)
+> library(vegan)
+> data(varespec)
+> data(varechem)
+> orig <- cca(varespec ~ Al + K, varechem)
\end{Sinput}
\end{Schunk}
Function \code{cca} in \pkg{vegan} uses WA scores as
@@ -405,57 +409,58 @@ default. So we must specifically ask for LC scores
(Fig. \ref{fig:ccalc}).
\begin{Schunk}
\begin{Sinput}
-R> plot(orig, dis=c("lc","bp"))
+> plot(orig, dis=c("lc","bp"))
\end{Sinput}
\end{Schunk}
-\begin{SCfigure}
+\begin{figure}
\includegraphics{decision-vegan-005}
\caption{LC scores in CCA of the original data.}
\label{fig:ccalc}
-\end{SCfigure}
+\end{figure}
What would happen to linear combinations of LC scores if we shuffle
the ordering of sites in species data? Function \code{sample()} below
shuffles the indices.
\begin{Schunk}
\begin{Sinput}
-R> i <- sample(nrow(varespec))
-R> shuff <- cca(varespec[i,] ~ Al + K, varechem)
+> i <- sample(nrow(varespec))
+> shuff <- cca(varespec[i,] ~ Al + K, varechem)
\end{Sinput}
\end{Schunk}
-\begin{SCfigure}
+\begin{figure}
\includegraphics{decision-vegan-007}
\caption{LC scores of shuffled species data.}
\label{fig:ccashuff}
-\end{SCfigure}
+\end{figure}
It seems that site scores are fairly similar, but oriented differently
(Fig. \ref{fig:ccashuff}). We can use Procrustes rotation to see how
similar the site scores indeed are (Fig. \ref{fig:ccaproc}).
\begin{Schunk}
\begin{Sinput}
-R> plot(procrustes(scores(orig, dis="lc"), scores(shuff, dis="lc")))
+> plot(procrustes(scores(orig, dis="lc"),
+ scores(shuff, dis="lc")))
\end{Sinput}
\end{Schunk}
-\begin{SCfigure}
+\begin{figure}
\includegraphics{decision-vegan-009}
\caption{Procrustes rotation of LC scores from CCA of original and shuffled data.}
\label{fig:ccaproc}
-\end{SCfigure}
+\end{figure}
There is a small difference, but this will disappear if we use
Redundancy Analysis (RDA) instead of CCA
(Fig. \ref{fig:rdaproc}). Here we use a new shuffling as well.
\begin{Schunk}
\begin{Sinput}
-R> tmp1 <- rda(varespec ~ Al + K, varechem)
-R> i <- sample(nrow(varespec)) # Different shuffling
-R> tmp2 <- rda(varespec[i,] ~ Al + K, varechem)
+> tmp1 <- rda(varespec ~ Al + K, varechem)
+> i <- sample(nrow(varespec)) # Different shuffling
+> tmp2 <- rda(varespec[i,] ~ Al + K, varechem)
\end{Sinput}
\end{Schunk}
-\begin{SCfigure}
+\begin{figure}
\includegraphics{decision-vegan-011}
\caption{Procrustes rotation of LC scores in RDA of the original and shuffled data.}
\label{fig:rdaproc}
-\end{SCfigure}
+\end{figure}
LC scores indeed are linear combinations of constraints (environmental
variables) and \emph{independent of species data}: You can
@@ -467,15 +472,14 @@ this can cause changes in LC scores. The magnitude of changes depends
on the variability of site totals.
The original data and shuffled data differ in their goodness of
-fit\footnote{Or probably differ: The randomization is done while
-generating this article, and different versions may have different
-randomizations.}.
+fit:
\begin{Schunk}
\begin{Sinput}
-R> orig
+> orig
\end{Sinput}
\begin{Soutput}
-Call: cca(formula = varespec ~ Al + K, data = varechem)
+Call: cca(formula = varespec ~ Al + K, data =
+varechem)
Inertia Proportion Rank
Total 2.0832 1.0000
@@ -488,40 +492,45 @@ Eigenvalues for constrained axes:
0.3608 0.1152
Eigenvalues for unconstrained axes:
- CA1 CA2 CA3 CA4 CA5 CA6 CA7 CA8
-0.37476 0.24036 0.19696 0.17818 0.15209 0.11840 0.08364 0.07567
+ CA1 CA2 CA3 CA4 CA5 CA6
+0.37476 0.24036 0.19696 0.17818 0.15209 0.11840
+ CA7 CA8
+0.08364 0.07567
(Showed only 8 of all 21 unconstrained eigenvalues)
\end{Soutput}
\begin{Sinput}
-R> shuff
+> shuff
\end{Sinput}
\begin{Soutput}
-Call: cca(formula = varespec[i, ] ~ Al + K, data = varechem)
+Call: cca(formula = varespec[i, ] ~ Al + K, data
+= varechem)
Inertia Proportion Rank
-Total 2.08320 1.00000
-Constrained 0.15677 0.07525 2
-Unconstrained 1.92643 0.92475 21
+Total 2.0832 1.0000
+Constrained 0.2794 0.1341 2
+Unconstrained 1.8038 0.8659 21
Inertia is mean squared contingency coefficient
Eigenvalues for constrained axes:
CCA1 CCA2
-0.09762 0.05915
+0.21548 0.06392
Eigenvalues for unconstrained axes:
- CA1 CA2 CA3 CA4 CA5 CA6 CA7 CA8
-0.48818 0.28764 0.22823 0.19523 0.17686 0.11253 0.10810 0.08657
+ CA1 CA2 CA3 CA4 CA5 CA6
+0.40322 0.31886 0.22005 0.18714 0.17563 0.11703
+ CA7 CA8
+0.10042 0.08205
(Showed only 8 of all 21 unconstrained eigenvalues)
\end{Soutput}
\end{Schunk}
Similarly their WA scores will be (probably) very different
(Fig. \ref{fig:ccawa}).
-\begin{SCfigure}
+\begin{figure}
\includegraphics{decision-vegan-013}
\caption{Procrustes rotation of WA scores of CCA with the original and
shuffled data.}
\label{fig:ccawa}
-\end{SCfigure}
+\end{figure}
The example used only two environmental variables so that we can
easily plot all constrained axes. With a larger number of
@@ -531,17 +540,18 @@ projections look different. In the full space, the differences should
remain within numerical accuracy:
\begin{Schunk}
\begin{Sinput}
-R> tmp1 <- rda(varespec ~ ., varechem)
-R> tmp2 <- rda(varespec[i,] ~ ., varechem)
-R> proc <- procrustes(scores(tmp1, dis="lc", choi=1:14), scores(tmp2, dis="lc", choi=1:14))
-R> max(residuals(proc))
+> tmp1 <- rda(varespec ~ ., varechem)
+> tmp2 <- rda(varespec[i,] ~ ., varechem)
+> proc <- procrustes(scores(tmp1, dis="lc", choi=1:14),
+ scores(tmp2, dis="lc", choi=1:14))
+> max(residuals(proc))
\end{Sinput}
\begin{Soutput}
-[1] 3.115295e-14
+[1] 3.435509e-14
\end{Soutput}
\end{Schunk}
In \code{cca} the difference would be somewhat larger than now
-observed 3.1153e-14 because site
+observed 3.4355e-14 because site
weights used for environmental variables are shuffled with the species
data.
@@ -552,31 +562,19 @@ analysis using only one factor (class variable) as constraint. The
following example uses the classical dune meadow data \cite{Jongman87}:
\begin{Schunk}
\begin{Sinput}
-R> data(dune)
-R> data(dune.env)
-R> summary(dune.env)
-\end{Sinput}
-\begin{Soutput}
- A1 Moisture Management Use Manure
- Min. : 2.800 1:7 BF:3 Hayfield:7 0:6
- 1st Qu.: 3.500 2:4 HF:5 Haypastu:8 1:3
- Median : 4.200 4:2 NM:6 Pasture :5 2:4
- Mean : 4.850 5:7 SF:6 3:4
- 3rd Qu.: 5.725 4:3
- Max. :11.500
-\end{Soutput}
-\begin{Sinput}
-R> orig <- cca(dune ~ Moisture, dune.env)
+> data(dune)
+> data(dune.env)
+> orig <- cca(dune ~ Moisture, dune.env)
\end{Sinput}
\end{Schunk}
When the results are plotted using LC scores, sample plots fall only
in four alternative positions (Fig. \ref{fig:factorlc}).
-\begin{SCfigure}
+\begin{figure}
\includegraphics{decision-vegan-016}
\caption{LC scores of the dune meadow data using only one factor as a
constraint.}
\label{fig:factorlc}
-\end{SCfigure}
+\end{figure}
In the previous chapter we saw that this happens because LC scores
\emph{are} the environmental variables, and they can be distinct only
if the environmental variables are distinct. However, normally the user
@@ -591,17 +589,17 @@ Function \code{ordispider} adds line segments to connect each WA
score with the corresponding LC (Fig. \ref{fig:walcspider}).
\begin{Schunk}
\begin{Sinput}
-R> plot(orig, display="wa", type="points")
-R> ordispider(orig, col="red")
-R> text(orig, dis="cn", col="blue")
+> plot(orig, display="wa", type="points")
+> ordispider(orig, col="red")
+> text(orig, dis="cn", col="blue")
\end{Sinput}
\end{Schunk}
-\begin{SCfigure}
+\begin{figure}
\includegraphics{decision-vegan-018}
\caption{A ``spider plot'' connecting WA scores to corresponding LC
scores. The shorter the web segments, the better the ordination.}
\label{fig:walcspider}
-\end{SCfigure}
+\end{figure}
This is the standard way of displaying results of discriminant
analysis, too. Moisture classes \code{1} and \code{2} seem to be
overlapping, and cannot be completely separated by their
diff --git a/inst/doc/diversity-vegan.Rnw b/vignettes/diversity-vegan.Rnw
similarity index 76%
copy from inst/doc/diversity-vegan.Rnw
copy to vignettes/diversity-vegan.Rnw
index 3b8c590..70178fe 100644
--- a/inst/doc/diversity-vegan.Rnw
+++ b/vignettes/diversity-vegan.Rnw
@@ -1,52 +1,43 @@
% -*- mode: noweb; noweb-default-code-mode: R-mode; -*-
%\VignetteIndexEntry{Diversity analysis in vegan}
-\documentclass[article,nojss]{jss}
-\usepackage{veganjss} %% vegan setup
-\usepackage{ucs}
-\usepackage[utf8x]{inputenc}
-\usepackage[T1]{fontenc}
-\usepackage{sidecap}
-\usepackage{amsmath}
-\usepackage{amssymb} % \gtrapprox
+\documentclass[a4paper,10pt,twocolumn]{article}
+\usepackage{vegan} %% vegan setup
+%% TODO: SSarrhenius, adipart, beals update, betadisper
+%% expansion (+ permutest), contribdiv, eventstar, multipart, refer to
+%% FD, check Kindt reference to specaccum, check estimateR ref
\title{Vegan: ecological diversity} \author{Jari Oksanen}
-\Abstract{ This document explains diversity related methods in
- \pkg{vegan}. The methods are briefly described, and the equations
- used them are given often in more detail than in their help
- pages. The methods discussed include common diversity indices and
- rarefaction, families of diversity indices, species abundance
- models, species accumulation models and beta diversity, extrapolated
- richness and probability of being a member of the species pool. The
- document is still incomplete and does not cover all diversity
- methods in \pkg{vegan}.}
-
-\Keywords{diversity, Shannon, Simpson, R{\'e}nyi, Hill number,
- Tsallis, rarefaction, species accumulation, beta diversity, species
- abundance, Fisher alpha, Fisher logarithmic series, Preston
- log-normal model, species abundance models, Whittaker plots,
- extended richness, taxonomic diversity, functional divesity, species
- pool}
-
-%% misuse next for scm data
-\Address{$ $Id: diversity-vegan.Rnw 2346 2013-01-07 11:42:36Z jarioksa $ $
+\date{\footnotesize{$ $Id: diversity-vegan.Rnw 2597 2013-08-28 08:56:55Z jarioksa $ $
processed with vegan \Sexpr{packageDescription("vegan", field="Version")}
- in \Sexpr{R.version.string} on \today}
-\Footername{About this version}
+ in \Sexpr{R.version.string} on \today}}
%% need no \usepackage{Sweave}
\begin{document}
-\setkeys{Gin}{width=0.55\linewidth}
+\bibliographystyle{jss}
+
\SweaveOpts{strip.white=true}
<<echo=false>>=
par(mfrow=c(1,1))
-options(width=72)
+options(width=55)
figset <- function() par(mar=c(4,4,1,1)+.1)
options(SweaveHooks = list(fig = figset))
-options("prompt" = "R> ", "continue" = "+ ")
+options("prompt" = "> ", "continue" = " ")
@
+\maketitle
+\begin{abstract}
+ This document explains diversity related methods in
+ \pkg{vegan}. The methods are briefly described, and the equations
+ used them are given often in more detail than in their help
+ pages. The methods discussed include common diversity indices and
+ rarefaction, families of diversity indices, species abundance
+ models, species accumulation models and beta diversity, extrapolated
+ richness and probability of being a member of the species pool. The
+ document is still incomplete and does not cover all diversity
+ methods in \pkg{vegan}.
+\end{abstract}
\tableofcontents
@@ -72,7 +63,7 @@ data(BCI)
\section{Diversity indices}
Function \code{diversity} finds the most commonly used diversity
-indices:
+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}\\
@@ -99,7 +90,7 @@ where \code{specnumber} is a simple \pkg{vegan} function to find
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:
+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
\end{equation}
@@ -108,7 +99,7 @@ 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 =
- \log(\sum p_i^2)$, and $H_\infty = - \log(\max p_i)$.
-Tsallis diversity of order $q$ is:
+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}
@@ -127,10 +118,7 @@ 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}).
-<<echo=false,results=hide>>=
-require(lattice, quietly=TRUE)
-@
-\begin{SCfigure}
+\begin{figure}
<<fig=true,echo=false>>=
print(plot(R))
@
@@ -139,10 +127,10 @@ print(plot(R))
show the values for sites, and the lines the extremes and median in
the data set.}
\label{fig:renyi}
-\end{SCfigure}
+\end{figure}
Finally, the $\alpha$ parameter of Fisher's log-series can be used as
-a diversity index:
+a diversity index \citep{FisherEtal43}:
<<>>=
alpha <- fisher.alpha(BCI)
@
@@ -153,24 +141,24 @@ Species richness increases with sample size, and differences in
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:
-\begin{equation}
+rarefied from $N$ to $n$ individuals is \citep{Hurlbert71}:
+\begin{multline}
\label{eq:rare}
-\hat S_n = \sum_{i=1}^S (1 - q_i),\quad \text{where} \quad q_i = {N-x_i
+\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{equation}
+\end{multline}
where $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
other cases $q_i = 0$ or the species is sure to occur in the sample.
-The variance of rarefied richness is:
-\begin{equation}
+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
+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]
-\end{equation}
+\end{multline}
Equation \ref{eq:rarevar} actually is of the same form as the variance
of sum of correlated variables:
\begin{equation}
@@ -200,31 +188,31 @@ This will not give equal rank order with the previous rarefaction
richness:
<<>>=
all(rank(Srar) == rank(S2))
-@
+@
Moreover, the rarefied richness for two individuals is a finite
-sample variant of Simpson's diversity index (or, more precisely of
-$D_1 + 1$), and these two are almost identical in BCI:
+sample variant of Simpson's diversity index \citep{Hurlbert71}\,--\,or
+more precisely of $D_1 + 1$, and these two are almost identical in
+BCI:
<<>>=
range(diversity(BCI, "simp") - (S2 -1))
-@
+@
Rarefaction is sometimes presented as an ecologically meaningful
-alternative to dubious diversity indices, but the differences really
-seem to be small.
+alternative to dubious diversity indices \citep{Hurlbert71}, but the
+differences really seem to be small.
\section{Taxonomic and functional diversity}
Simple diversity indices only consider species identity: all different
species are equally different. In contrast, taxonomic and functional
-diversity indices judge the differences of species
-are. Taxonomic and functional diversities are used in different fields
-of science, but they really have very similar reasoning, and either
-could be used either with taxonomic or functional properties of
-species.
+diversity indices judge the differences of species. Taxonomic and
+functional diversities are used in different fields of science, but
+they really have very similar reasoning, and either could be used
+either with taxonomic or functional traits of species.
-\subsection{Taxonomic diversity: average distance of properties}
+\subsection{Taxonomic diversity: average distance of traits}
-The two basic indices are called taxonomic diversity ($\Delta$) and
-taxonomic distinctness ($\Delta^*$):
+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}
@@ -240,23 +228,23 @@ richness\footnote{This text normally uses upper case letter $S$ for
species richness, but lower case $s$ is used here in accordance with
the original papers on taxonomic diversity}
to give $s \Delta^+$, or it can be used to estimate an index of
-variation in taxonomic distinctness $\Lambda^+$:
+variation in taxonomic distinctness $\Lambda^+$ \citep{ClarkeWarwick01}:
\begin{equation}
\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
-calculate the indices. These can be any
-distance structure among species, but usually it is found from
-established hierarchic taxonomy. Typical coding is that differences
-among species in the same genus is $1$, among the same family it is
-$2$ etc. However, the taxonomic differences are scaled to maximum
-$100$ for easier comparison between different data sets and
-taxonomies. Alternatively, it is possible to scale steps between
-taxonomic level proportional to the reduction in the number of
-categories: if almost all genera have only one species, it does not
-make a great difference if two individuals belong to a different
-species or to a different genus.
+calculate the indices. These can be any distance structure among
+species, but usually it is found from established hierarchic
+taxonomy. Typical coding is that differences among species in the same
+genus is $1$, among the same family it is $2$ etc. However, the
+taxonomic differences are scaled to maximum $100$ for easier
+comparison between different data sets and taxonomies. Alternatively,
+it is possible to scale steps between taxonomic level proportional to
+the reduction in the number of categories \citep{ClarkeWarwick99}: if
+almost all genera have only one species, it does not make a great
+difference if two individuals belong to a different species or to a
+different genus.
Function \code{taxondive} implements indices of taxonomic diversity,
and \code{taxa2dist} can be used to convert classification tables to
@@ -273,7 +261,7 @@ data(dune.taxon)
taxdis <- taxa2dist(dune.taxon, varstep=TRUE)
mod <- taxondive(dune, taxdis)
@
-\begin{SCfigure}
+\begin{figure}
<<fig=true,echo=false>>=
plot(mod)
@
@@ -281,25 +269,26 @@ plot(mod)
points are diversity values of single sites, and the funnel is their
approximate confidence intervals ($2 \times$ standard error).}
\label{fig:taxondive}
-\end{SCfigure}
+\end{figure}
-\subsection{Functional diversity: the height of property tree}
+\subsection{Functional diversity: the height of trait tree}
In taxonomic diversity the primary data were taxonomic trees which
were transformed to pairwise distances among species. In functional
-diversity the primary data are species properties which are translated
-to pairwise distances among species and then to clustering trees of
-species properties. The argument for trees is that in this way a
+diversity the primary data are species traits which are translated to
+pairwise distances among species and then to clustering trees of
+species traits. The argument for using trees is that in this way a
single deviant species will have a small influence, since its
difference is evaluated only once instead of evaluating its distance
-to all other species.
+to all other species \citep{PetcheyGaston06}.
Function \code{treedive} implements functional diversity defined as
the total branch length in a trait dendrogram connecting all species,
-but excluding the unnecessary root segments of the tree. The example
-uses the taxonomic distances of the previous chapter. These are first
-converted to a hierarchic clustering (which actually were their
-original form before \code{taxa2dist} converted them into distances)
+but excluding the unnecessary root segments of the tree
+\citep{PetcheyGaston02, PetcheyGaston06}. The example uses the
+taxonomic distances of the previous chapter. These are first converted
+to a hierarchic clustering (which actually were their original form
+before \code{taxa2dist} converted them into distances)
<<>>=
tr <- hclust(taxdis, "aver")
mod <- treedive(dune, tr)
@@ -316,7 +305,7 @@ several models for species abundance distribution.
\subsection{Fisher and Preston}
In Fisher's log-series, the expected number of species $\hat f$ with $n$
-individuals is:
+individuals is \citep{FisherEtal43}:
\begin{equation}
\hat f_n = \frac{\alpha x^n}{n}
\end{equation}
@@ -329,14 +318,14 @@ k <- sample(nrow(BCI), 1)
fish <- fisherfit(BCI[k,])
fish
@
-\begin{SCfigure}
+\begin{figure}
<<fig=true,echo=false>>=
plot(fish)
@
\caption{Fisher's log-series fitted to one randomly selected site
(\Sexpr{k}).}
\label{fig:fisher}
-\end{SCfigure}
+\end{figure}
We already saw $\alpha$ as a diversity index. Now we also obtained
estimate of standard error of $\alpha$ (these also are optionally
available in \code{fisher.alpha}). The standard errors are based on
@@ -351,26 +340,25 @@ confint(fish)
@
Preston's log-normal model is the main challenger to Fisher's
-log-series. Instead of plotting species by frequencies, it bins
-species into frequency classes of increasing sizes. As a result,
-upper bins with high range of frequencies become more common, and
-sometimes the result looks similar to Gaussian distribution truncated
-at the left.
+log-series \citep{Preston48}. Instead of plotting species by
+frequencies, it bins species into frequency classes of increasing
+sizes. As a result, upper bins with high range of frequencies become
+more common, and sometimes the result looks similar to Gaussian
+distribution truncated at the left.
There are two alternative functions for the log-normal model:
-\code{prestonfit} and \code{prestondistr}. Function
-\code{prestonfit} uses traditionally binning approach, and is burdened
-with arbitrary choices of binning limits and treatment of ties. It
-seems that Preston split ties between adjacent octaves: only half of
-the species observed once were in the first octave, and half were
-transferred to the next octave, and the same for all species at the
-octave limits occuring 2, 4, 8, 16\ldots times. Function
+\code{prestonfit} and \code{prestondistr}. Function \code{prestonfit}
+uses traditionally binning approach, and is burdened with arbitrary
+choices of binning limits and treatment of ties. It seems that Preston
+split ties between adjacent octaves: only half of the species observed
+once were in the first octave, and half were transferred to the next
+octave, and the same for all species at the octave limits occurring 2,
+4, 8, 16\ldots times \citep{WilliamsonGaston05}. Function
\code{prestonfit} can either split the ties or keep all limit cases in
-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 \Sexpr{k}):
+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 \Sexpr{k}):
<<>>=
prestondistr(BCI[k,])
@
@@ -379,11 +367,11 @@ prestondistr(BCI[k,])
An alternative approach to species abundance distribution is to plot
logarithmic abundances in decreasing order, or against ranks of
-species. These are known as ranked abundance
+species \citep{Whittaker65}. These are known as ranked abundance
distribution curves, species abundance curves, dominance--diversity
-curves or Whittaker plots.
-Function \code{radfit} fits some of the most popular models using
-maximum likelihood estimation:
+curves or Whittaker plots. Function \code{radfit} fits some of the
+most popular models \citep{Bastow91} using maximum likelihood
+estimation:
\begin{align}
\hat a_r &= \frac{N}{S} \sum_{k=r}^S \frac{1}{k} &\text{brokenstick}\\
\hat a_r &= N \alpha (1-\alpha)^{r-1} & \text{preemption} \\
@@ -407,14 +395,14 @@ set gives (Fig. \ref{fig:rad}):
rad <- radfit(BCI[k,])
rad
@
-\begin{SCfigure}
+\begin{figure}
<<fig=true,echo=false>>=
print(radlattice(rad))
@
\caption{Ranked abundance distribution models for a random plot
(no. \Sexpr{k}). The best model has the lowest \textsc{aic}.}
\label{fig:rad}
-\end{SCfigure}
+\end{figure}
Function \code{radfit} compares the models using alternatively
Akaike's or Schwartz's Bayesian information criteria. These are based
@@ -445,23 +433,24 @@ several alternative methods, including accumulating sites in the order
they happen to be, and repeated accumulation in random order. In
addition, there are three analytic models. Rarefaction pools
individuals together, and applies rarefaction equation (\ref{eq:rare})
-to these individuals. Kindt's exact accumulator resembles rarefaction:
-\begin{equation}
+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
+\hat S_n = \sum_{i=1}^S (1 - p_i), \, \\ \text{where} \quad p_i = {N- f_i
\choose n} \Bigm / {N \choose n}
-\end{equation}
+\end{multline}
where $f_i$ is the frequency of species $i$. Approximate variance
estimator is:
-\begin{equation}
+\begin{multline}
\label{eq:kindtvar}
-s^2 = p_i (1 - p_i) + 2 \sum_{i=1}^S \sum_{j>i} \left( r_{ij}
+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)
-\end{equation}
+\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
-analytic method was suggested by Coleman:
+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}
@@ -476,28 +465,28 @@ The recommended is Kindt's exact method (Fig. \ref{fig:sac}):
sac <- specaccum(BCI)
plot(sac, ci.type="polygon", ci.col="yellow")
@
-\begin{SCfigure}
+\begin{figure}
<<fig=true,echo=false>>=
<<a>>
@
\caption{Species accumulation curve for the BCI data; exact method.}
\label{fig:sac}
-\end{SCfigure}
+\end{figure}
\subsection{Beta diversity}
-Whittaker divided diversity into various components. The best known
-are diversity in one spot that he called alpha diversity, and the
-diversity along gradients that he called beta diversity. The basic
-diversity indices are indices of alpha diversity. Beta diversity
-should be studied with respect to gradients, but almost everybody
-understand that as a measure of general heterogeneity: how many more
-species do you have in a collection of sites compared to an average
-site.
+\citet{Whittaker60} divided diversity into various components. The
+best known are diversity in one spot that he called alpha diversity,
+and the diversity along gradients that he called beta diversity. The
+basic diversity indices are indices of alpha diversity. Beta diversity
+should be studied with respect to gradients \citep{Whittaker60}, but
+almost everybody understand that as a measure of general heterogeneity
+\citep{Tuomisto10a, Tuomisto10b}: how many more species do you have in
+a collection of sites compared to an average site.
The best known index of beta diversity is based on the ratio of total
-number of species in a collection of sites ($S$) and the average
-richness per one site ($\bar \alpha$):
+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
@@ -512,8 +501,8 @@ ncol(BCI)/mean(specnumber(BCI)) - 1
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. Whittaker noticed this, and suggested the index to be
-found from pairwise comparison of sites. If the number of shared
+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:
@@ -531,8 +520,8 @@ 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
-\code{betadiver}. The indices in \code{betadiver} can be referred
-to by subscript name, or index number:
+\code{betadiver} \citep{KoleffEtal03}. The indices in \code{betadiver}
+can be referred to by subscript name, or index number:
<<>>=
betadiver(help=TRUE)
@
@@ -560,10 +549,10 @@ The size $X$ and parameter $c$ cancel out, and the index gives the
estimate $z$ for any pair of sites.
Function \code{betadisper} can be used to analyse beta diversities
-with respect to classes or factors. 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}):
+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}):
<<>>=
data(dune)
data(dune.env)
@@ -571,7 +560,7 @@ z <- betadiver(dune, "z")
mod <- with(dune.env, betadisper(z, Management))
mod
@
-\begin{SCfigure}
+\begin{figure}
<<fig=true,echo=false>>=
boxplot(mod)
@
@@ -579,7 +568,7 @@ boxplot(mod)
($z$) of the species area curve in the Arrhenius model $S = cX^z$ in
Management classes of dune meadows.}
\label{fig:betadisper}
-\end{SCfigure}
+\end{figure}
\section{Species pool}
\subsection{Number of unseen species}
@@ -595,12 +584,12 @@ species is related to the number of rare species, or species seen only
once or twice.
Function \code{specpool} implements the following models to estimate
-the pool size $S_p$:
+the pool size $S_p$ \citep{SmithVanBelle84, Chao87}:
\begin{align}
S_p &= S_o + \frac{f_1^2}{2 f_2} & \text{Chao}\\
-S_p &= S_o + f_1 \frac{N-1}{N} & \text{1st order Jackknife}\\
-S_p & = S_o + f_1 \frac{2N-3}{N} + f_2 \frac{(N-2)^2}{N(N-1)} &
-\text{2nd order Jackknife}\\
+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
@@ -610,27 +599,24 @@ 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 estimators of Chao is:
+The variance the estimator of \citet{Chao87} is:
\begin{equation}
s^2 = f_2 \left(\frac{G^4}{4} + G^3 + \frac{G^2}{2} \right), \,
\text{where}\quad G = \frac{f_1}{f_2}
\end{equation}
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:
+plots \citep{SmithVanBelle84}:
\begin{equation}
s^2 = \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:
-\begin{equation}
-\begin{split}
-s^2 = \sum_{i=1}^{S_o} q_i (1-q_i) + 2 \sum \sum Z_p , \quad \text{where} \\
-Z_p = \dots
-\end{split}
-\end{equation}
+new variable $q_i = (1-p_i)^N$ for each species \citep{SmithVanBelle84}:
+\begin{multline}
+s^2 = \sum_{i=1}^{S_o} q_i (1-q_i) + 2 \sum \sum Z_p ,\\ \text{where}\; Z_p = \dots
+\end{multline}
The extrapolated richness values for the whole BCI data are:
<<>>=
@@ -660,7 +646,7 @@ equation. \textsc{ace} is based on rare species also:
\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}\\
+\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}}
@@ -703,7 +689,8 @@ missing species could occur in a site, or which sites are suitable for
a species. The probability for each species at each site is assessed
from other species occurring on the site.
-Function \code{beals} implement Beals smoothing:
+Function \code{beals} implement Beals smoothing \citep{McCune87,
+ DeCaceresLegendre08}:
<<>>=
smo <- beals(BCI)
@
@@ -713,14 +700,18 @@ only one species, and to avoid circular reasoning we do not include
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")
+plot(beals(BCI, species=j, include=FALSE), BCI[,j],
+ main="Ceiba pentandra", xlab="Probability of occurrence",
+ ylab="Occurrence")
@
-\begin{SCfigure}
+\begin{figure}
<<fig=true,echo=false>>=
<<a>>
@
\caption{Beals smoothing for \emph{Ceiba pentandra}.}
\label{fig:beals}
-\end{SCfigure}
+\end{figure}
+
+\bibliography{vegan}
\end{document}
diff --git a/inst/doc/diversity-vegan.tex b/vignettes/diversity-vegan.tex
similarity index 69%
rename from inst/doc/diversity-vegan.tex
rename to vignettes/diversity-vegan.tex
index 9cde6e9..e2d5220 100644
--- a/inst/doc/diversity-vegan.tex
+++ b/vignettes/diversity-vegan.tex
@@ -1,18 +1,27 @@
% -*- mode: noweb; noweb-default-code-mode: R-mode; -*-
%\VignetteIndexEntry{Diversity analysis in vegan}
-\documentclass[article,nojss]{jss}
-\usepackage{veganjss} %% vegan setup
-\usepackage{ucs}
-\usepackage[utf8x]{inputenc}
-\usepackage[T1]{fontenc}
-\usepackage{sidecap}
-\usepackage{amsmath}
-\usepackage{amssymb} % \gtrapprox
+\documentclass[a4paper,10pt,twocolumn]{article}
+\usepackage{vegan} %% vegan setup
+%% TODO: SSarrhenius, adipart, beals update, betadisper
+%% expansion (+ permutest), contribdiv, eventstar, multipart, refer to
+%% FD, check Kindt reference to specaccum, check estimateR ref
\title{Vegan: ecological diversity} \author{Jari Oksanen}
-\Abstract{ This document explains diversity related methods in
+\date{\footnotesize{$ $Id: diversity-vegan.Rnw 2597 2013-08-28 08:56:55Z jarioksa $ $
+ processed with vegan 2.0-9
+ in R Under development (unstable) (2013-09-25 r63985) on \today}}
+
+%% need no \usepackage{Sweave}
+\begin{document}
+\bibliographystyle{jss}
+
+
+
+\maketitle
+\begin{abstract}
+ This document explains diversity related methods in
\pkg{vegan}. The methods are briefly described, and the equations
used them are given often in more detail than in their help
pages. The methods discussed include common diversity indices and
@@ -20,26 +29,8 @@
models, species accumulation models and beta diversity, extrapolated
richness and probability of being a member of the species pool. The
document is still incomplete and does not cover all diversity
- methods in \pkg{vegan}.}
-
-\Keywords{diversity, Shannon, Simpson, R{\'e}nyi, Hill number,
- Tsallis, rarefaction, species accumulation, beta diversity, species
- abundance, Fisher alpha, Fisher logarithmic series, Preston
- log-normal model, species abundance models, Whittaker plots,
- extended richness, taxonomic diversity, functional divesity, species
- pool}
-
-%% misuse next for scm data
-\Address{$ $Id: diversity-vegan.Rnw 2346 2013-01-07 11:42:36Z jarioksa $ $
- processed with vegan 2.0-7
- in R Under development (unstable) (2013-03-19 r62316) on \today}
-\Footername{About this version}
-
-%% need no \usepackage{Sweave}
-\begin{document}
-\setkeys{Gin}{width=0.55\linewidth}
-
-
+ methods in \pkg{vegan}.
+\end{abstract}
\tableofcontents
@@ -59,15 +50,15 @@ Island. The following steps make these data available for the
document:
\begin{Schunk}
\begin{Sinput}
-R> library(vegan)
-R> data(BCI)
+> library(vegan)
+> data(BCI)
\end{Sinput}
\end{Schunk}
\section{Diversity indices}
Function \code{diversity} finds the most commonly used diversity
-indices:
+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}\\
@@ -81,7 +72,7 @@ theoretical justification. The default is to use natural logarithms.
Shannon index is calculated with:
\begin{Schunk}
\begin{Sinput}
-R> H <- diversity(BCI)
+> H <- diversity(BCI)
\end{Sinput}
\end{Schunk}
which finds diversity indices for all sites.
@@ -91,14 +82,14 @@ the most common of these, Pielou's evenness $J = H'/\log(S)$ is easily
found as:
\begin{Schunk}
\begin{Sinput}
-R> J <- H/log(specnumber(BCI))
+> J <- H/log(specnumber(BCI))
\end{Sinput}
\end{Schunk}
where \code{specnumber} is a simple \pkg{vegan} function to find
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:
+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
\end{equation}
@@ -107,7 +98,7 @@ 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 =
- \log(\sum p_i^2)$, and $H_\infty = - \log(\max p_i)$.
-Tsallis diversity of order $q$ is:
+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}
@@ -120,28 +111,28 @@ and $H_2 = D_2$, and can be converted to the Hill number:
We select a random subset of five sites for R\'{e}nyi diversities:
\begin{Schunk}
\begin{Sinput}
-R> k <- sample(nrow(BCI), 6)
-R> R <- renyi(BCI[k,])
+> k <- sample(nrow(BCI), 6)
+> R <- renyi(BCI[k,])
\end{Sinput}
\end{Schunk}
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}).
-\begin{SCfigure}
-\includegraphics{diversity-vegan-007}
+\begin{figure}
+\includegraphics{diversity-vegan-006}
\caption{R\'{e}nyi diversities in six randomly selected plots. The plot
uses Trellis graphics with a separate panel for each site. The dots
show the values for sites, and the lines the extremes and median in
the data set.}
\label{fig:renyi}
-\end{SCfigure}
+\end{figure}
Finally, the $\alpha$ parameter of Fisher's log-series can be used as
-a diversity index:
+a diversity index \citep{FisherEtal43}:
\begin{Schunk}
\begin{Sinput}
-R> alpha <- fisher.alpha(BCI)
+> alpha <- fisher.alpha(BCI)
\end{Sinput}
\end{Schunk}
@@ -151,24 +142,24 @@ Species richness increases with sample size, and differences in
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:
-\begin{equation}
+rarefied from $N$ to $n$ individuals is \citep{Hurlbert71}:
+\begin{multline}
\label{eq:rare}
-\hat S_n = \sum_{i=1}^S (1 - q_i),\quad \text{where} \quad q_i = {N-x_i
+\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{equation}
+\end{multline}
where $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
other cases $q_i = 0$ or the species is sure to occur in the sample.
-The variance of rarefied richness is:
-\begin{equation}
+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
+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]
-\end{equation}
+\end{multline}
Equation \ref{eq:rarevar} actually is of the same form as the variance
of sum of correlated variables:
\begin{equation}
@@ -180,7 +171,7 @@ The number of stems per hectare varies in our
data set:
\begin{Schunk}
\begin{Sinput}
-R> quantile(rowSums(BCI))
+> quantile(rowSums(BCI))
\end{Sinput}
\begin{Soutput}
0% 25% 50% 75% 100%
@@ -190,7 +181,7 @@ R> quantile(rowSums(BCI))
To express richness for the same number of individuals, we can use:
\begin{Schunk}
\begin{Sinput}
-R> Srar <- rarefy(BCI, min(rowSums(BCI)))
+> Srar <- rarefy(BCI, min(rowSums(BCI)))
\end{Sinput}
\end{Schunk}
Rarefaction curves often are seen as an objective solution for
@@ -201,48 +192,48 @@ rarefaction curves can cross.
As an extreme case we may rarefy sample size to two individuals:
\begin{Schunk}
\begin{Sinput}
-R> S2 <- rarefy(BCI, 2)
+> S2 <- rarefy(BCI, 2)
\end{Sinput}
\end{Schunk}
This will not give equal rank order with the previous rarefaction
richness:
\begin{Schunk}
\begin{Sinput}
-R> all(rank(Srar) == rank(S2))
+> all(rank(Srar) == rank(S2))
\end{Sinput}
\begin{Soutput}
[1] FALSE
\end{Soutput}
\end{Schunk}
Moreover, the rarefied richness for two individuals is a finite
-sample variant of Simpson's diversity index (or, more precisely of
-$D_1 + 1$), and these two are almost identical in BCI:
+sample variant of Simpson's diversity index \citep{Hurlbert71}\,--\,or
+more precisely of $D_1 + 1$, and these two are almost identical in
+BCI:
\begin{Schunk}
\begin{Sinput}
-R> range(diversity(BCI, "simp") - (S2 -1))
+> range(diversity(BCI, "simp") - (S2 -1))
\end{Sinput}
\begin{Soutput}
[1] -0.002868298 -0.001330663
\end{Soutput}
\end{Schunk}
Rarefaction is sometimes presented as an ecologically meaningful
-alternative to dubious diversity indices, but the differences really
-seem to be small.
+alternative to dubious diversity indices \citep{Hurlbert71}, but the
+differences really seem to be small.
\section{Taxonomic and functional diversity}
Simple diversity indices only consider species identity: all different
species are equally different. In contrast, taxonomic and functional
-diversity indices judge the differences of species
-are. Taxonomic and functional diversities are used in different fields
-of science, but they really have very similar reasoning, and either
-could be used either with taxonomic or functional properties of
-species.
+diversity indices judge the differences of species. Taxonomic and
+functional diversities are used in different fields of science, but
+they really have very similar reasoning, and either could be used
+either with taxonomic or functional traits of species.
-\subsection{Taxonomic diversity: average distance of properties}
+\subsection{Taxonomic diversity: average distance of traits}
-The two basic indices are called taxonomic diversity ($\Delta$) and
-taxonomic distinctness ($\Delta^*$):
+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}
@@ -258,23 +249,23 @@ richness\footnote{This text normally uses upper case letter $S$ for
species richness, but lower case $s$ is used here in accordance with
the original papers on taxonomic diversity}
to give $s \Delta^+$, or it can be used to estimate an index of
-variation in taxonomic distinctness $\Lambda^+$:
+variation in taxonomic distinctness $\Lambda^+$ \citep{ClarkeWarwick01}:
\begin{equation}
\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
-calculate the indices. These can be any
-distance structure among species, but usually it is found from
-established hierarchic taxonomy. Typical coding is that differences
-among species in the same genus is $1$, among the same family it is
-$2$ etc. However, the taxonomic differences are scaled to maximum
-$100$ for easier comparison between different data sets and
-taxonomies. Alternatively, it is possible to scale steps between
-taxonomic level proportional to the reduction in the number of
-categories: if almost all genera have only one species, it does not
-make a great difference if two individuals belong to a different
-species or to a different genus.
+calculate the indices. These can be any distance structure among
+species, but usually it is found from established hierarchic
+taxonomy. Typical coding is that differences among species in the same
+genus is $1$, among the same family it is $2$ etc. However, the
+taxonomic differences are scaled to maximum $100$ for easier
+comparison between different data sets and taxonomies. Alternatively,
+it is possible to scale steps between taxonomic level proportional to
+the reduction in the number of categories \citep{ClarkeWarwick99}: if
+almost all genera have only one species, it does not make a great
+difference if two individuals belong to a different species or to a
+different genus.
Function \code{taxondive} implements indices of taxonomic diversity,
and \code{taxa2dist} can be used to convert classification tables to
@@ -287,41 +278,42 @@ data in \pkg{vegan}\footnote{Actually I made such a classification,
but there is such a table for the Dune meadow data (Fig. \ref{fig:taxondive}):
\begin{Schunk}
\begin{Sinput}
-R> data(dune)
-R> data(dune.taxon)
-R> taxdis <- taxa2dist(dune.taxon, varstep=TRUE)
-R> mod <- taxondive(dune, taxdis)
+> data(dune)
+> data(dune.taxon)
+> taxdis <- taxa2dist(dune.taxon, varstep=TRUE)
+> mod <- taxondive(dune, taxdis)
\end{Sinput}
\end{Schunk}
-\begin{SCfigure}
-\includegraphics{diversity-vegan-015}
+\begin{figure}
+\includegraphics{diversity-vegan-014}
\caption{Taxonomic diversity $\Delta^+$ for the dune meadow data. The
points are diversity values of single sites, and the funnel is their
approximate confidence intervals ($2 \times$ standard error).}
\label{fig:taxondive}
-\end{SCfigure}
+\end{figure}
-\subsection{Functional diversity: the height of property tree}
+\subsection{Functional diversity: the height of trait tree}
In taxonomic diversity the primary data were taxonomic trees which
were transformed to pairwise distances among species. In functional
-diversity the primary data are species properties which are translated
-to pairwise distances among species and then to clustering trees of
-species properties. The argument for trees is that in this way a
+diversity the primary data are species traits which are translated to
+pairwise distances among species and then to clustering trees of
+species traits. The argument for using trees is that in this way a
single deviant species will have a small influence, since its
difference is evaluated only once instead of evaluating its distance
-to all other species.
+to all other species \citep{PetcheyGaston06}.
Function \code{treedive} implements functional diversity defined as
the total branch length in a trait dendrogram connecting all species,
-but excluding the unnecessary root segments of the tree. The example
-uses the taxonomic distances of the previous chapter. These are first
-converted to a hierarchic clustering (which actually were their
-original form before \code{taxa2dist} converted them into distances)
+but excluding the unnecessary root segments of the tree
+\citep{PetcheyGaston02, PetcheyGaston06}. The example uses the
+taxonomic distances of the previous chapter. These are first converted
+to a hierarchic clustering (which actually were their original form
+before \code{taxa2dist} converted them into distances)
\begin{Schunk}
\begin{Sinput}
-R> tr <- hclust(taxdis, "aver")
-R> mod <- treedive(dune, tr)
+> tr <- hclust(taxdis, "aver")
+> mod <- treedive(dune, tr)
\end{Sinput}
\end{Schunk}
@@ -336,7 +328,7 @@ several models for species abundance distribution.
\subsection{Fisher and Preston}
In Fisher's log-series, the expected number of species $\hat f$ with $n$
-individuals is:
+individuals is \citep{FisherEtal43}:
\begin{equation}
\hat f_n = \frac{\alpha x^n}{n}
\end{equation}
@@ -346,24 +338,24 @@ of individuals $N$ in the site, $x = N/(N-\alpha)$. Fisher's
log-series for a randomly selected plot is (Fig. \ref{fig:fisher}):
\begin{Schunk}
\begin{Sinput}
-R> k <- sample(nrow(BCI), 1)
-R> fish <- fisherfit(BCI[k,])
-R> fish
+> k <- sample(nrow(BCI), 1)
+> fish <- fisherfit(BCI[k,])
+> fish
\end{Sinput}
\begin{Soutput}
Fisher log series model
-No. of species: 94
+No. of species: 82
Estimate Std. Error
-alpha 34.823 4.4404
+alpha 30.584 4.1814
\end{Soutput}
\end{Schunk}
-\begin{SCfigure}
-\includegraphics{diversity-vegan-018}
+\begin{figure}
+\includegraphics{diversity-vegan-017}
\caption{Fisher's log-series fitted to one randomly selected site
- (10).}
+ (7).}
\label{fig:fisher}
-\end{SCfigure}
+\end{figure}
We already saw $\alpha$ as a diversity index. Now we also obtained
estimate of standard error of $\alpha$ (these also are optionally
available in \code{fisher.alpha}). The standard errors are based on
@@ -375,51 +367,53 @@ inspect the validity of normal assumptions, and will be used in
calculations of confidence intervals from profile deviance:
\begin{Schunk}
\begin{Sinput}
-R> confint(fish)
+> confint(fish)
\end{Sinput}
\begin{Soutput}
2.5 % 97.5 %
-26.97514 44.48423
+23.24833 39.75274
\end{Soutput}
\end{Schunk}
Preston's log-normal model is the main challenger to Fisher's
-log-series. Instead of plotting species by frequencies, it bins
-species into frequency classes of increasing sizes. As a result,
-upper bins with high range of frequencies become more common, and
-sometimes the result looks similar to Gaussian distribution truncated
-at the left.
+log-series \citep{Preston48}. Instead of plotting species by
+frequencies, it bins species into frequency classes of increasing
+sizes. As a result, upper bins with high range of frequencies become
+more common, and sometimes the result looks similar to Gaussian
+distribution truncated at the left.
There are two alternative functions for the log-normal model:
-\code{prestonfit} and \code{prestondistr}. Function
-\code{prestonfit} uses traditionally binning approach, and is burdened
-with arbitrary choices of binning limits and treatment of ties. It
-seems that Preston split ties between adjacent octaves: only half of
-the species observed once were in the first octave, and half were
-transferred to the next octave, and the same for all species at the
-octave limits occuring 2, 4, 8, 16\ldots times. Function
+\code{prestonfit} and \code{prestondistr}. Function \code{prestonfit}
+uses traditionally binning approach, and is burdened with arbitrary
+choices of binning limits and treatment of ties. It seems that Preston
+split ties between adjacent octaves: only half of the species observed
+once were in the first octave, and half were transferred to the next
+octave, and the same for all species at the octave limits occurring 2,
+4, 8, 16\ldots times \citep{WilliamsonGaston05}. Function
\code{prestonfit} can either split the ties or keep all limit cases in
-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 10):
+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 7):
\begin{Schunk}
\begin{Sinput}
-R> prestondistr(BCI[k,])
+> prestondistr(BCI[k,])
\end{Sinput}
\begin{Soutput}
Preston lognormal model
Method: maximized likelihood to log2 abundances
-No. of species: 94
+No. of species: 82
- mode width S0
- 0.9941697 1.8317765 23.7539289
+ mode width S0
+ 1.184636 1.724112 21.142298
Frequencies by Octave
- 0 1 2 3 4 5 6
-Observed 17.50000 25.50000 19.50000 15.50000 8.50000 5.500000 2.0000000
-Fitted 20.50087 23.75381 20.42975 13.04252 6.18057 2.174024 0.5676345
+ 0 1 2 3 4
+Observed 14.0000 21.50000 16.00000 17.00000 6.500000
+Fitted 16.6969 21.02141 18.90544 12.14537 5.573573
+ 5 6
+Observed 6.000000 1.0000000
+Fitted 1.827072 0.4278351
\end{Soutput}
\end{Schunk}
@@ -427,11 +421,11 @@ Fitted 20.50087 23.75381 20.42975 13.04252 6.18057 2.174024 0.5676345
An alternative approach to species abundance distribution is to plot
logarithmic abundances in decreasing order, or against ranks of
-species. These are known as ranked abundance
+species \citep{Whittaker65}. These are known as ranked abundance
distribution curves, species abundance curves, dominance--diversity
-curves or Whittaker plots.
-Function \code{radfit} fits some of the most popular models using
-maximum likelihood estimation:
+curves or Whittaker plots. Function \code{radfit} fits some of the
+most popular models \citep{Bastow91} using maximum likelihood
+estimation:
\begin{align}
\hat a_r &= \frac{N}{S} \sum_{k=r}^S \frac{1}{k} &\text{brokenstick}\\
\hat a_r &= N \alpha (1-\alpha)^{r-1} & \text{preemption} \\
@@ -453,27 +447,33 @@ and the default Poisson error looks appropriate, and our example data
set gives (Fig. \ref{fig:rad}):
\begin{Schunk}
\begin{Sinput}
-R> rad <- radfit(BCI[k,])
-R> rad
+> rad <- radfit(BCI[k,])
+> rad
\end{Sinput}
\begin{Soutput}
RAD models, family poisson
-No. of species 94, total abundance 483
-
- par1 par2 par3 Deviance AIC BIC
-Null 77.2737 353.6126 353.6126
-Preemption 0.048132 62.7210 341.0598 343.6031
-Lognormal 0.97341 1.1723 20.4770 300.8158 305.9024
-Zipf 0.14073 -0.84897 39.7066 320.0454 325.1320
-Mandelbrot 1.9608 -1.522 6.7247 9.8353 292.1741 299.8040
+No. of species 82, total abundance 416
+
+ par1 par2 par3 Deviance
+Null 44.1321
+Preemption 0.050871 35.5813
+Lognormal 1.0473 1.0934 15.0446
+Zipf 0.1343 -0.81154 37.1297
+Mandelbrot 4.4331 -1.6963 9.5855 6.8295
+ AIC BIC
+Null 288.5829 288.5829
+Preemption 282.0320 284.4388
+Lognormal 263.4954 268.3088
+Zipf 285.5805 290.3940
+Mandelbrot 257.2803 264.5004
\end{Soutput}
\end{Schunk}
-\begin{SCfigure}
-\includegraphics{diversity-vegan-022}
+\begin{figure}
+\includegraphics{diversity-vegan-021}
\caption{Ranked abundance distribution models for a random plot
- (no. 10). The best model has the lowest \textsc{aic}.}
+ (no. 7). The best model has the lowest \textsc{aic}.}
\label{fig:rad}
-\end{SCfigure}
+\end{figure}
Function \code{radfit} compares the models using alternatively
Akaike's or Schwartz's Bayesian information criteria. These are based
@@ -504,23 +504,24 @@ several alternative methods, including accumulating sites in the order
they happen to be, and repeated accumulation in random order. In
addition, there are three analytic models. Rarefaction pools
individuals together, and applies rarefaction equation (\ref{eq:rare})
-to these individuals. Kindt's exact accumulator resembles rarefaction:
-\begin{equation}
+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
+\hat S_n = \sum_{i=1}^S (1 - p_i), \, \\ \text{where} \quad p_i = {N- f_i
\choose n} \Bigm / {N \choose n}
-\end{equation}
+\end{multline}
where $f_i$ is the frequency of species $i$. Approximate variance
estimator is:
-\begin{equation}
+\begin{multline}
\label{eq:kindtvar}
-s^2 = p_i (1 - p_i) + 2 \sum_{i=1}^S \sum_{j>i} \left( r_{ij}
+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)
-\end{equation}
+\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
-analytic method was suggested by Coleman:
+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}
@@ -533,30 +534,30 @@ species accumulation curve.
The recommended is Kindt's exact method (Fig. \ref{fig:sac}):
\begin{Schunk}
\begin{Sinput}
-R> sac <- specaccum(BCI)
-R> plot(sac, ci.type="polygon", ci.col="yellow")
+> sac <- specaccum(BCI)
+> plot(sac, ci.type="polygon", ci.col="yellow")
\end{Sinput}
\end{Schunk}
-\begin{SCfigure}
-\includegraphics{diversity-vegan-024}
+\begin{figure}
+\includegraphics{diversity-vegan-023}
\caption{Species accumulation curve for the BCI data; exact method.}
\label{fig:sac}
-\end{SCfigure}
+\end{figure}
\subsection{Beta diversity}
-Whittaker divided diversity into various components. The best known
-are diversity in one spot that he called alpha diversity, and the
-diversity along gradients that he called beta diversity. The basic
-diversity indices are indices of alpha diversity. Beta diversity
-should be studied with respect to gradients, but almost everybody
-understand that as a measure of general heterogeneity: how many more
-species do you have in a collection of sites compared to an average
-site.
+\citet{Whittaker60} divided diversity into various components. The
+best known are diversity in one spot that he called alpha diversity,
+and the diversity along gradients that he called beta diversity. The
+basic diversity indices are indices of alpha diversity. Beta diversity
+should be studied with respect to gradients \citep{Whittaker60}, but
+almost everybody understand that as a measure of general heterogeneity
+\citep{Tuomisto10a, Tuomisto10b}: how many more species do you have in
+a collection of sites compared to an average site.
The best known index of beta diversity is based on the ratio of total
-number of species in a collection of sites ($S$) and the average
-richness per one site ($\bar \alpha$):
+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
@@ -567,7 +568,7 @@ functions are needed, but this index can be easily found with the help
of \pkg{vegan} function \code{specnumber}:
\begin{Schunk}
\begin{Sinput}
-R> ncol(BCI)/mean(specnumber(BCI)) - 1
+> ncol(BCI)/mean(specnumber(BCI)) - 1
\end{Sinput}
\begin{Soutput}
[1] 1.478519
@@ -576,8 +577,8 @@ R> ncol(BCI)/mean(specnumber(BCI)) - 1
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. Whittaker noticed this, and suggested the index to be
-found from pairwise comparison of sites. If the number of shared
+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:
@@ -590,8 +591,8 @@ for all sites using \pkg{vegan} function \code{vegdist} with
binary data:
\begin{Schunk}
\begin{Sinput}
-R> beta <- vegdist(BCI, binary=TRUE)
-R> mean(beta)
+> beta <- vegdist(BCI, binary=TRUE)
+> mean(beta)
\end{Sinput}
\begin{Soutput}
[1] 0.3399075
@@ -600,11 +601,11 @@ R> 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
-\code{betadiver}. The indices in \code{betadiver} can be referred
-to by subscript name, or index number:
+\code{betadiver} \citep{KoleffEtal03}. The indices in \code{betadiver}
+can be referred to by subscript name, or index number:
\begin{Schunk}
\begin{Sinput}
-R> betadiver(help=TRUE)
+> betadiver(help=TRUE)
\end{Sinput}
\begin{Soutput}
1 "w" = (b+c)/(2*a+b+c)
@@ -612,8 +613,11 @@ R> betadiver(help=TRUE)
3 "c" = (b+c)/2
4 "wb" = b+c
5 "r" = 2*b*c/((a+b+c)^2-2*b*c)
-6 "I" = log(2*a+b+c)-2*a*log(2)/(2*a+b+c)-((a+b)*log(a+b)+(a+c)*log(a+c))/(2*a+b+c)
-7 "e" = exp(log(2*a+b+c)-2*a*log(2)/(2*a+b+c)-((a+b)*log(a+b)+(a+c)*log(a+c))/(2*a+b+c))-1
+6 "I" = log(2*a+b+c) - 2*a*log(2)/(2*a+b+c) -
+((a+b)*log(a+b) + (a+c)*log(a+c)) / (2*a+b+c)
+7 "e" = exp(log(2*a+b+c) - 2*a*log(2)/(2*a+b+c)
+- ((a+b)*log(a+b) + (a+c)*log(a+c)) /
+(2*a+b+c))-1
8 "t" = (b+c)/(2*a+b+c)
9 "me" = (b+c)/(2*a+b+c)
10 "j" = a/(a+b+c)
@@ -651,8 +655,8 @@ can find the value of $z$ for a pair of plots using function
\code{betadiver}:
\begin{Schunk}
\begin{Sinput}
-R> z <- betadiver(BCI, "z")
-R> quantile(z)
+> z <- betadiver(BCI, "z")
+> quantile(z)
\end{Sinput}
\begin{Soutput}
0% 25% 50% 75% 100%
@@ -663,17 +667,17 @@ The size $X$ and parameter $c$ cancel out, and the index gives the
estimate $z$ for any pair of sites.
Function \code{betadisper} can be used to analyse beta diversities
-with respect to classes or factors. 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}):
+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}):
\begin{Schunk}
\begin{Sinput}
-R> data(dune)
-R> data(dune.env)
-R> z <- betadiver(dune, "z")
-R> mod <- with(dune.env, betadisper(z, Management))
-R> mod
+> data(dune)
+> data(dune.env)
+> z <- betadiver(dune, "z")
+> mod <- with(dune.env, betadisper(z, Management))
+> mod
\end{Sinput}
\begin{Soutput}
Homogeneity of multivariate dispersions
@@ -683,26 +687,24 @@ Call: betadisper(d = z, group = Management)
No. of Positive Eigenvalues: 12
No. of Negative Eigenvalues: 7
-Average distance to centroid:
+Average distance to median:
BF HF NM SF
0.3080 0.2512 0.4406 0.3635
Eigenvalues for PCoA axes:
- PCoA1 PCoA2 PCoA3 PCoA4 PCoA5 PCoA6 PCoA7 PCoA8 PCoA9
- 1.6547 0.8870 0.5334 0.3744 0.2873 0.2245 0.1613 0.0810 0.0652
- PCoA10 PCoA11 PCoA12 PCoA13 PCoA14 PCoA15 PCoA16 PCoA17 PCoA18
- 0.0353 0.0183 0.0040 -0.0042 -0.0194 -0.0369 -0.0429 -0.0536 -0.0602
- PCoA19
--0.0828
+ PCoA1 PCoA2 PCoA3 PCoA4 PCoA5 PCoA6 PCoA7
+1.6547 0.8870 0.5334 0.3744 0.2873 0.2245 0.1613
+ PCoA8
+0.0810
\end{Soutput}
\end{Schunk}
-\begin{SCfigure}
-\includegraphics{diversity-vegan-030}
+\begin{figure}
+\includegraphics{diversity-vegan-029}
\caption{Box plots of beta diversity measured as the average steepness
($z$) of the species area curve in the Arrhenius model $S = cX^z$ in
Management classes of dune meadows.}
\label{fig:betadisper}
-\end{SCfigure}
+\end{figure}
\section{Species pool}
\subsection{Number of unseen species}
@@ -718,12 +720,12 @@ species is related to the number of rare species, or species seen only
once or twice.
Function \code{specpool} implements the following models to estimate
-the pool size $S_p$:
+the pool size $S_p$ \citep{SmithVanBelle84, Chao87}:
\begin{align}
S_p &= S_o + \frac{f_1^2}{2 f_2} & \text{Chao}\\
-S_p &= S_o + f_1 \frac{N-1}{N} & \text{1st order Jackknife}\\
-S_p & = S_o + f_1 \frac{2N-3}{N} + f_2 \frac{(N-2)^2}{N(N-1)} &
-\text{2nd order Jackknife}\\
+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
@@ -733,38 +735,35 @@ 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 estimators of Chao is:
+The variance the estimator of \citet{Chao87} is:
\begin{equation}
s^2 = f_2 \left(\frac{G^4}{4} + G^3 + \frac{G^2}{2} \right), \,
\text{where}\quad G = \frac{f_1}{f_2}
\end{equation}
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:
+plots \citep{SmithVanBelle84}:
\begin{equation}
s^2 = \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:
-\begin{equation}
-\begin{split}
-s^2 = \sum_{i=1}^{S_o} q_i (1-q_i) + 2 \sum \sum Z_p , \quad \text{where} \\
-Z_p = \dots
-\end{split}
-\end{equation}
+new variable $q_i = (1-p_i)^N$ for each species \citep{SmithVanBelle84}:
+\begin{multline}
+s^2 = \sum_{i=1}^{S_o} q_i (1-q_i) + 2 \sum \sum Z_p ,\\ \text{where}\; Z_p = \dots
+\end{multline}
The extrapolated richness values for the whole BCI data are:
\begin{Schunk}
\begin{Sinput}
-R> specpool(BCI)
+> specpool(BCI)
\end{Sinput}
\begin{Soutput}
- Species chao chao.se jack1 jack1.se jack2 boot
-All 225 236.6053 6.659395 245.58 5.650522 247.8722 235.6862
- boot.se n
-All 3.468888 50
+ Species chao chao.se jack1 jack1.se jack2
+All 225 236.6053 6.659395 245.58 5.650522 247.8722
+ boot boot.se n
+All 235.6862 3.468888 50
\end{Soutput}
\end{Schunk}
If the estimation of pool size really works, we should get the same
@@ -772,12 +771,14 @@ values of estimated richness if we take a random subset of a half of
the plots (but this is rarely true):
\begin{Schunk}
\begin{Sinput}
-R> s <- sample(nrow(BCI), 25)
-R> specpool(BCI[s,])
+> s <- sample(nrow(BCI), 25)
+> specpool(BCI[s,])
\end{Sinput}
\begin{Soutput}
- Species chao chao.se jack1 jack1.se jack2 boot boot.se n
-All 203 227 12.96148 226.04 8.022369 237.54 213.6789 4.123431 25
+ Species chao chao.se jack1 jack1.se jack2
+All 206 228.1538 11.90403 229.04 7.528506 239.6583
+ boot boot.se n
+All 216.8594 4.088276 25
\end{Soutput}
\end{Schunk}
@@ -791,15 +792,15 @@ species with low frequencies. Function \code{estimateR} implements
two of these methods:
\begin{Schunk}
\begin{Sinput}
-R> estimateR(BCI[k,])
+> estimateR(BCI[k,])
\end{Sinput}
\begin{Soutput}
- 10
-S.obs 94.000000
-S.chao1 129.000000
-se.chao1 17.243915
-S.ACE 132.601934
-se.ACE 6.153456
+ 7
+S.obs 82.000000
+S.chao1 105.625000
+se.chao1 13.008761
+S.ACE 108.315823
+se.ACE 4.913317
\end{Soutput}
\end{Schunk}
Chao's method is similar as above, but uses another, ``unbiased''
@@ -807,7 +808,7 @@ equation. \textsc{ace} is based on rare species also:
\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}\\
+\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}}
@@ -838,18 +839,18 @@ if raw site data are given. Log-normal model may fit poorly, but we
can try:
\begin{Schunk}
\begin{Sinput}
-R> veiledspec(prestondistr(BCI[k,]))
+> veiledspec(prestondistr(BCI[k,]))
\end{Sinput}
\begin{Soutput}
Extrapolated Observed Veiled
- 109.06813 94.00000 15.06813
+ 91.370848 82.000000 9.370848
\end{Soutput}
\begin{Sinput}
-R> veiledspec(BCI[k,])
+> veiledspec(BCI[k,])
\end{Sinput}
\begin{Soutput}
Extrapolated Observed Veiled
- 121.08212 94.00000 27.08212
+ 97.93917 82.00000 15.93917
\end{Soutput}
\end{Schunk}
@@ -862,10 +863,11 @@ missing species could occur in a site, or which sites are suitable for
a species. The probability for each species at each site is assessed
from other species occurring on the site.
-Function \code{beals} implement Beals smoothing:
+Function \code{beals} implement Beals smoothing \citep{McCune87,
+ DeCaceresLegendre08}:
\begin{Schunk}
\begin{Sinput}
-R> smo <- beals(BCI)
+> smo <- beals(BCI)
\end{Sinput}
\end{Schunk}
We may see how the estimated probability of occurrence and observed
@@ -874,14 +876,18 @@ only one species, and to avoid circular reasoning we do not include
the target species in the smoothing (Fig. \ref{fig:beals}):
\begin{Schunk}
\begin{Sinput}
-R> j <- which(colnames(BCI) == "Ceiba.pentandra")
-R> plot(beals(BCI, species=j, include=FALSE), BCI[,j], main="Ceiba pentandra", xlab="Probability of occurrence", ylab="Occurrence")
+> j <- which(colnames(BCI) == "Ceiba.pentandra")
+> plot(beals(BCI, species=j, include=FALSE), BCI[,j],
+ main="Ceiba pentandra", xlab="Probability of occurrence",
+ ylab="Occurrence")
\end{Sinput}
\end{Schunk}
-\begin{SCfigure}
-\includegraphics{diversity-vegan-037}
+\begin{figure}
+\includegraphics{diversity-vegan-036}
\caption{Beals smoothing for \emph{Ceiba pentandra}.}
\label{fig:beals}
-\end{SCfigure}
+\end{figure}
+
+\bibliography{vegan}
\end{document}
diff --git a/inst/doc/intro-vegan.Rnw b/vignettes/intro-vegan.Rnw
similarity index 93%
copy from inst/doc/intro-vegan.Rnw
copy to vignettes/intro-vegan.Rnw
index 8918fec..8a253ce 100644
--- a/inst/doc/intro-vegan.Rnw
+++ b/vignettes/intro-vegan.Rnw
@@ -1,58 +1,44 @@
% -*- mode: noweb; noweb-default-code-mode: R-mode; -*-
%\VignetteIndexEntry{Introduction to ordination in vegan}
-\documentclass[article,nojss]{jss}
-\usepackage{veganjss} % vegan settings
-\usepackage{ucs} %% needed for R output: signif stars etc, quotes
-\usepackage[utf8x]{inputenc}
-\usepackage[T1]{fontenc}
-\usepackage{sidecap}
-\usepackage{amsmath}
-
-\renewcommand{\floatpagefraction}{0.8}
-
+\documentclass[a4paper,10pt]{article}
+\usepackage{vegan} % vegan settings
\title{Vegan: an introduction to ordination}
-
\author{Jari Oksanen}
-\Abstract{The document describes typical, simple work pathways of
- vegetation ordination. Unconstrained ordination uses as examples
- detrended correspondence analysis and non-metric multidimensional
- scaling, and shows how to interpret their results by fitting
- environmental vectors and factors or smooth environmental surfaces
- to the graph. The basic plotting command, and more advanced plotting
- commands for congested plots are also discussed, as well as adding
- items such as ellipses, convex hulls, and other items for
- classes. The constrained ordination uses constrained (canonical)
- correspondence analysis as an example. It is first shown how a model
- is defined, then the document discusses model building and
- signficance tests of the whole analysis, single constraints and
- axes.}
-
-\Keywords{ordination, correspondence analysis, non-metric
- multidimensional scaling, CCA, RDA, NMDS, fitted environmental
- vector, fitted environmental surface, permutation tests}
-
-%% misuse of the address field for revision data
-\Address{$ $Id: intro-vegan.Rnw 2346 2013-01-07 11:42:36Z jarioksa $ $
+\date{\footnotesize{$ $Id: intro-vegan.Rnw 2597 2013-08-28 08:56:55Z jarioksa $ $
processed with vegan
\Sexpr{packageDescription("vegan", field="Version")}
-in \Sexpr{R.version.string} on \today}
-\Footername{About this version}
+in \Sexpr{R.version.string} on \today}}
%% need no \usepackage{Sweave}
\begin{document}
-\setkeys{Gin}{width=0.55\linewidth}
\SweaveOpts{strip.white=true}
<<echo=false>>=
par(mfrow=c(1,1))
options(width=72)
figset <- function() par(mar=c(4,4,1,1)+.1)
options(SweaveHooks = list(fig = figset))
-options("prompt" = "R> ", "continue" = "+ ")
+options("prompt" = "> ", "continue" = " ")
@
+\maketitle
+\begin{abstract}
+ The document describes typical, simple work pathways of
+ vegetation ordination. Unconstrained ordination uses as examples
+ detrended correspondence analysis and non-metric multidimensional
+ scaling, and shows how to interpret their results by fitting
+ environmental vectors and factors or smooth environmental surfaces
+ to the graph. The basic plotting command, and more advanced plotting
+ commands for congested plots are also discussed, as well as adding
+ items such as ellipses, convex hulls, and other items for
+ classes. The constrained ordination uses constrained (canonical)
+ correspondence analysis as an example. It is first shown how a model
+ is defined, then the document discusses model building and
+ signficance tests of the whole analysis, single constraints and
+ axes.
+\end{abstract}
\tableofcontents
\vspace{3ex}
@@ -128,13 +114,13 @@ All ordination results of \pkg{vegan} can be displayed with a
<<a>>=
plot(ord)
@
-\begin{SCfigure}
+\begin{figure}
<<fig=true,echo=false>>=
<<a>>
@
\caption{Default ordination plot.}
\label{fig:plot}
-\end{SCfigure}
+\end{figure}
Default \code{plot} command uses either black circles for sites and
red pluses for species, or black and red text for sites and species,
resp. The choices depend on the number of items in the plot and
@@ -150,14 +136,14 @@ plot(ord, type = "n")
points(ord, display = "sites", cex = 0.8, pch=21, col="red", bg="yellow")
text(ord, display = "spec", cex=0.7, col="blue")
@
-\begin{SCfigure}
+\begin{figure}
<<fig=true,echo=false>>=
<<a>>
@
\caption{A more colourful ordination plot where sites are points, and
species are text.}
\label{fig:plot.args}
-\end{SCfigure}
+\end{figure}
All \pkg{vegan} ordination methods have a specific \code{plot}
function. In addition, \pkg{vegan} has an alternative plotting
@@ -227,14 +213,14 @@ ordiellipse(ord, Management, col=3,lwd=2)
ordispider(ord, Management, col="red", label = TRUE)
points(ord, disp="sites", pch=21, col="red", bg="yellow", cex=1.3)
@
-\begin{SCfigure}
+\begin{figure}
<<fig=true,echo=false>>=
<<a>>
@
\caption{Convex hull, standard error ellipse and a spider web diagram
for Management levels in ordination.}
\label{fig:ordihull}
-\end{SCfigure}
+\end{figure}
In addition, you can overlay a cluster dendrogram from \code{hclust}
using \code{ordicluster} or a minimum spanning tree from
\code{spantree} with its \code{lines} function. Segmented arrows
@@ -276,7 +262,7 @@ ordination, but it returns the result of the fitted thinplate spline
<<b,fig=false>>=
ordisurf(ord, A1, add=TRUE)
@
-\begin{SCfigure}
+\begin{figure}
<<fig=true,echo=false,results=hide>>=
<<a>>
<<b>>
@@ -284,7 +270,7 @@ ordisurf(ord, A1, add=TRUE)
\caption{Fitted vector and smooth surface for the thickness of A1
horizon (\code{A1}, in cm), and centroids of Management levels.}
\label{fig:envfit}
-\end{SCfigure}
+\end{figure}
\section{Constrained ordination}
@@ -307,13 +293,13 @@ The results can be plotted with (Fig. \ref{fig:cca}):
<<a>>=
plot(ord)
@
-\begin{SCfigure}
+\begin{figure}
<<fig=true,echo=false>>=
<<a>>
@
\caption{Default plot from constrained correspondence analysis.}
\label{fig:cca}
-\end{SCfigure}
+\end{figure}
There are three groups of items: sites, species and centroids (and
biplot arrows) of environmental variables. All these can be added
individually to an empty plot, and all previously explained tricks of
diff --git a/inst/doc/intro-vegan.tex b/vignettes/intro-vegan.tex
similarity index 86%
rename from inst/doc/intro-vegan.tex
rename to vignettes/intro-vegan.tex
index c3e7624..a28cc3a 100644
--- a/inst/doc/intro-vegan.tex
+++ b/vignettes/intro-vegan.tex
@@ -1,21 +1,24 @@
% -*- mode: noweb; noweb-default-code-mode: R-mode; -*-
%\VignetteIndexEntry{Introduction to ordination in vegan}
-\documentclass[article,nojss]{jss}
-\usepackage{veganjss} % vegan settings
-\usepackage{ucs} %% needed for R output: signif stars etc, quotes
-\usepackage[utf8x]{inputenc}
-\usepackage[T1]{fontenc}
-\usepackage{sidecap}
-\usepackage{amsmath}
+\documentclass[a4paper,10pt]{article}
+\usepackage{vegan} % vegan settings
-\renewcommand{\floatpagefraction}{0.8}
+\title{Vegan: an introduction to ordination}
+\author{Jari Oksanen}
+\date{\footnotesize{$ $Id: intro-vegan.Rnw 2597 2013-08-28 08:56:55Z jarioksa $ $
+ processed with vegan
+2.0-9
+in R Under development (unstable) (2013-09-25 r63985) on \today}}
-\title{Vegan: an introduction to ordination}
+%% need no \usepackage{Sweave}
+\begin{document}
-\author{Jari Oksanen}
-\Abstract{The document describes typical, simple work pathways of
+
+\maketitle
+\begin{abstract}
+ The document describes typical, simple work pathways of
vegetation ordination. Unconstrained ordination uses as examples
detrended correspondence analysis and non-metric multidimensional
scaling, and shows how to interpret their results by fitting
@@ -27,25 +30,8 @@
correspondence analysis as an example. It is first shown how a model
is defined, then the document discusses model building and
signficance tests of the whole analysis, single constraints and
- axes.}
-
-\Keywords{ordination, correspondence analysis, non-metric
- multidimensional scaling, CCA, RDA, NMDS, fitted environmental
- vector, fitted environmental surface, permutation tests}
-
-%% misuse of the address field for revision data
-\Address{$ $Id: intro-vegan.Rnw 2346 2013-01-07 11:42:36Z jarioksa $ $
- processed with vegan
-2.0-7
-in R Under development (unstable) (2013-03-19 r62316) on \today}
-\Footername{About this version}
-
-%% need no \usepackage{Sweave}
-\begin{document}
-
-\setkeys{Gin}{width=0.55\linewidth}
-
-
+ axes.
+\end{abstract}
\tableofcontents
\vspace{3ex}
@@ -77,15 +63,15 @@ functions \code{decorana} and \code{metaMDS}.
Detrended correspondence analysis (\textsc{dca}) is done like this:
\begin{Schunk}
\begin{Sinput}
-R> library(vegan)
-R> data(dune)
-R> ord <- decorana(dune)
+> library(vegan)
+> data(dune)
+> ord <- decorana(dune)
\end{Sinput}
\end{Schunk}
This saves ordination results in \code{ord}:
\begin{Schunk}
\begin{Sinput}
-R> ord
+> ord
\end{Sinput}
\begin{Soutput}
Call:
@@ -123,21 +109,16 @@ species scores to the configuration as weighted averages (function
\code{wascores}):
\begin{Schunk}
\begin{Sinput}
-R> ord <- metaMDS(dune)
+> ord <- metaMDS(dune)
\end{Sinput}
\begin{Soutput}
Run 0 stress 0.1192678
-Run 1 stress 0.1183192
-... New best solution
-... procrustes: rmse 0.02026651 max resid 0.06495143
-Run 2 stress 0.2341212
-Run 3 stress 0.1183186
-... New best solution
-... procrustes: rmse 0.0001039632 max resid 0.0003313083
+Run 1 stress 0.1192683
+... procrustes: rmse 0.0003967661 max resid 0.001215737
*** Solution reached
\end{Soutput}
\begin{Sinput}
-R> ord
+> ord
\end{Sinput}
\begin{Soutput}
Call:
@@ -149,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 3 tries
+Two convergent solutions found after 1 tries
Scaling: centring, PC rotation, halfchange scaling
Species: expanded scores based on ‘dune’
\end{Soutput}
@@ -167,14 +148,14 @@ All ordination results of \pkg{vegan} can be displayed with a
\code{plot} command (Fig. \ref{fig:plot}):
\begin{Schunk}
\begin{Sinput}
-R> plot(ord)
+> plot(ord)
\end{Sinput}
\end{Schunk}
-\begin{SCfigure}
+\begin{figure}
\includegraphics{intro-vegan-006}
\caption{Default ordination plot.}
\label{fig:plot}
-\end{SCfigure}
+\end{figure}
Default \code{plot} command uses either black circles for sites and
red pluses for species, or black and red text for sites and species,
resp. The choices depend on the number of items in the plot and
@@ -187,17 +168,17 @@ combine points and text, and you can select colours and character
sizes freely (Fig. \ref{fig:plot.args}):
\begin{Schunk}
\begin{Sinput}
-R> plot(ord, type = "n")
-R> points(ord, display = "sites", cex = 0.8, pch=21, col="red", bg="yellow")
-R> text(ord, display = "spec", cex=0.7, col="blue")
+> plot(ord, type = "n")
+> points(ord, display = "sites", cex = 0.8, pch=21, col="red", bg="yellow")
+> text(ord, display = "spec", cex=0.7, col="blue")
\end{Sinput}
\end{Schunk}
-\begin{SCfigure}
+\begin{figure}
\includegraphics{intro-vegan-008}
\caption{A more colourful ordination plot where sites are points, and
species are text.}
\label{fig:plot.args}
-\end{SCfigure}
+\end{figure}
All \pkg{vegan} ordination methods have a specific \code{plot}
function. In addition, \pkg{vegan} has an alternative plotting
@@ -258,25 +239,25 @@ areas, and \code{ordispider} combines items to their centroid
(Fig. \ref{fig:ordihull}):
\begin{Schunk}
\begin{Sinput}
-R> data(dune.env)
-R> attach(dune.env)
+> data(dune.env)
+> attach(dune.env)
\end{Sinput}
\end{Schunk}
\begin{Schunk}
\begin{Sinput}
-R> plot(ord, disp="sites", type="n")
-R> ordihull(ord, Management, col="blue")
-R> ordiellipse(ord, Management, col=3,lwd=2)
-R> ordispider(ord, Management, col="red", label = TRUE)
-R> points(ord, disp="sites", pch=21, col="red", bg="yellow", cex=1.3)
+> plot(ord, disp="sites", type="n")
+> ordihull(ord, Management, col="blue")
+> ordiellipse(ord, Management, col=3,lwd=2)
+> ordispider(ord, Management, col="red", label = TRUE)
+> points(ord, disp="sites", pch=21, col="red", bg="yellow", cex=1.3)
\end{Sinput}
\end{Schunk}
-\begin{SCfigure}
+\begin{figure}
\includegraphics{intro-vegan-011}
\caption{Convex hull, standard error ellipse and a spider web diagram
for Management levels in ordination.}
\label{fig:ordihull}
-\end{SCfigure}
+\end{figure}
In addition, you can overlay a cluster dendrogram from \code{hclust}
using \code{ordicluster} or a minimum spanning tree from
\code{spantree} with its \code{lines} function. Segmented arrows
@@ -303,14 +284,14 @@ interface, and it optionally can assess the ``significance'' of the
variables using permutation tests:
\begin{Schunk}
\begin{Sinput}
-R> ord.fit <- envfit(ord ~ A1 + Management, data=dune.env, perm=1000)
-R> ord.fit
+> ord.fit <- envfit(ord ~ A1 + Management, data=dune.env, perm=1000)
+> ord.fit
\end{Sinput}
\begin{Soutput}
***VECTORS
NMDS1 NMDS2 r2 Pr(>r)
-A1 0.96474 0.26320 0.3649 0.01898 *
+A1 0.99008 0.14052 0.3798 0.02697 *
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
P values based on 1000 permutations.
@@ -319,14 +300,14 @@ P values based on 1000 permutations.
Centroids:
NMDS1 NMDS2
-ManagementBF -0.4534 -0.0102
-ManagementHF -0.2636 -0.1282
-ManagementNM 0.2958 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.00999 **
+ r2 Pr(>r)
+Management 0.4134 0.004995 **
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
P values based on 1000 permutations.
@@ -336,8 +317,8 @@ The result can be drawn directly or added to an ordination diagram
(Fig. \ref{fig:envfit}):
\begin{Schunk}
\begin{Sinput}
-R> plot(ord, dis="site")
-R> plot(ord.fit)
+> plot(ord, dis="site")
+> plot(ord.fit)
\end{Sinput}
\end{Schunk}
@@ -346,28 +327,28 @@ ordination, but it returns the result of the fitted thinplate spline
\code{gam} (Fig. \ref{fig:envfit}):
\begin{Schunk}
\begin{Sinput}
-R> ordisurf(ord, A1, add=TRUE)
+> ordisurf(ord, A1, add=TRUE)
\end{Sinput}
\begin{Soutput}
Family: gaussian
Link function: identity
Formula:
-y ~ s(x1, x2, k = knots)
-<environment: 0x41bc858>
+y ~ s(x1, x2, k = 10, bs = "tp", fx = FALSE)
+<environment: 0x36047f0>
Estimated degrees of freedom:
-2 total = 3
+1.62 total = 2.62
-GCV score: 3.965441
+REML score: 41.42642
\end{Soutput}
\end{Schunk}
-\begin{SCfigure}
+\begin{figure}
\includegraphics{intro-vegan-015}
\caption{Fitted vector and smooth surface for the thickness of A1
horizon (\code{A1}, in cm), and centroids of Management levels.}
\label{fig:envfit}
-\end{SCfigure}
+\end{figure}
\section{Constrained ordination}
@@ -384,8 +365,8 @@ hand side gives the community data frame and the right hand side lists
the constraining variables:
\begin{Schunk}
\begin{Sinput}
-R> ord <- cca(dune ~ A1 + Management, data=dune.env)
-R> ord
+> ord <- cca(dune ~ A1 + Management, data=dune.env)
+> ord
\end{Sinput}
\begin{Soutput}
Call: cca(formula = dune ~ A1 + Management, data = dune.env)
@@ -410,14 +391,14 @@ Eigenvalues for unconstrained axes:
The results can be plotted with (Fig. \ref{fig:cca}):
\begin{Schunk}
\begin{Sinput}
-R> plot(ord)
+> plot(ord)
\end{Sinput}
\end{Schunk}
-\begin{SCfigure}
+\begin{figure}
\includegraphics{intro-vegan-018}
\caption{Default plot from constrained correspondence analysis.}
\label{fig:cca}
-\end{SCfigure}
+\end{figure}
There are three groups of items: sites, species and centroids (and
biplot arrows) of environmental variables. All these can be added
individually to an empty plot, and all previously explained tricks of
@@ -432,7 +413,7 @@ However, if you really want to do so, it is possible with the
following shortcut in \code{formula}:
\begin{Schunk}
\begin{Sinput}
-R> cca(dune ~ ., data=dune.env)
+> cca(dune ~ ., data=dune.env)
\end{Sinput}
\begin{Soutput}
Call: cca(formula = dune ~ A1 + Moisture + Management + Use +
@@ -465,7 +446,7 @@ constraints. The test mimics standard analysis of variance function
simultaneously:
\begin{Schunk}
\begin{Sinput}
-R> anova(ord)
+> anova(ord)
\end{Sinput}
\begin{Soutput}
Permutation test for cca under reduced model
@@ -492,7 +473,7 @@ will continue long in uncertain cases. You must set \code{step} and
It is also possible to analyse terms separately:
\begin{Schunk}
\begin{Sinput}
-R> anova(ord, by="term", permu=200)
+> anova(ord, by="term", permu=200)
\end{Sinput}
\begin{Soutput}
Permutation test for cca under reduced model
@@ -500,8 +481,8 @@ Terms added sequentially (first to last)
Model: cca(formula = dune ~ A1 + Management, data = dune.env)
Df Chisq F N.Perm Pr(>F)
-A1 1 0.2248 2.5245 199 0.005 **
-Management 3 0.5550 2.0780 199 0.005 **
+A1 1 0.2248 2.5245 199 0.01 **
+Management 3 0.5550 2.0780 199 0.01 **
Residual 15 1.3355
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
@@ -513,7 +494,7 @@ in the order they happen to be in the model. You can also analyse
significances of marginal effects (``Type III effects''):
\begin{Schunk}
\begin{Sinput}
-R> anova(ord, by="mar")
+> anova(ord, by="mar")
\end{Sinput}
\begin{Soutput}
Permutation test for cca under reduced model
@@ -521,7 +502,7 @@ Marginal effects of terms
Model: cca(formula = dune ~ A1 + Management, data = dune.env)
Df Chisq F N.Perm Pr(>F)
-A1 1 0.1759 1.9761 1399 0.03429 *
+A1 1 0.1759 1.9761 899 0.03222 *
Management 3 0.5550 2.0780 199 0.00500 **
Residual 15 1.3355
---
@@ -532,15 +513,15 @@ Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’
Moreover, it is possible to analyse significance of each axis:
\begin{Schunk}
\begin{Sinput}
-R> anova(ord, by="axis", perm=500)
+> anova(ord, by="axis", perm=500)
\end{Sinput}
\begin{Soutput}
Model: cca(formula = dune ~ A1 + Management, data = dune.env)
Df Chisq F N.Perm Pr(>F)
CCA1 1 0.3187 3.5801 199 0.005 **
CCA2 1 0.2372 2.6640 199 0.010 **
-CCA3 1 0.1322 1.4845 99 0.210
-CCA4 1 0.0917 1.0297 99 0.370
+CCA3 1 0.1322 1.4845 299 0.110
+CCA4 1 0.0917 1.0297 99 0.390
Residual 15 1.3355
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
@@ -558,8 +539,8 @@ All constrained ordination methods can have terms that are partialled
out from the analysis before constraints:
\begin{Schunk}
\begin{Sinput}
-R> ord <- cca(dune ~ A1 + Management + Condition(Moisture), data=dune.env)
-R> ord
+> ord <- cca(dune ~ A1 + Management + Condition(Moisture), data=dune.env)
+> ord
\end{Sinput}
\begin{Soutput}
Call: cca(formula = dune ~ A1 + Management +
@@ -588,7 +569,7 @@ effects of \code{A1} and \code{Management}. This also influences
the significances of the terms:
\begin{Schunk}
\begin{Sinput}
-R> anova(ord, by="term", perm=500)
+> anova(ord, by="term", perm=500)
\end{Sinput}
\begin{Soutput}
Permutation test for cca under reduced model
@@ -596,7 +577,7 @@ Terms added sequentially (first to last)
Model: cca(formula = dune ~ A1 + Management + Condition(Moisture), data = dune.env)
Df Chisq F N.Perm Pr(>F)
-A1 1 0.1154 1.4190 99 0.09 .
+A1 1 0.1154 1.4190 99 0.08 .
Management 3 0.3954 1.6205 99 0.02 *
Residual 12 0.9761
---
@@ -608,7 +589,7 @@ permutations so that the observations only are permuted within levels
of \code{strata}:
\begin{Schunk}
\begin{Sinput}
-R> anova(ord, by="term", perm=500, strata=Moisture)
+> anova(ord, by="term", perm=500, strata=Moisture)
\end{Sinput}
\begin{Soutput}
Permutation test for cca under reduced model
@@ -617,7 +598,7 @@ Permutations stratified within 'Moisture'
Model: cca(formula = dune ~ A1 + Management + Condition(Moisture), data = dune.env)
Df Chisq F N.Perm Pr(>F)
-A1 1 0.1154 1.4190 99 0.38
+A1 1 0.1154 1.4190 99 0.23
Management 3 0.3954 1.6205 99 0.01 **
Residual 12 0.9761
---
diff --git a/vignettes/vegan.bib b/vignettes/vegan.bib
new file mode 100644
index 0000000..64065dd
--- /dev/null
+++ b/vignettes/vegan.bib
@@ -0,0 +1,356 @@
+
+
+ at Article{DeCaceresLegendre08,
+ author = {M. {D}e~{C}{\'a}ceres and P. Legendre},
+ title = {Beals smoothing revisited},
+ journal = {Oecologia},
+ year = 2008,
+ volume = 156,
+ pages = {657--669}
+}
+
+ at Article{McCune87,
+ author = {B. Mc{C}une},
+ title = {Improving community ordination with the {B}eals
+ smoothing function},
+ journal = {Ecoscience},
+ year = 1987,
+ volume = 1,
+ pages = {82--86}
+}
+
+ at Article{Chao87,
+ author = {A. Chao},
+ title = {Estimating the population size for capture-recapture
+ data with unequal catchability},
+ journal = {Biometrics},
+ year = 1987,
+ volume = 43,
+ pages = {783--791}
+}
+
+ at Article{SmithVanBelle84,
+ author = {E. P. Smith and G. {van Belle}},
+ title = {Nonparametric estimation of species richness},
+ journal = {Biometrics},
+ year = 1984,
+ volume = 40,
+ pages = {119--129}
+}
+
+ at Article{AndersonEtal06,
+ author = {M. J. Anderson and K. E. Ellingsen and
+ B. H. Mc{A}rdle},
+ title = {Multivariate dispersion as a measure of beta
+ diversity},
+ journal = {Ecology Letters},
+ year = 2006,
+ volume = 9,
+ pages = {683--693}
+}
+
+ at Article{Anderson06,
+ author = {M. J. Anderson},
+ title = {Distance-based tests for homogeneity of multivariate
+ dispersions},
+ journal = {Biometrics},
+ year = 2006,
+ volume = 62,
+ pages = {245--253}
+}
+
+ at Article{KoleffEtal03,
+ author = {P. Koleff and K. J. Gaston and J. J. Lennon},
+ title = {Measuring beta diversity for presence-absence data},
+ journal = {Journal of Animal Ecology},
+ year = 2003,
+ volume = 72,
+ pages = {367--382}
+}
+
+ at Article{Tuomisto10b,
+ author = {H. Tuomisto},
+ title = {A diversity of beta diversities: straightening up a
+ concept gone awry. 2. Quantifying beta diversity and
+ related phenomena},
+ journal = {Ecography},
+ year = 2010,
+ volume = 33,
+ pages = {23--45}
+}
+
+ at Article{Tuomisto10a,
+ author = {H. Tuomisto},
+ title = {A diversity of beta diversities: straightening up a
+ concept gone awry. 1. Defining beta diversity as a
+ function of alpha and gamma diversity},
+ journal = {Ecography},
+ year = 2010,
+ volume = 33,
+ pages = {2--22}
+}
+
+ at Article{Whittaker60,
+ author = {R. H. Whittaker},
+ title = {Vegetation of {S}iskiyou mountains, {O}regon and
+ {C}alifornia},
+ journal = {Ecological Monographs},
+ year = 1960,
+ volume = 30,
+ pages = {279--338}
+}
+
+ at Article{Coleman82,
+ author = {B. D. Coleman and M. A. Mares and M. R. Willis and Y. Hsieh},
+ title = {Randomness, area and species richness},
+ journal = {Ecology},
+ year = 1982,
+ volume = 63,
+ pages = {1121--1133}}
+
+ at Article{UglandEtal03,
+ author = {K. I. Ugland and J. S. Gray and K. E. Ellingsen},
+ title = {The species-accumulation curve and estimation of
+ species richness},
+ journal = {Journal of Animal Ecology},
+ year = 2003,
+ volume = 72,
+ pages = {888--897}
+}
+
+ at Article{Bastow91,
+ author = {J. Bastow Wilson},
+ title = {Methods of fitting dominance/diversity curves},
+ journal = {Journal of Vegetation Science},
+ year = 1991,
+ volume = 2,
+ pages = {35--46}
+}
+
+ at Article{Whittaker65,
+ author = {R. H. Whittaker},
+ title = {Dominance and diversity in plant communities},
+ journal = {Science},
+ year = 1965,
+ volume = 147,
+ pages = {250--260}}
+
+ at Article{WilliamsonGaston05,
+ author = {M. Williamson and K. J. Gaston},
+ title = {The lognormal distribution is not an appropriate
+ null hypothesis for the species-abundance
+ distribution},
+ journal = {Journal of Animal Ecology},
+ year = 2005,
+ volume = 74,
+ pages = {409--422}
+}
+
+ at Article{Preston48,
+ author = {F. W. Preston},
+ title = {The commonness and rarity of species},
+ journal = {Ecology},
+ year = 1948,
+ volume = 29,
+ pages = {254--283}
+}
+
+ at Article{PetcheyGaston06,
+ author = {O. L. Petchey and K. J. Gaston},
+ title = {Functional diversity: back to basics and looking forward},
+ journal = {Ecology Letters},
+ year = 2006,
+ volume = 9,
+ pages = {741--758}
+}
+
+ at Article{PetcheyGaston02,
+ author = {O. L. Petchey and K. J. Gaston},
+ title = {Functional diversity ({FD}), species richness and
+ community composition},
+ journal = {Ecology Letters},
+ year = 2002,
+ volume = 5,
+ pages = {402--411}
+}
+
+ at Article{ClarkeWarwick99,
+ author = {K. R. Clarke and R. M Warwick},
+ title = {The taxonomic distinctness measure of biodiversity:
+ weighting of step lengths between hierarchical
+ levels},
+ journal = {Marine Ecology Progress Series},
+ year = 1999,
+ volume = 184,
+ pages = {21--29}
+}
+
+ at Article{ClarkeWarwick01,
+ author = {K. R. Clarke and R. M Warwick},
+ title = {A further biodiversity index applicable to species
+ lists: variation in taxonomic distinctness},
+ journal = {Marine Ecology Progress Series},
+ year = 2001,
+ volume = 216,
+ pages = {265--278}
+}
+
+ at Article{ClarkeWarwick98,
+ author = {K. R. Clarke and R. M Warwick},
+ title = {A taxonomic distinctness index and its statistical
+ properties},
+ journal = {Journal of Applied Ecology},
+ year = 1998,
+ volume = 35,
+ pages = {523--531}
+}
+
+ at Article{HeckEtal75,
+ author = {K. L. Heck and G. {van~Belle} and D. Simberloff},
+ title = {Explicit calculation of the rarefaction diversity
+ measurement and the determination of sufficient
+ sample size},
+ journal = {Ecology},
+ year = 1975,
+ volume = 56,
+ pages = {1459--1461}
+}
+
+ at Article{Hurlbert71,
+ author = {S. H. Hurlbert},
+ title = {The nonconcept of species diversity: a critique and
+ alternative parameters},
+ journal = {Ecology},
+ year = 1971,
+ volume = 52,
+ pages = {577--586}
+}
+
+ at Article{FisherEtal43,
+ author = {R. A. Fisher and A. S. Corbet and C. B. Williams},
+ title = {The relation between the number of species and the
+ number of individuals in a random sample of animal
+ population},
+ journal = {Journal of Animal Ecology},
+ year = 1943,
+ volume = 12,
+ pages = {42--58}
+}
+
+ at Article{Tothmeresz95,
+ author = {B. Tothmeresz},
+ title = {Comparison of different methods for diversity ordering},
+ journal = {Journal of Vegetation Science},
+ year = 1995,
+ volume = 6,
+ pages = {283--290}}
+
+ at Article{Hill73number,
+ author = {M. O. Hill},
+ title = {Diversity and evenness: a unifying notation and its
+ consequences},
+ journal = {Ecology},
+ year = 1973,
+ volume = 54,
+ pages = {427--473}
+}
+
+ at Book{Sedgewick90,
+ author = {R. Sedgewick},
+ title = {Algorithms in {C}},
+ publisher = {Addison Wesley},
+ year = 1990}
+
+ at Article{MiklosPod04,
+ author = {I. Mikl{\'o}s and J. Podani},
+ title = {Randomization of presence--absence matrices:
+ comments and new algorithms},
+ journal = {Ecology},
+ year = 2004,
+ volume = 85,
+ pages = {86-92}}
+
+ at Article{GotelliEnt01,
+ author = {N. J. Gotelli and G. L. Entsminger},
+ title = {Swap and fill algorithms in null model analysis:
+ rethinking the knight's tour},
+ journal = {Oecologia},
+ year = 2001,
+ volume = 129,
+ pages = {281-291}}
+
+ at Article{AtmarPat93,
+ author = {W. Atmar and B. D. Patterson},
+ title = {The measure of order and disorder in the
+ distribution of species in fragmented habitat},
+ journal = {Oecologia},
+ year = 1993,
+ volume = 96,
+ pages = {373-382}
+}
+
+ at Article{RodGir06,
+ author = {M. A. Rodr{\'i}guez-Giron{\'e}s and L. Santamaria},
+ title = {A new algorithm to calculate the nestedness
+ temperature of presence--absence matrices},
+ journal = {Journal of Biogeography},
+ year = 2006,
+ volume = 33,
+ pages = {921-935}}
+
+ at article{Palmer93,
+ author = {M. W. Palmer},
+ title = {Putting things in even better order: The advantages
+ of canonical correspondence analysis},
+ journal = {Ecology},
+ volume = {74},
+ pages = {2215-2230},
+ year = {1993}
+}
+ at article{McCune97,
+ author = {B. McCune},
+ title = {Influence of noisy environmental data on canonical
+ correspondence analysis},
+ journal = {Ecology},
+ volume = {78},
+ pages = {2617-2623},
+ year = {1997}
+}
+ at article{Braak86,
+ author = {C. J. F. ter Braak},
+ title = {Canonical correspondence analysis: a new eigenvector
+ technique for multivariate direct gradient analysis},
+ journal = {Ecology},
+ volume = {67},
+ pages = {1167-1179},
+ year = {1986}
+}
+ at Book{Legendre-Legendre98,
+ author = {P. Legendre and L. Legendre},
+ title = {Numerical ecology},
+ publisher = {Elsevier},
+ year = 1998,
+ number = 20,
+ series = {Developments in Environmental Modelling},
+ address = {Amsterdam},
+ edition = {2nd}
+}
+ at book{Jongman87,
+ author = {R. H. Jongman and C. J. F. ter Braak and
+ O. F. R. van Tongeren},
+ title = {Data analysis in community and landscape ecology},
+ pages = {299},
+ publisher = {Pudoc},
+ address = {Wageningen},
+ year = {1987}
+}
+ at Manual{CANOCO4,
+ title = {CANOCO reference manual and user's guide to Canoco
+ for Windows: Software for canonical community
+ ordination (version 4)},
+ author = {C. J. F ter Braak and P. {\v S}milauer},
+ organization = {Microcomputer Power},
+ address = {Ithaca, NY},
+ year = 1998
+}
+
diff --git a/vignettes/vegan.sty b/vignettes/vegan.sty
new file mode 100644
index 0000000..2a321a4
--- /dev/null
+++ b/vignettes/vegan.sty
@@ -0,0 +1,47 @@
+%% typeset vegan vignettes. Should work with article style in one and
+%% two columns, and with amsart style with one column (two columns are
+%% too narrow in amsart, but basically works). In one column, sets
+%% sidecaption figures, and in two columns normal column-wide figures
+%% and smaller example font. R output width (options(width=)) probably
+%% needs correct setting in the Rnw file, and some formatting may need
+%% adjustment.
+\usepackage{amsmath}
+\usepackage{amssymb}
+\usepackage{ucs}
+\usepackage[utf8x]{inputenc}
+\usepackage[T1]{fontenc}
+\usepackage{sidecap}
+\@ifclassloaded{amsart}%
+{\setlength{\captionindent}{0pt}} % sidecap needs this with amsart
+{}
+\usepackage[english]{babel} % kluge to avoid visible ~ in Figure~1.
+\renewcommand{\floatpagefraction}{0.8}
+\usepackage{booktabs}
+\usepackage{Sweave}
+\usepackage{hyperref}
+\usepackage[round]{natbib}
+\renewcommand{\cite}{\citep}
+%% layout depends on the number of columns
+\if at twocolumn
+ \renewenvironment{Schunk}{\par\footnotesize}{} % smaller examples
+ \setkeys{Gin}{width=\linewidth} % column wide figs
+\else
+ \renewenvironment{Schunk}{\par\small}{} % small examples
+ \setkeys{Gin}{width=0.55\linewidth} % narrow figs for sidecaps
+ \renewenvironment{figure}[1][tp]{\begin{SCfigure}[][#1]}{\end{SCfigure}} %sidecaps
+\fi
+%% macros
+%% \code should handle _ , ~ and $
+\makeatletter
+\newcommand\code{\bgroup\@makeother\_\@makeother\~\@makeother\$\@codex}
+\def\@codex#1{{\normalfont\ttfamily\hyphenchar\font=-1 #1}\egroup}
+\makeatother
+%% simple macros
+\newcommand{\pkg}[1]{\textbf{#1}}
+\newcommand{\proglang}[1]{\textsf{#1}}
+\newcommand{\R}{\proglang{R}}
+\newcommand{\E}{\mathsf{E}}
+\newcommand{\VAR}{\mathsf{VAR}}
+\newcommand{\COV}{\mathsf{COV}}
+\newcommand{\Prob}{\mathsf{P}}
+
--
Alioth's /git/debian-med/git-commit-notice on /srv/git.debian.org/git/debian-med/r-cran-vegan.git
More information about the debian-med-commit
mailing list