I have a bunch of data consisting of pairs (i,j), with both i and j drawn from the same set S of size k. I would like to do an independence test similar to a chi-square test.
However, I don't care very much about full independence. I'm really only interested in seeing if pairs of the form (i,i) show up more (or less) often than pairs of the form (i,j) with j not equal to i. So, it seems to make sense to aggregate the data, and to look at a 2 by k table with rows given by the first entry in a pair, and columns given by whether or not the second entry equals the first entry.
Can one do something like a chi-square test in this way? What might it look like/might I find references?
EDITED in response to whuber: Thanks for replying. I'm not sure I fully understand the question, but here goes. For me, the elements of S represent different groups (e.g. each element of S is a bank or government agency). If not a 2 by k table, what size would seem reasonable? I don't know what the labels would be for, say, a 2 by 2 table. I can guess rows for a 1 by 2 table, but then I can't imagine what the test would be - there's been too much aggregation. The 2 by k was there just because a) it seems clear that it contains all the data I'm interested in, and b) it contains substantially fewer entries than the full k by k table.
EDITED in response to gui11aume: Thanks for the help! The different elements of S represent e.g. different banks. A pair (i,j) might represent a certain type of trade involving bank i and bank j. In principle, it seems reasonable to just ask if a bank is more likely to deal with another part of itself, and so aggregate all of the data into the two blocks (both entries the same) and (entries are different). In practice, I'm a little worried about this, primarily due to scale issues. Some groups are involved in many orders of magnitudes more stuff than other groups. Normal contingency table tests seem to deal with this well, giving a separate normalization to each group. I don't know how to Aggregate into two blocks without making all but the largest groups effectively invisible. Of course, I'm not exactly an expert!