Distribution fitting test using QQ plotΒΆ

In this example we are going to perform a visual goodness-of-fit test for an 1-d distribution with the QQ plot.

In [17]:
from __future__ import print_function
import openturns as ot
In [18]:
# Create data
ot.RandomGenerator.SetSeed(0)
distribution = ot.Gumbel(5.0, 0.5)
sample = distribution.getSample(100)
sample.setDescription(['Sample'])
In [19]:
# Fit a distribution
distribution = ot.GumbelFactory().build(sample)
In [20]:
# Draw QQ plot
ot.VisualTest.DrawQQplot(sample, distribution)
Out[20]:
../../_images/examples_data_analysis_qqplot_graph_5_0.svg
In [21]:
# Incorrect proposition
ot.VisualTest.DrawQQplot(sample, ot.Weibull())
Out[21]:
../../_images/examples_data_analysis_qqplot_graph_6_0.svg