IterativeMoments

class IterativeMoments(orderMax=2, dimension=1)

Iterative moments.

Parameters:
orderint

Maximum order of the moments wanted

dimensionint

Dimension of the input data

Methods

getCentralMoments()

Returns the central moments

getClassName()

Accessor to the object's name.

getCoefficientOfVariation()

Returns the coefficient of variation

getDimension()

Get the dimension of the algorithm

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

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

hasName()

Test if the object is named.

increment(*args)

Increment the internal data.

setName(name)

Accessor to the object's name.

Notes

This class iteratively computes the central 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]
__init__(orderMax=2, dimension=1)
getCentralMoments()

Returns the central moments

Returns:
centralMomentsSample

Current value of the central 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

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.

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.

hasName()

Test if the object is named.

Returns:
hasNamebool

True if the name is not empty.

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.

Examples using the class

Estimate moments iteratively

Estimate moments iteratively