CopulaKolmogorov¶
- CopulaKolmogorov(*args)¶
Perform a Kolmogorov-Smirnov goodness-of-fit test for a copula.
- Parameters:
- sample2-d sequence of float
Tested sample of dimension strictly greater than 1. The test is rank-based, so the sample can either be a sample from the copula (values in
) or a raw observations sample: pseudo-observations are computed internally from the ranks.
- model
DistributionorDistributionFactory Tested copula (
isCopula()must be true, the factory must build a copula).- levelfloat,
, optional (default level = 0.05).
Risk of committing a Type I error, that is an incorrect rejection of a true null hypothesis.
- Returns:
- fitted_dist
Distribution Estimated copula (if model is of type
DistributionFactory).- test_result
TestResult Test result.
- fitted_dist
Notes
Refer to Goodness-of-fit tests for copulas for notations.
With the notations of Goodness-of-fit tests for copulas, the Kolmogorov-Smirnov statistic is
Large values of
lead to rejection of the null hypothesis. The p-value is estimated with a parametric bootstrap, see Goodness-of-fit tests for copulas.
The following
ResourceMapkeys are used:FittingTest-CopulaMinimumSamplingSize(UnsignedInteger, default:10): minimum number of bootstrap replicationsFittingTest-CopulaMaximumSamplingSize(UnsignedInteger, default:1000): maximum number of bootstrap replicationsFittingTest-CopulaPrecision(Scalar, default:0.01): target standard deviation of the estimated p-value
Examples
>>> import openturns as ot >>> ot.RandomGenerator.SetSeed(0) >>> copula = ot.GumbelCopula(3.0) >>> sample = copula.getSample(100) >>> ot.ResourceMap.SetAsUnsignedInteger('FittingTest-CopulaMaximumSamplingSize', 100) >>> test_result = ot.FittingTest.CopulaKolmogorov(sample, copula) >>> test_result.getBinaryQualityMeasure() True >>> ot.ResourceMap.Reset()
OpenTURNS