How do I test whether similar subjects are more likely to pair up?

I have a bunch of subjects. These subjects can pair up (in unordered pairs), and can do so repeatedly, even repeatedly to the same other subject. So I have a list of pairings and how many times each has occurred. (An example might be a bunch of people and how many times any two of them has shaken hands.)

Now, each such pairing can be between 'like' subjects or between 'unlike' subjects. (There's a definition I use for 'like'; it's an equivalence, if that matters.) (In the example, you might consider handshakes between people of precisely the same surname or of not precisely the same surname.)

I wish to test whether a pairing of 'like' subjects is more likely than a pairing of 'unlike' subjects. How can I do this? Please bear in mind that I need to take into account that some of the subjects are less likely to pair altogether. (In the example, I'd want to know whether people of the same surname are more likely to shake hands. But I'd need to bear in mind that some people just shake hands more in general.)

I'll indicate what I've tried, but I don't know whether it's correct. I welcome confirmation that it's correct, explanation of why it's not, recommendation for fixing it, and/or wholly different methods. I did as follows: For each subject, find how many pairings it's in; call that its score. For any two subjects, find the product of their scores; call that the pair's score. Then, for the two subjects, find the actual number of pairings; divide that by the pair's score (which is to take into account the fact that some subjects are less likely to pair altogether). Consider this last number as the dependent variable and use ANOVA with 'like' and 'unlike' as my groups.

(Another idea I had was to use the pair's score (as above) as a factor in an ANCOVA (with, of course, 'like' and 'unlike' as the other factor, and the actual number of pair's pairings as the dependent variable). This seemed more intuitive, actually. But ANCOVA requires that the regression lines for the dependent variables against the continuous variables have equal slope for the different categorical variables, and in my case the slopes are 0.019 and 0.24.)

• Think about what is the the population and the sample. Are your subjects a sample from a population or are you only interested in just those subjects that you have? Instead of "all subjects", consider maybe that "all handshakes" is the population, and you are trying to predict the proportion of "like" and "unlike" handshakes from your sample of handshakes. The research question and design needs a little more clarification. Dec 7, 2015 at 18:43
• @Hotaka thanks for seeking clarification. I'm looking at the entire population of interest, not a sample. No only am I willing to consider the population of handshakes rather than the population of subjects -- that is in fact what I do when I run ANOVA on the set of handshakes and also when I propose running ANCOVA on the set of handshakes (as desribed in the question). I'm not interested in the proportion of 'like' and 'unlike' handshakes, however -- only in their proportion relative to the proportion of 'like' and 'unlike' pair of subjects altogether and how often they shake hands.
– JQKP
Dec 7, 2015 at 20:34
• This sounds like a social network analysis problem amenable to MRQAP: you're interested in predicting the presence or absence of an edge between two nodes on the basis of information about those nodes.
– Sycorax
Dec 7, 2015 at 20:53
• @user777, thanks for the idea. I know next to nothing about QAP; nonetheless, it sounds as though you may have an answer to post, below.
– JQKP
Dec 7, 2015 at 21:42
• I'll do what I can. I posted a comment rather than a full answer due to time limitations. If I have a moment, I'll provide a more complete reply. In the meantime, you might be interested in Statistical Analysis of Network Data, by Eric D. Kolzaczyk, particularly chapters 6 and 7.
– Sycorax
Dec 7, 2015 at 21:45