Statistics::Diversity::Shannon - Compute the Shannon diversity
version 0.0102
use Statistics::Diversity::Shannon; my @data = qw( 60 10 25 1 4 ); my $d = Statistics::Diversity::Shannon->new( data => \@data ); # OR @data = qw( .6 .1 .25 .01 .04 ); $d = Statistics::Diversity::Shannon->new( freq => \@data ); my $H = $d->index(); my $E = $d->evenness();
A Statistics::Diversity::Shannon computes the Shannon diversity index and evenness metrics.
Statistics::Diversity::Shannon
$d = Statistics::Diversity::Shannon->new( data => \@raw_data ); $d = Statistics::Diversity::Shannon->new( freq => \@prop_data );
Create a new Statistics::Diversity::Shannon object from either raw numerical data or proportional frequency data.
A reference to a numeric array
A reference to a numeric array of proportional frequencies
$H = $d->index;
Return the Shannon diversity index.
$E = $d->evenness;
Return the Shannon diversity evenness metric.
Moo
List::Util
The test in this distribution.
https://en.wikipedia.org/wiki/Diversity_index#Shannon_index
Gene Boggs <gene@cpan.org>
This software is copyright (c) 2017 by Gene Boggs.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Statistics::Diversity::Shannon, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Statistics::Diversity::Shannon
CPAN shell
perl -MCPAN -e shell install Statistics::Diversity::Shannon
For more information on module installation, please visit the detailed CPAN module installation guide.