lmpy.statistics.running_stats

Class for keeping track of running statistics to save memory.

Note

Module Contents

Classes

RunningStats

Construct a RunningStats instance.

Functions

compare_absolute_values(observed, test_data)

Compares the absolute values of the observed and random data.

compare_signed_values(observed, test_data)

Compares the signed values of the observed and random data.

class lmpy.statistics.running_stats.RunningStats(observed=None, compare_fn=compare_absolute_values)[source]

Bases: object

Construct a RunningStats instance.

Parameters
  • observed (numeric) – The observed value to be used when computing an F-statistic. It can be a single value or an array-type.

  • ( (compare_fn) – obj:method): A function used to compare pushed values to the observed statistic value.

property p_values[source]

Retrieve p-values from the test values greater than the f-statistic.

Returns

Computed p-values.

Return type

Matrix

Raises

Exception – Raised if there are no observed values.

property standard_deviation[source]

Retrieve the standard deviation of the test values.

Returns

The standard deviation of the test values.

Return type

float

property variance[source]

Retrieve the variance of the test values.

Returns

The variance of the test values.

Return type

float

push(val)[source]

Add a test value to the running totals.

Parameters

val (Matrix, Numpy array, or numeric) – A value to use for the running statistics.

lmpy.statistics.running_stats.compare_absolute_values(observed, test_data)[source]

Compares the absolute values of the observed and random data.

Parameters
  • observed (Numpy array) – A numpy array of observed values.

  • test_data (Numpy array) – A numpy array of random values.

Returns

Boolean indicating if the absolute value of the test data is greater than

the absolute value of the observed data.

Return type

bool

lmpy.statistics.running_stats.compare_signed_values(observed, test_data)[source]

Compares the signed values of the observed and random data.

Parameters
  • observed (Numpy array) – A numpy array of observed values.

  • test_data (Numpy array) – A numpy array of random values.

Returns

An indication if the test data is greater than the observed data.

Return type

bool