1
$\begingroup$

With following code I will get an error:

data = Flatten[{595, 1431, 4347, 5554, 6279, 6887, Table[{7100, \[Infinity]}, {10}]}, 1];
e = EventData[data];
DistributionFitTest[e, WeibullDistribution[a, b]]

a and b are the unknown parameter of the Weibull distribution.

Providing with estimated parameter will not help (again the same error message):

d = EstimatedDistribution[e, WeibullDistribution[a, b], ParameterEstimator -> {"MaximumLikelihood", Method -> "NMaximize"}]
DistributionFitTest[data, d]
$\endgroup$
  • $\begingroup$ Hi, welcome to Mathematica.SE, please consider taking the tour so you learn the basics of the site. Once you gain enough reputation by making good questions you will be able to vote up and down both questions and answers. When you see good ones, please vote them up by clicking the grey triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. As you receive help, try to give it too, by answering questions in your area of expertise. $\endgroup$ – rhermans Nov 4 '14 at 11:43
  • 1
    $\begingroup$ Can you please explain the format of your data? Clearly that is not accepted by EventData. The solution probably goes in the lines of FindDistributionParameters[cdata, CensoredDistribution[{leftCensor, rightCensor}, WeibullDistribution[a, b]] $\endgroup$ – rhermans Nov 4 '14 at 11:49
  • $\begingroup$ Does DistrubutionFitTest accept data with Head == EventData? $\endgroup$ – bobthechemist Nov 4 '14 at 13:07
  • 2
    $\begingroup$ To my knowledge DistributionFitTest does not work with EventData. $\endgroup$ – Andy Ross Nov 4 '14 at 14:18
1
$\begingroup$

@rhermans gave you the answer in a comment.

data = Flatten[{595, 1431, 4347, 5554, 6279, 6887, Table[7100, {10}]},
    1];

wcd = CensoredDistribution[{leftCensor, rightCensor}, WeibullDistribution[a, b]];
FindDistributionParameters[data, wcd]
(* {leftCensor -> 595.,rightCensor -> 7100.,a -> 1.1017281600526971,b -> 14712.282885780418} *)
DistributionFitTest[data, wcd, "PearsonChiSquare"]
(* 0.05125258285736953 *)

If leftCensor is known to be zero, then you could use

wcd = CensoredDistribution[{0, rightCensor}, WeibullDistribution[a, b]];
FindDistributionParameters[data, wcd]
(* {rightCensor -> 7100.,a -> 1.3102715493177497,b -> 12977.89931682844} *)
DistributionFitTest[data, wcd, "PearsonChiSquare"]
(* 0.17573433564422514 *)

While for this particular distribution DistributionFitTest chooses PearsonChiSquare, one should make this explicit or at least determine which test was used. If you choose some of the other tests, you'll likely see a warning that the P-value is bogus due to the fact that you've had to estimate some of the parameters.

And, finally, if you only have 7 unique values, the best you can do when the P-value is large is to say "Well, maybe there aren't any gross departures observed."

$\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.