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)
>>> dist, test_result = ot.FittingTest.Kolmogorov(sample, ot.NormalFactory(), 0.01)
>>> print(test_result.getPValue())
0.7...
>>> print(test_result.getThreshold())
0.01...
>>> print(test_result.getBinaryQualityMeasure())
True

Methods

getBinaryQualityMeasure(self)

Accessor to the test’s binary conclusion.

getClassName(self)

Accessor to the object’s name.

getId(self)

Accessor to the object’s id.

getName(self)

Accessor to the object’s name.

getPValue(self)

Accessor to the test’s p-value.

getShadowedId(self)

Accessor to the object’s shadowed id.

getStatistic(self)

Accessor to the used statistic for decision.

getThreshold(self)

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

getVisibility(self)

Accessor to the object’s visibility state.

hasName(self)

Test if the object is named.

hasVisibleName(self)

Test if the object has a distinguishable name.

setName(self, name)

Accessor to the object’s name.

setShadowedId(self, id)

Accessor to the object’s shadowed id.

setVisibility(self, visible)

Accessor to the object’s visibility state.

getDescription

getTestType

setDescription

__init__(self, \*args)

Initialize self. See help(type(self)) for accurate signature.

getBinaryQualityMeasure(self)

Accessor to the test’s binary conclusion.

Returns
binary_measurebool, optional

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

getClassName(self)

Accessor to the object’s name.

Returns
class_namestr

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

getId(self)

Accessor to the object’s id.

Returns
idint

Internal unique identifier.

getName(self)

Accessor to the object’s name.

Returns
namestr

The name of the object.

getPValue(self)

Accessor to the test’s p-value.

Returns
p_valuefloat, 0 \leq p \leq 1

The test’s p-value.

getShadowedId(self)

Accessor to the object’s shadowed id.

Returns
idint

Internal unique identifier.

getStatistic(self)

Accessor to the used statistic for decision.

Returns
statisticfloat

Measure used for the statistical test.

getThreshold(self)

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

Returns
thresholdfloat, 0 \leq \alpha \leq 1

Accepted risk of committing a Type I error.

getVisibility(self)

Accessor to the object’s visibility state.

Returns
visiblebool

Visibility flag.

hasName(self)

Test if the object is named.

Returns
hasNamebool

True if the name is not empty.

hasVisibleName(self)

Test if the object has a distinguishable name.

Returns
hasVisibleNamebool

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

setName(self, name)

Accessor to the object’s name.

Parameters
namestr

The name of the object.

setShadowedId(self, id)

Accessor to the object’s shadowed id.

Parameters
idint

Internal unique identifier.

setVisibility(self, visible)

Accessor to the object’s visibility state.

Parameters
visiblebool

Visibility flag.