5
$\begingroup$

Bug introduced in 9.0 or earlier and persisting through 11.0.1 or later


I have been using DistributionFitTest to fit the following data:

data1 ={0.0746882, 0.0904019, -0.135138, -0.0346491, -0.0606611, 0.053513,0.0890939, 0.179085, 0.129787, -0.0405125, -0.136349, -0.120467,-0.152172, -0.160639, -0.144805, 0.152867, 0.00187467, 0.118546,0.264968, 0.348777, 0.129869, -0.0900954, -0.0171264, -0.0236788,-0.0732679, 0.00257676, -0.0819591, -0.0516664, -0.0368931,-0.091139,-0.105372, 0.0390199, -0.0798221, 0.0937339, -0.024548,-0.0983688, 0.0105325, 0.17959, 0.0610149, 0.174674, 0.0673951,-0.23942, -0.143729, 0.03579, -0.00531314, 0.241974, 0.145955,-0.0711934, -0.373047, 0.0132792, 0.0517776, 0.0494838, 0.00823672}

I create a HypothesisTestData object

h1 = DistributionFitTest[data1, StableDistribution[1, α, β, μ, σ], 
        "HypothesisTestData"]

Next I ask for all the tests that apply:

h1["TestDataTable", All]

I get a string of error messages:

DistributionFitTest::estprm: The p-value returned by the Anderson-Darling test is not valid for the StableDistribution[1,α,β,μ,σ] when the parameters in {α,β,μ,σ} have been estimated from the data. >>
DistributionFitTest::estprm: The p-value returned by the Cramér-von Mises test is not valid for the StableDistribution[1,α,β,μ,σ] when the parameters in {α,β,μ,σ} have been estimated from the data. >>
DistributionFitTest::estprm: The p-value returned by the Kolmogorov-Smirnov test is not valid for the StableDistribution[1,α,β,μ,σ] when the parameters in {α,β,μ,σ} have been estimated from the data. >>
General::stop: Further output of DistributionFitTest::estprm will be suppressed during this calculation. >>

As well as the error message, the system returns an answer, strangely:

\begin{array}{l|ll} \text{} & \text{Statistic} & \text{P-Value} \\ \hline \text{Anderson-Darling} & 0.169244 & 0.996662 \\ \text{Cramer-von Mises} & 0.0221281 & 0.99454 \\ \text{Kolmogorov-Smirnov} & 0.0577581 & 0.990108 \\ \text{Kuiper} & 0.094006 & 0.949288 \\ \text{Pearson }\chi ^2 & 4.16981 & 0.525235 \\ \text{Watson }U^2 & 0.0207305 & 0.991351 \\ \end{array}

So I tried just asking for one of the results (one that had been in the error message):

h1["TestDataTable", "AndersonDarling"]

Surprisingly, this gives no error message and (perhaps less surprisingly) returns the same result for the test as the table:

\begin{array}{l|ll} \text{} & \text{Statistic} & \text{P-Value} \\ \hline \text{Anderson-Darling} & 0.169244 & 0.996662 \\ \end{array}

First question: why no error message? But then things become more strange. I try the "All" test a second time:

h1["TestDataTable", All]

And the error messages are gone! The same table as above is given. Perhaps some system error state is being set and not reset. In any event can anyone give me an opinion as to whether this is a bug? Thanks.

$\endgroup$
  • $\begingroup$ It appears that the first time h1["TestDataTable", ...] is called with any second argument, the error message is produced. However, the second call with the same or different second argument produces no error message. $\endgroup$ – bbgodfrey Apr 20 '15 at 4:59
8
$\begingroup$

It is a bug in the caching feature. Some distributions don't have p-value corrections since those based on the empirical CDF must be derived individually. The result is correct but the p-value is inflated due to lack of correction. When the test or any underlying one is ran again it returns the cached result with no message.

| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.