Skip to content

Commit 41e7ebd

Browse files
committed
vegdist: update comments
1 parent 5d1e90b commit 41e7ebd

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

src/vegdist.c

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,10 @@ static double veg_morisita(double *x, int nr, int nc, int i1, int i2)
386386
return dist;
387387
}
388388

389-
/* Horn-Morisita index */
389+
/* Horn-Morisita index. Similar to Morisita above, but does not use
390+
* terms minus one (t1-1, t2-1) and can be used for non-integer
391+
* data. Similar to Morisita with large row sums, but diverges in
392+
* small samples. */
390393

391394
static double veg_horn(double *x, int nr, int nc, int i1, int i2)
392395
{
@@ -421,9 +424,10 @@ static double veg_horn(double *x, int nr, int nc, int i1, int i2)
421424

422425
/* Mountford index theta is defined as the root of an exponential
423426
* equation (function mount_fun below). The value of theta is found
424-
* using Newton method (derivatives in mount_der) in veg_mountford.
425-
* The result is divided by log(2) to put dissimilarities into
426-
* conventional range 0...1.
427+
* using Newton method (derivatives in mount_der) in veg_mountford. In
428+
* literature this is often wrongly represented, and instead of
429+
* Mountford's original definition literature claims the starting
430+
* value of estimation as the final Mountford index.
427431
*/
428432

429433
#define MAXIT 20
@@ -473,6 +477,8 @@ static double veg_mountford(double *x, int nr, int nc, int i1, int i2)
473477
J = (double)(sim);
474478
A = (double)(t1);
475479
B = (double)(t2);
480+
/* Starting value: literature often cites this as the
481+
* Mountford index */
476482
dist = 2*J/(2*A*B - (A+B)*J);
477483
for (j = 0; j < MAXIT; j++) {
478484
oldist = dist;
@@ -543,8 +549,7 @@ static double veg_raup(double *x, int nr, int nc, int i1, int i2)
543549
* notes of Marti Anderson over the internet, and she attributes this
544550
* idea to her colleague Russell Millar. The index is basically
545551
* binomial deviance under H0 that species are equally common in the
546-
* two compared communities. This could be easily generalized over
547-
* to, say, Poisson case.
552+
* two compared communities.
548553
*/
549554

550555
static double veg_millar(double *x, int nr, int nc, int i1, int i2)
@@ -573,7 +578,11 @@ static double veg_millar(double *x, int nr, int nc, int i1, int i2)
573578

574579
/* Chao's index (Ecol. Lett. 8, 148-159; 2005) tries to take into
575580
* account the number of unseen shared species using Chao's method for
576-
* estimating the number of unseen species. June 2006.
581+
* estimating the number of unseen species. Function chaoterms returns
582+
* the component terms U and V which are also used in C function SEXP
583+
* chaoterms and R function chaodist for any variant of Chao
584+
* distances; C function chaojaccard below only implements Jaccard
585+
* type index.
577586
*/
578587

579588
static void chaoterms(double *x, int nr, int nc, int i1, int i2,
@@ -897,7 +906,7 @@ SEXP do_minterms(SEXP x)
897906
return terms;
898907
}
899908

900-
/* Extract Chao terms U & V for designdist */
909+
/* Extract Chao terms U & V for R function chaodist (in designdist.R) */
901910

902911
SEXP do_chaoterms(SEXP x)
903912
{

0 commit comments

Comments
 (0)