Estimate momentsΒΆ

In this basic example we are going to estimate statistical moments from a sample.

In [1]:
from __future__ import print_function
import openturns as ot
In [2]:
# Create data
size = 100
mu = [-4.0, 5.0]
sigma = [2.0, 3.0]
R = ot.CorrelationMatrix(2)
normal = ot.Normal(mu, sigma, R)
sample = normal.getSample(size)
In [3]:
# Estimate mean
sample.computeMean()
Out[3]:

[-3.99594,4.75612]

In [4]:
# Estimate standard deviation
sample.computeStandardDeviation()
Out[4]:

[[ 1.89414 0 ]
[ 0.0759477 3.13125 ]]

In [5]:
# Estimate variance
sample.computeVariance()
Out[5]:

[3.58776,9.81049]

In [6]:
# Estimate skewness
sample.computeSkewness()
Out[6]:

[-0.169881,0.108393]

In [7]:
# Estimate kurtosis
sample.computeKurtosis()
Out[7]:

[3.45227,3.07151]