I have a sequence of categorical variables, each number represents a category. Some events in the sequence are "clustered". Here is a dummy example (clustered events are separated with "_"):
1 2 1_6 2_5 1 1 2_5 1_6 1_6 2 2_5 5_1_6 2_2 1_2_5
I am interested whether specific transitions within these clusters occur more often than expected in a random sequence, i.e. when a next category in a cluster are selected with probability equal to its occurrence probability. I am trying to do that with one-side Fisher's exact test for 2x2 tables (numbers are often less than five or zero). Here is an example of such table for a transition between 1 and 6:
Transition | Observed | Expected for a random sequence |
---|---|---|
1 - 6 | 4 | 4 (number of 6's in the sequence) |
1 - not 6 | 1 | 19 (number of others categories in the sequence) |
I repeat this test for all possible pairs of categories, then perform a BH correction of alpha-levels.
My question is whether it is correct to use Fisher's test in such case. Although it seems to work, I doubt that the probabilities in the comparison can be considered independent, because they both are derived from the same sample. I will be glad to receive any suggestions.
UPD.: I have found a similar solution as proposed by me here, but with chi-square test instead of Fisher's.