Message Boards Message Boards

1
|
5405 Views
|
5 Replies
|
2 Total Likes
View groups...
Share
Share this post:
GROUPS:

Error with KolmogorovSmirnovTest (and DistributionFitTest)

Posted 10 years ago

Hello,

Do you know how to use this function with non-rectangular arrays (not the same number of values for the different x)?

In[10]:= KolmogorovSmirnovTest[{{2, 4, 3}, {3, 9, 4}}, {{2, 4, 3}, {3,
    9, 4}}]

Out[10]= 1.

but

In[11]:= KolmogorovSmirnovTest[{{2, 4, 3, 4}, {3, 9, 4}}, {{2, 4, 
   3}, {3, 9, 4}}]

During evaluation of In[11]:= KolmogorovSmirnovTest::rctnln: The argument {{2,4,3,4},{3,9,4}} at position 1 should be a rectangular array of real numbers with length greater than the dimension of the array. >>

Out[11]= KolmogorovSmirnovTest[{{2, 4, 3, 4}, {3, 9, 4}}, {{2, 4, 
   3}, {3, 9, 4}}]

The input arguments abide by the syntax of the function for multivariate data in both cases ( https://reference.wolfram.com/language/ref/KolmogorovSmirnovTest.html ).

Thank you

POSTED BY: Michael E
5 Replies

If I understand you correctly, you are giving a list of values like:

{{x,y1,y2, y3...}, ....}

That is not the form of input that the function accepts.

The input to the function should instead look like:

{{x,y1}, {x,y2}, {x,y3}}, ....}

In a previous post on the form, you asked how to convert from this format into the incorrect format you are using above.

POSTED BY: Sean Clarke

You cannot use a non-rectangular array. It doesn't make sense. What kind of distribution gives out vectors of different lengths?

Can you define what it means to do a goodness of fit test against a set of vectors of different lenghts?

POSTED BY: Sean Clarke
Posted 10 years ago
POSTED BY: Michael E
In[18]:= data = {{{2, 4, 3}, {3, 9, 4}}, {{2, 4, 3}, {3, 9, 4}}};

In[19]:= KolmogorovSmirnovTest[data]

Out[19]= KolmogorovSmirnovTest[{{{2, 4, 3}, {3, 9, 4}}, {{2, 4, 
    3}, {3, 9, 4}}}]

In[20]:= Show[SmoothHistogram[data, PlotStyle -> Orange], 
 Plot[PDF[NormalDistribution[], x], {x, -4, 4}]]

enter image description here

POSTED BY: Simon Cadrin
Posted 10 years ago
POSTED BY: Michael E
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract