# Error with KolmogorovSmirnovTest (and DistributionFitTest)

Posted 8 years ago
4181 Views
|
5 Replies
|
2 Total Likes
|
 Hello,Do you know how to use this function with non-rectangular arrays (not the same number of values for the different x)? In:= KolmogorovSmirnovTest[{{2, 4, 3}, {3, 9, 4}}, {{2, 4, 3}, {3, 9, 4}}] Out= 1. but In:= KolmogorovSmirnovTest[{{2, 4, 3, 4}, {3, 9, 4}}, {{2, 4, 3}, {3, 9, 4}}] During evaluation of In:= 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= 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
5 Replies
Sort By:
Posted 8 years ago
 Thank you for your reply!Now I understand...Referring to https://reference.wolfram.com/language/ref/KolmogorovSmirnovTest.html, I thought the input syntax for multivariate data "{{x1,y1,...},{x2,y2,...},...}" was limited to 2D data, with next to each "x", its different corresponding values in the second (same) dimension.Thank you again
Posted 8 years ago
 In:= data = {{{2, 4, 3}, {3, 9, 4}}, {{2, 4, 3}, {3, 9, 4}}}; In:= KolmogorovSmirnovTest[data] Out= KolmogorovSmirnovTest[{{{2, 4, 3}, {3, 9, 4}}, {{2, 4, 3}, {3, 9, 4}}}] In:= Show[SmoothHistogram[data, PlotStyle -> Orange], Plot[PDF[NormalDistribution[], x], {x, -4, 4}]] Posted 8 years ago
 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 8 years ago
 Thank you for your reply.I'd like to do a multivariate Kolmogorov-Smirnov test for the two distributions illustrated here: Mathematica requires each "x" variable to have the same number of "y" variable(s), what isn't verified in this case. Indeed, these data weren't gathered via measures we made an equal number of times for each "x", but each phenomenon "x" could appear (and then its "y" be measured) a random number of times during the experiment.What do you think?
Posted 8 years ago
 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?