Fit a normal distributionΒΆ

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

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