Biodiversity Indices Computation

by Jean-Marc Ginoux

Department of Mechanical Engineering
University du Sud Toulon Var
B.P. 20132
83947 LA Garde cedex 
ginoux@univ-tln.fr
http://ginoux.univ-tln.fr

This notebook contains an applet elaborated in order to compute the diversity
indices of Hill, Gleason-Margalef, Menhinick, Odum, Brillouin, Shannon, Simpson, Krebs, McIntosh, Hurlbert, Keefe, Patten, Piélou and also the dominances It just needs Mathematica. For details on the definitions of these indices see the Bandeira, B., Jamet, J.M., Jamet, D. & Ginoux J.M. [2013] “Mathematical Convergences of Biodiversity Indices,” Ecological Indicators (in press).

A. Introduction

At first, you have just to create a file called Indices on C:\Indices. Then, save your own sample in a textfile called “Prelevement.txt” in C:\Indices. Start the computation.

B. Example

In September 27th, 1999, studying phytoplankton communities we made the following sample:

({{Asterionella glacialis, 61}, {Chaetoceros compressus, 92}, {Chaetoceros curvisetus, 244}, {Chaetoceros danicus, 366}, {Chaetoceros peruvianus, 92}, {Chaetoceros simplex, 61}, {Chaetoceros sp4, 183}, {Coscinodiscus sp1, 31}, {Coscinodiscus sp3, 31}, {Cyclotella striata, 397}, {Cylindrotheca closterium, 153}, {Guinardia sp1, 244}, {Hemiaulus hauckii, 31}, {Nitzschia sp1, 61}, {Chlorella sp, 31}, {Alexandrium sp1, 214}, {Blepharocysta sp, 31}, {Ceratium furca, 580}, {Gonyaulax spinifera, 31}, {Gymnodinium sp1, 1709}, {Phalacroma rotundatum, 31}, {Prorocentrum micans, 122}, {Protoperidinium pellucidum, 122}, {Scripsiella sp, 61}, {Dictyocha sp, 244}, {Thaumatomastix sp, 31}})

Thus, we created the following textfile:

Prelevement.txt = {61, 92, 244, 366, 92, 61, 183, 31, 31, 397, 153, 244, 31, 61, 31, 214, 31, 580, 31, 1709, 31, 122, 122, 61, 244, 31}

Then, a textfile called Prelevement_Indices is automatically created in C:\Indices and the Biodiversity Indices appear also below.

C. Biodiversity Indices Computation

Off[General::spell1];
decimales=10;
repertoire="C:\Indices\\";
fichier="Prelevement.txt"
fichierEntree=repertoire<>fichier;
fichierSortie= StringInsert[fichierEntree,"_Indices",-5];
StrmSortie=OpenWrite[fichierSortie];
StrmEntree=OpenRead[fichierEntree];
nom=Read[StrmEntree,String];
origine={0};
For[x=1, origine[[x]]≥0,x=x+1,origine=Append[origine,Read[StrmEntree]]];
Close[StrmEntree];
Sort[origine]
origine=Delete[origine,-1];
origine=DeleteCases[origine,0];
grandS=Dimensions[origine][[1]];
grandN=Total[origine];
listeBrillouin=origine!;produit=1; For[x=1,x≤grandS,x=x+1,produit=produit*listeBrillouin[[x]]];
listeShannon=-origine/grandN*Log[2,origine/grandN];
listeSimpson=origine*(origine-1)/(grandN*(grandN-1));
listeKrebs=(origine/grandN)^2 ; 
listeMcIntosh=origine^2; 
WriteString[StrmSortie,"Prelevement : ",nom," \n"];
For [y=1,y≤grandS,y=y+1,WriteString[StrmSortie,origine[[y]]," \n"]];
GleasonMargalef=N[(grandS-1)/Log[grandN] ,decimales];
Menhinick=N[grandS/Sqrt[grandN] ,decimales];
Odum= N[grandS grandN / 1000 ,decimales];
Brillouin=N[1/grandN Log[2,grandN!/produit] ,decimales];
Shannon=N[Total[listeShannon],decimales];
Simpson=N[Total[listeSimpson],decimales];
Krebs=N[1-Total[listeKrebs],decimales];
McIntosh=N[(grandN-Sqrt[Total[listeMcIntosh]])/(grandN-Sqrt[grandN]),decimales];
Hurlbert=N[(grandN/(grandN-1))*(1-Total[listeKrebs]),decimales];
KeefesTU=1-N[(grandN/(grandN-1))*(Total[listeKrebs]-1/grandN),decimales];
DominanceDelta1=N[100*origine[[1]]/grandN,decimales];
DominanceDelta2=N[100*(origine[[1]]+origine[[2]])/grandN,decimales];
Dmin=N[Log[2,grandN!]-Log[2,(grandN-grandS+1)!],decimales];
Dmax=N[Log[2,grandN!]-grandS*Log[2,(grandN/grandS)!],decimales];
grandD=N[Log[2,grandN!/produit],decimales];
Redondance=N[(Dmax-grandD)/(Dmax-Dmin),decimales];
Evenness=N[grandD/Dmax,decimales];
WriteString[StrmSortie,"------------------------------- \n"];
WriteString[StrmSortie,"S                = ",grandS," \n"];
WriteString[StrmSortie,"N                = ",grandN," \n"];
WriteString[StrmSortie,"Gleason-Margalef = ",GleasonMargalef," \n"];
WriteString[StrmSortie,"Menhinick        = ",Menhinick," \n"];
WriteString[StrmSortie,"Odum             = ",Odum," \n"];
WriteString[StrmSortie,"Brillouin        = ",Brillouin," \n"];
WriteString[StrmSortie,"Shannon          = ",Shannon," \n"];
WriteString[StrmSortie,"Simpson          = ",Simpson," \n"];
WriteString[StrmSortie,"Krebs            = ",Krebs," \n"];
WriteString[StrmSortie,"McIntosh         = ",McIntosh," \n"];
WriteString[StrmSortie,"Hurlbert         = ",Hurlbert," \n"];
WriteString[StrmSortie,"Keefe's TU       = ",KeefesTU," \n"];
WriteString[StrmSortie,"Dominance Delta1 = ",DominanceDelta1," \n"];
WriteString[StrmSortie,"Dominance Delta2 = ",DominanceDelta2," \n"];
WriteString[StrmSortie,"Dmin             = ",Dmin," \n"];
WriteString[StrmSortie,"Dmax             = ",Dmax," \n"];
WriteString[StrmSortie,"D                = ",grandD," \n"];
WriteString[StrmSortie,"Redondance       = ",Redondance," \n"];
WriteString[StrmSortie,"Evenness         = ",Evenness," \n"];
Close[StrmSortie];
Print["Prelevement : ",nom];
Print["-------------------------------"];
Print["S                = ",grandS];
Print["N                = ",grandN];
Print["Gleason-Margalef = ",GleasonMargalef];
Print["Menhinick        = ",Menhinick];
Print["Odum             = ",Odum];
Print["Brillouin        = ",Brillouin];
Print["Shannon          = ",Shannon];
Print["Simpson          = ",Simpson];
Print["Krebs            = ",Krebs];
Print["McIntosh         = ",McIntosh];
Print["Hurlbert         = ",Hurlbert];
Print["Keefe's TU       = ",KeefesTU];
Print["Dominance Delta1 = ",DominanceDelta1];
Print["Dominance Delta2 = ",DominanceDelta2];
Print["Dmin             = ",Dmin];
Print["Dmax             = ",Dmax];
Print["D                = ",grandD];
Print["Redondance       = ",Redondance];
Print["Evenness         = ",Evenness];