IterativeMoments¶
- class IterativeMoments(orderMax=2, dimension=1)¶
Iterative moments.
- Parameters:
- orderint
Maximum order of the moments wanted
- dimensionint
Dimension of the input data
Methods
Returns the central moments
Accessor to the object's name.
Returns the coefficient of variation
Get the dimension of the algorithm
Get the current iteration of the algorithm
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
Returns the current value of the unbiased estimator of the skewness
Returns the standard deviation
Returns the standard error of the mean
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.
See also
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:
- centralMoments
Sample
Current value of the central moments.
- centralMoments
- getClassName()¶
Accessor to the object’s name.
- Returns:
- class_namestr
The object class name (object.__class__.__name__).
- getCoefficientOfVariation()¶
Returns the coefficient of variation
- Returns:
- coefficientOfvariation
Point
Current value of the coefficients of variation.
- coefficientOfvariation
- 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:
- kurtosis
Point
Current values of the iterative kurtosis.
- kurtosis
- 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:
- skewness
Point
Current values of the skewness.
- skewness
- getStandardDeviation()¶
Returns the standard deviation
- Returns:
- standardDeviation
Point
Current value of the standard deviation.
- standardDeviation
- getStandardErrorOfTheMean()¶
Returns the standard error of the mean
- Returns:
- error
Point
Current value of the standard error of the mean.
- error
- getVariance()¶
Returns the current value of the unbiased estimator of the variance
- Returns:
- variance
Point
Current values of the variance.
- 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.