Measure

Measure

new Measure(name)

Implements a repeated mesaure mechanism.

  • Allows to accumulate different measures of the same value to obtain basic statistics.

  • Typical usage:

 // Creates a measure
 var measure = new Measure();
 // Adds 1000 random values is this example
 for(i = 0; i < 1000; i++)
    measure.add(Math.random());
 // Dumps the result
 console.log(measure.asString());
Parameters:
Name Type Description
name

The measure name, if any.

Members

name

The measure name.

count

The measures count.

mean

The mean value.

stdev

The mean value standard-deviation.

min

The minimal value.

max

The maximal value.

Methods

clear()

Clears all measures of the value.

add(value)

Adds a measure of the value.

Parameters:
Name Type Description
value

The measure value to add.

asString(digits)

Returns the measure as a readable string.

Parameters:
Name Type Description
digits

The number of digits using fixed-point notation.

Returns:

A string of the form mean +- stdev [min .. max] #count