TestResult

class TestResult(*args)

Test result data structure.

Warning

Tests results are not intended to be created manually. They are returned by the statistical tests implemented in the stattests subpackage. Constructor is therefore intentionally not documented.

Notes

The p-value of a test can be seen as the probability of observing a sample having a worst or equal statistic than the one that has been calculated on the tested sample, under the null hypothesis. This is the metric that is used for concluding the test with respect to the given accepted risk of committing a Type I error, that is an incorrect rejection of a true null hypothesis.

Examples

>>> import openturns as ot
>>> ot.RandomGenerator.SetSeed(0)
>>> distribution = ot.Normal()
>>> sample = distribution.getSample(30)
>>> test_result = ot.FittingTest.Kolmogorov(sample, ot.NormalFactory(), 0.99)
>>> print(test_result.getPValue())
0.846896...
>>> print(test_result.getThreshold())
0.01...
>>> print(test_result.getBinaryQualityMeasure())
True

Methods

getBinaryQualityMeasure() Accessor to the test’s binary conclusion.
getClassName() Accessor to the object’s name.
getDescription()
getId() Accessor to the object’s id.
getName() Accessor to the object’s name.
getPValue() Accessor to the test’s p-value.
getShadowedId() Accessor to the object’s shadowed id.
getTestType()
getThreshold() Accessor to the accepted risk of committing a Type I error.
getVisibility() Accessor to the object’s visibility state.
hasName() Test if the object is named.
hasVisibleName() Test if the object has a distinguishable name.
setDescription(description)
setName(name) Accessor to the object’s name.
setShadowedId(id) Accessor to the object’s shadowed id.
setVisibility(visible) Accessor to the object’s visibility state.
__init__(*args)

x.__init__(…) initializes x; see help(type(x)) for signature

getBinaryQualityMeasure()

Accessor to the test’s binary conclusion.

Returns:

binary_measure : bool, optional

Test conclusion: False if it can reject the null hypothesis, True if it cannot.

getClassName()

Accessor to the object’s name.

Returns:

class_name : str

The object class name (object.__class__.__name__).

getId()

Accessor to the object’s id.

Returns:

id : int

Internal unique identifier.

getName()

Accessor to the object’s name.

Returns:

name : str

The name of the object.

getPValue()

Accessor to the test’s p-value.

Returns:

p_value : float, 0 \leq p \leq 1

The test’s p-value.

getShadowedId()

Accessor to the object’s shadowed id.

Returns:

id : int

Internal unique identifier.

getThreshold()

Accessor to the accepted risk of committing a Type I error.

Returns:

threshold : float, 0 \leq \alpha \leq 1

Accepted risk of committing a Type I error.

getVisibility()

Accessor to the object’s visibility state.

Returns:

visible : bool

Visibility flag.

hasName()

Test if the object is named.

Returns:

hasName : bool

True if the name is not empty.

hasVisibleName()

Test if the object has a distinguishable name.

Returns:

hasVisibleName : bool

True if the name is not empty and not the default one.

setName(name)

Accessor to the object’s name.

Parameters:

name : str

The name of the object.

setShadowedId(id)

Accessor to the object’s shadowed id.

Parameters:

id : int

Internal unique identifier.

setVisibility(visible)

Accessor to the object’s visibility state.

Parameters:

visible : bool

Visibility flag.