The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Statistics::Descriptive::PDL - A close to drop-in replacement for Statistics::Descriptive using PDL as the back-end

VERSION

Version 0.10

SYNOPSIS

    use Statistics::Descriptive::PDL;

    my $stats = Statistics::Descriptive::PDL->new();
    $stats->add_data(1,2,3,4);
    my $mean = $stats->mean;
    my $var  = $stats->variance();

DESCRIPTION

This module provides basic functions used in descriptive statistics.

METHODS

new

Create a new statistics object. Takes no arguments.

add_data (@data)
add_data (\@data)

Add data to the stats object. Passed through to the underlying PDL object. Appends to any existing data.

Multidimensional data are flattened into a single dimensional array.

get_data

Return the data as a perl array. Returns an array ref in scalar context.

get_data_as_hash

Returns the data as a perl hash, with the unique data values as the hash keys and the counts of each unique data value as the hash values.

Deduplicates the data if needed, incrementing the weights as appropriate. Internally it uses a Statistics::Descriptive::PDL::SampleWeighted object.

Data values are stringified so there is obviously potential for loss of precision.

values_are_unique

Flag whether the data have duplicate values. Has no effect on unweighted data. It is provided purely for a consistent interface with the weighted variants.

clear_cache

Clears any cached results on an object.

available_stats

Method to return a list of the available statistics.

geometric_mean
harmonic_mean
max
mean
median
min
mode
sample_range
standard_deviation
sum
variance

The above should need no explanation, except that they use the unbiased methods where appropriate, as per Statistics::Descriptive.

count

Number of data items that have been added.

skewness
kurtosis

Skewness and kurtosis to match that of MS Excel. If you are used to R then these are the same as type=2 in e1071::skewness and e1071::kurtosis.

sd
stdev

These are aliases for the standard_deviation method.

percentile (10)
percentile (45)

The percentile calculation differs from Statistics::Descriptive in that it uses linear interpolation to determine the values, and thus does not return the exact same values as the input data.

percentiles (10, 20, 30)

A simple wrapper around the percentile method to allow calculation of multiple values in one call.

iqr

The inter-quartile range. A convenience method to calculate the difference between the 75th and 25th percentile.

Not yet implemented, and possibly won't be.

Any of the trimmed functions, frequency functions and some others.

least_squares_fit
trimmed_mean
quantile
mindex
maxdex

AUTHOR

Shawn Laffan, <shawnlaffan at gmail.com>

BUGS

Please report any bugs or feature requests to https://github.com/shawnlaffan/Statistics-Descriptive-PDL/issues.

ACKNOWLEDGEMENTS

LICENSE AND COPYRIGHT

Copyright 2021 Shawn Laffan.

This program is free software; you can redistribute it and/or modify it under the terms of the the Artistic License (2.0). You may obtain a copy of the full license at:

http://www.perlfoundation.org/artistic_license_2_0

Any use, modification, and distribution of the Standard or Modified Versions is governed by this Artistic License. By using, modifying or distributing the Package, you accept this license. Do not use, modify, or distribute the Package, if you do not accept this license.

If your Modified Version has been derived from a Modified Version made by someone other than you, you are nevertheless required to ensure that your Modified Version complies with the requirements of this license.

This license does not grant you the right to use any trademark, service mark, tradename, or logo of the Copyright Holder.

This license includes the non-exclusive, worldwide, free-of-charge patent license to make, have made, use, offer to sell, sell, import and otherwise transfer the Package with respect to any patent claims licensable by the Copyright Holder that are necessarily infringed by the Package. If you institute patent litigation (including a cross-claim or counterclaim) against any party alleging that the Package constitutes direct or contributory patent infringement, then this Artistic License to you shall terminate on the date that such litigation is filed.

Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.