NAME

Statistics::Diversity::Shannon - Compute the Shannon diversity

VERSION

version 0.0102

SYNOPSIS

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();

DESCRIPTION

A Statistics::Diversity::Shannon computes the Shannon diversity index and evenness metrics.

METHODS

new()

$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.

Attributes

data

A reference to a numeric array

freq

A reference to a numeric array of proportional frequencies

index()

$H = $d->index;

Return the Shannon diversity index.

evenness()

$E = $d->evenness;

Return the Shannon diversity evenness metric.

SEE ALSO

Moo

List::Util

The test in this distribution.

https://en.wikipedia.org/wiki/Diversity_index#Shannon_index

AUTHOR

Gene Boggs <gene@cpan.org>

COPYRIGHT AND LICENSE

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.