FittingTest_ChiSquared¶

FittingTest_ChiSquared
(*args)¶ Perform a goodnessoffit test for 1d discrete distributions.
Parameters: sample : 2d sequence of float
Tested sample.
model :
Distribution
orDistributionFactory
Tested distribution.
level : float, , optional
This the value such that is the risk of committing a Type I error, that is an incorrect rejection of a true null hypothesis.
n_parameters : int, , optional
The number of parameters in the distribution that have been estimated from the sample. This parameter must not be provided if a
DistributionFactory
was provided as the second argument (it will internally be set to the number of parameters estimated by theDistributionFactory
). It can be specified if aDistribution
was provided as the second argument, but if it is not, it will be set equal to 0.Returns: test_result :
TestResult
Test result.
Raises: TypeError : If the distribution is not discrete or if the sample is
multivariate.
Notes
This is an interface to the chisq.test function from the ‘stats’ R package.
Examples
>>> import openturns as ot >>> ot.RandomGenerator.SetSeed(0) >>> distribution = ot.Poisson() >>> sample = distribution.getSample(30) >>> ot.FittingTest.ChiSquared(sample, ot.PoissonFactory(), .99) class=TestResult name=Unnamed type=ChiSquaredPoisson binaryQualityMeasure=true pvalue threshold=0.01 pvalue=0.606136 description=[]