Math-LiveStats

 view release on metacpan or  search on metacpan

META.json  view on Meta::CPAN

{
   "abstract" : "Pure perl module to make mean, standard deviation, vwap, and p-values available for one or more window sizes in streaming data",
   "author" : [
      "Chris Drake<cdrake@cpan.org>"
   ],
   "dynamic_config" : 1,
   "generated_by" : "ExtUtils::MakeMaker version 7.34, CPAN::Meta::Converter version 2.150010",
   "license" : [
      "unknown"
   ],
   "meta-spec" : {
      "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",

META.yml  view on Meta::CPAN

---
abstract: 'Pure perl module to make mean, standard deviation, vwap, and p-values available for one or more window sizes in streaming data'
author:
  - 'Chris Drake<cdrake@cpan.org>'
build_requires:
  ExtUtils::MakeMaker: '0'
configure_requires:
  ExtUtils::MakeMaker: '0'
dynamic_config: 1
generated_by: 'ExtUtils::MakeMaker version 7.34, CPAN::Meta::Converter version 2.150010'
license: unknown
meta-spec:

README  view on Meta::CPAN

Math-LiveStats version 1.02
===========================

Pure perl module to make mean, standard deviation, vwap, and p-values available for one or more window sizes in streaming data


INSTALLATION

To install this module type the following:

   perl Makefile.PL
   make
   make test
   make install

README.md  view on Meta::CPAN

# NAME

Math::LiveStats - Pure perl module to make mean, standard deviation, vwap, and p-values available for one or more window sizes in streaming data

# SYNOPSIS

      #!/usr/bin/perl -w
    
      use Math::LiveStats;
    
      # Create a new Math::LiveStats object with window sizes of 60 and 300 seconds
      my $stats = Math::LiveStats->new(60, 300); # doesn't have to be "time" or "seconds" - could be any series base you want
    

README.md  view on Meta::CPAN

      # Recalculate statistics to reduce accumulated errors
      $stats->recalc(60);

# CLI one-liner example

    cat data | perl -MMath::LiveStats -ne 'BEGIN{$s=Math::LiveStats->new(20);} chomp;($t,$p,$v)=split(/,/); $s->add($t,$p,$v); print "$t,$p,$v,",$s->n(20),",",$s->mean(20),",",$s->stddev(20),",",$s->vwap(20),",",$s->vwapdev(20),"\n"'

# DESCRIPTION

Math::LiveStats provides live statistical calculations (mean, standard deviation, p-value,
volume-weighted-average-price and stddev vwap) over multiple window sizes for streaming 
data. It uses West's algorithm for efficient updates and supports synthetic boundary 
entries to maintain consistent results.

Stats are computed based on data that exists inside the given window size, plus possibly
one (at most) synthetic entry: when old data shuffles out of the window, if there's no
data exactly on the oldest boundary of the window, one synthetic value is assumed to be
there, which is linearly-interpolated from the entries that appeared logically either side.

# METHODS

lib/Math/LiveStats.pm  view on Meta::CPAN

package Math::LiveStats;

use strict;
use warnings;

# perl -MPod::Markdown -e 'Pod::Markdown->new->filter(@ARGV)' lib/Math/LiveStats.pm  > README.md

=head1 NAME

Math::LiveStats - Pure perl module to make mean, standard deviation, vwap, and p-values available for one or more window sizes in streaming data

=head1 SYNOPSIS


    #!/usr/bin/perl -w
  
    use Math::LiveStats;
  
    # Create a new Math::LiveStats object with window sizes of 60 and 300 seconds
    my $stats = Math::LiveStats->new(60, 300); # doesn't have to be "time" or "seconds" - could be any series base you want

lib/Math/LiveStats.pm  view on Meta::CPAN

    # Recalculate statistics to reduce accumulated errors
    $stats->recalc(60);

=head1 CLI one-liner example

    cat data | perl -MMath::LiveStats -ne 'BEGIN{$s=Math::LiveStats->new(20);} chomp;($t,$p,$v)=split(/,/); $s->add($t,$p,$v); print "$t,$p,$v,",$s->n(20),",",$s->mean(20),",",$s->stddev(20),",",$s->vwap(20),",",$s->vwapdev(20),"\n"'

=head1 DESCRIPTION

Math::LiveStats provides live statistical calculations (mean, standard deviation, p-value,
volume-weighted-average-price and stddev vwap) over multiple window sizes for streaming 
data. It uses West's algorithm for efficient updates and supports synthetic boundary 
entries to maintain consistent results.

Stats are computed based on data that exists inside the given window size, plus possibly
one (at most) synthetic entry: when old data shuffles out of the window, if there's no
data exactly on the oldest boundary of the window, one synthetic value is assumed to be
there, which is linearly-interpolated from the entries that appeared logically either side.

=head1 METHODS



( run in 0.399 second using v1.01-cache-2.11-cpan-4d50c553e7e )