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

NAME

Data::EventStream::Statistics::Discrete - basic statistical functions for the sample

VERSION

This document describes Data::EventStream::Statistics::Discrete version 0.13

SYNOPSIS

    use Data::EventStream::Statistics::Discrete;
    my $stat = Data::EventStream::Statistics::Discrete->new(
        value_sub => \&event_value,
    );
    $ev_stream->add_aggregator($stat, %params);

DESCRIPTION

Module implements aggregator that calculates basic statistical functions for data set in aggregators' window.

METHODS

$class->new(value_sub => \&value_sub)

Create a new aggregator. Requires value_sub parameter which defines subroutine that returns numeric value for an event.

$self->count

Current number of events in the window

$self->sum

Sum of all events in the window

$self->mean

Average value for the event

$self->variance

Variance of the data. Division by n-1 is used

$self->standard_deviation

Standard deviation of the data. Division by n-1 is used

STANDARD AGGREGATOR METHODS

$self->enter($event, $win)

Invoked when event enters window

$self->leave($event, $win)

Invoked when event leaves window

$self->reset($win)

Invoked when aggregator is reset

$self->window_update($win)

Invoked when window is updated