Fit a normal distributionΒΆ

In this example we are going to estimate the parameters of a gaussian distribution from a sample.

In [1]:
from __future__ import print_function
import openturns as ot
import matplotlib.pyplot as plt
In [2]:
# Create data
sample = ot.Normal().getSample(50)
In [3]:
# Estimate a normal distribution
distribution = ot.NormalFactory().build(sample)
print(distribution)
Normal(mu = 0.0353171, sigma = 0.968336)
In [4]:
# Draw fitted distribution
distribution.drawPDF()
Out[4]:
../../_images/examples_statistical_estimation_estimate_normal_5_0.svg