Options
All
  • Public
  • Public/Protected
  • All
Menu

Statistics tool based on incremental accumulation

It can accumulate a set of data and return statistics (e.g: mean, variance, skewness, kurtosis, error estimation, etc.). This class is a wrapper to the boost accumulator library.

Hierarchy

  • IncrementalStatistics

Index

Constructors

constructor

Properties

Private _data

_data: Array<[Real, Real]>

Private _downsideData

_downsideData: Array<[Real, Real]>

Methods

add

  • add(value: Real, valueWeight?: Real): void
  • adds a datum to the set, possibly with a weight

    Parameters

    • value: Real
    • Default value valueWeight: Real = 1

    Returns void

addSequence

  • addSequence(value: Real[], weight?: Real[]): void
  • adds a sequence of data to the set, with default weight

    Parameters

    • value: Real[]
    • Default value weight: Real[] = []

    Returns void

data

  • Returns Array<[Real, Real]>

downsideDeviation

  • downsideDeviation(): Real
  • returns the downside deviation, defined as the square root of the downside variance.

    Returns Real

downsideSamples

  • downsideSamples(): Size
  • number of negative samples collected

    Returns Size

downsideVariance

  • downsideVariance(): Real
  • returns the downside variance, defined as $$ \frac{N}{N-1} \times \frac{ \sum_{i=1}^{N} \theta \times x_i^{2}}{ \sum_{i=1}^{N} w_i} $$, where $ \theta $ = 0 if x > 0 and $ \theta $ =1 if x <0

    Returns Real

downsideWeightSum

  • downsideWeightSum(): Real
  • Returns Real

errorEstimate

  • errorEstimate(): Real
  • returns the error estimate $ \epsilon $, defined as the square root of the ratio of the variance to the number of samples.

    Returns Real

kurtosis

  • returns the excess kurtosis, defined as $$ \frac{N^2(N+1)}{(N-1)(N-2)(N-3)} \frac{\left\langle \left(x-\langle x \rangle \right)^4 \right\rangle}{\sigma^4} - \frac{3(N-1)^2}{(N-2)(N-3)}. $$ The above evaluates to 0 for a Gaussian distribution.

    Returns Real

max

  • returns the maximum sample value

    Returns Real

mean

  • returns the mean, defined as $$ \langle x \rangle = \frac{\sum w_i x_i}{\sum w_i}. $$

    Returns Real

min

  • returns the minimum sample value

    Returns Real

reset

  • reset(): void
  • resets the data to a null set

    Returns void

samples1

  • number of samples collected

    Returns Size

samples2

  • samples2(inRange: any): Size
  • Parameters

    • inRange: any

    Returns Size

skewness

  • returns the skewness, defined as $$ \frac{N^2}{(N-1)(N-2)} \frac{\left\langle \left( x-\langle x \rangle \right)^3 \right\rangle}{\sigma^3}. $$ The above evaluates to 0 for a Gaussian distribution.

    Returns Real

standardDeviation

  • standardDeviation(): Real
  • returns the standard deviation $ \sigma $, defined as the square root of the variance.

    Returns Real

variance

  • returns the variance, defined as $$ \frac{N}{N-1} \left\langle \left( x-\langle x \rangle \right)^2 \right\rangle. $$

    Returns Real

weightSum1

  • weightSum1(): Real
  • sum of data weights

    Returns Real

weightSum2

  • weightSum2(inRange: any): Size
  • Parameters

    • inRange: any

    Returns Size