IterativeMoments

class IterativeMoments(*args)

Iterative moments.

Parameters
orderint

Maximum order of the moments wanted

dimensionint

Dimension of the input data

Notes

This class iteratively computes the centered moments of an iteratively increasing dataset without storing any data in memory.

Examples

In the following example, we iteratively compute the sample statistics of a sample. This is based on a sample with size equal to 2000. In the for loop, each realization of the distribution is used to update the statistics up to the 4th order moments.

>>> import openturns as ot
>>> distNormal = ot.Normal()
>>> order = 4
>>> dim = 1
>>> iterMoments = ot.IterativeMoments(order, dim)
>>> size = 2000
>>> meanEvolution = ot.Sample()
>>> for i in range(size):
...     point = distNormal.getRealization()
...     iterMoments.increment(point)
>>> print('Mean:     ', iterMoments.getMean())
Mean:      [-0.00726852]
>>> print('Variance: ', iterMoments.getVariance())
Variance:  [0.99156]
>>> print('Skewness: ', iterMoments.getSkewness())
Skewness:  [0.0577277]
>>> print('Kurtosis: ', iterMoments.getKurtosis())
Kurtosis:  [3.11128]

The statistics can also be updated with a single sample.

>>> distNormal = ot.Normal()
>>> dim = 1
>>> order = 1
>>> iterMoments = ot.IterativeMoments(order, dim)
>>> size = 2000
>>> sample = distNormal.getSample(size)
>>> iterMoments.increment(sample)
>>> print('Mean: ', iterMoments.getMean())
Mean:  [-0.017342]

Methods

getCenteredMoments()

Returns the centered moments

getClassName()

Accessor to the object's name.

getCoefficientOfVariation()

Returns the coefficient of variation

getDimension()

Get the dimension of the algorithm

getId()

Accessor to the object's id.

getIterationNumber()

Get the current iteration of the algorithm

getKurtosis()

Returns the current value of the unbiased estimator of the kurtosis

getMean()

Returns the values of the mean

getName()

Accessor to the object's name.

getOrder()

Returns the maximum order prescribed

getShadowedId()

Accessor to the object's shadowed id.

getSkewness()

Returns the current value of the unbiased estimator of the skewness

getStandardDeviation()

Returns the standard deviation

getStandardErrorOfTheMean()

Returns the standard error of the mean

getVariance()

Returns the current value of the unbiased estimator of the variance

getVisibility()

Accessor to the object's visibility state.

hasName()

Test if the object is named.

hasVisibleName()

Test if the object has a distinguishable name.

increment(*args)

Increment the internal data.

setName(name)

Accessor to the object's name.

setShadowedId(id)

Accessor to the object's shadowed id.

setVisibility(visible)

Accessor to the object's visibility state.

__init__(*args)
getCenteredMoments()

Returns the centered moments

Returns
centeredMomentsSample

Current value of the centered moments.

getClassName()

Accessor to the object’s name.

Returns
class_namestr

The object class name (object.__class__.__name__).

getCoefficientOfVariation()

Returns the coefficient of variation

Returns
coefficientOfvariationPoint

Current value of the coefficients of variation.

getDimension()

Get the dimension of the algorithm

Returns
dimensionint

Dimension of the algorithm

getId()

Accessor to the object’s id.

Returns
idint

Internal unique identifier.

getIterationNumber()

Get the current iteration of the algorithm

Returns
iterationint

Current iteration of the algorithm

getKurtosis()

Returns the current value of the unbiased estimator of the kurtosis

Returns
kurtosisPoint

Current values of the iterative kurtosis.

getMean()

Returns the values of the mean

Returns
meanPoint

Current value of the mean.

getName()

Accessor to the object’s name.

Returns
namestr

The name of the object.

getOrder()

Returns the maximum order prescribed

Returns
orderint

Prescribed order of the iterative object.

getShadowedId()

Accessor to the object’s shadowed id.

Returns
idint

Internal unique identifier.

getSkewness()

Returns the current value of the unbiased estimator of the skewness

Returns
skewnessPoint

Current values of the skewness.

getStandardDeviation()

Returns the standard deviation

Returns
standardDeviationPoint

Current value of the standard deviation.

getStandardErrorOfTheMean()

Returns the standard error of the mean

Returns
errorPoint

Current value of the standard error of the mean.

getVariance()

Returns the current value of the unbiased estimator of the variance

Returns
variancePoint

Current values of the variance.

getVisibility()

Accessor to the object’s visibility state.

Returns
visiblebool

Visibility flag.

hasName()

Test if the object is named.

Returns
hasNamebool

True if the name is not empty.

hasVisibleName()

Test if the object has a distinguishable name.

Returns
hasVisibleNamebool

True if the name is not empty and not the default one.

increment(*args)

Increment the internal data.

Parameters
datasequence of float or 2-d sequence of float

New input point or sample.

setName(name)

Accessor to the object’s name.

Parameters
namestr

The name of the object.

setShadowedId(id)

Accessor to the object’s shadowed id.

Parameters
idint

Internal unique identifier.

setVisibility(visible)

Accessor to the object’s visibility state.

Parameters
visiblebool

Visibility flag.