1
$\begingroup$

I have two datasets, X, Y, containing discrete variables which both have a different number of instances. I want to analyse the difference between the datasets for each of these variables.

When these discrete variables are binary, I can use the Chi2 test (as suggested in Chi square test when sample sizes are different?) or Fishers Exact test (as in Compare means of two datasets of binary data). However, one of these discrete features isn't binary and I'm struggling to find a test for discrete variables where the datasets are of unequal length.

This discrete variable is ordinal and has values 0, 1 or 2. Maybe one approach could be to treat this as a continuous variable and use a non-parametric test for continuous distributions like Kolmogorov-Smirnov test, but this gives me suspiciously low p values (e.g. $1\times 10 ^{-60}$). Another approach might be to bin the variable by setting 1 to 0 or 2, and then use one of the above tests, but this would skew the data and lose information.

Is there an appropriate test for this situation?

$\endgroup$

1 Answer 1

0
$\begingroup$

While I was writing this question I found that the Mann-Whitney U rank test can be used here. According to the Wikipedia page, the test was originally developed under the asssumption of continuity but it can be used also on discrete ordinal data. Similarly the example given in SciPy's implementation of this test is used on discrete ordinal data.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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