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.)

  • 1
    $\begingroup$ 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. $\endgroup$
    – Hotaka
    Dec 7, 2015 at 18:43
  • $\begingroup$ @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. $\endgroup$
    – JQKP
    Dec 7, 2015 at 20:34
  • $\begingroup$ 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. $\endgroup$
    – Sycorax
    Dec 7, 2015 at 20:53
  • $\begingroup$ @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. $\endgroup$
    – JQKP
    Dec 7, 2015 at 21:42
  • $\begingroup$ 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. $\endgroup$
    – Sycorax
    Dec 7, 2015 at 21:45

1 Answer 1


Here is what I wound up doing. If I recall correctly (it's been a while), it was based on stuff I read in Statistical Analysis of Network Data by Eric D. Kolaczyk.

I created an undirected multigraph G, meaning its edges had no direction but any pair of vertices could have more than one edge. Its vertices were my subjects (the people in the example) and its edges were the pairings (the handshakes in the example). I found the number of edges between "like" vertices.

I then created a list of G's vertex degrees, and gave a name to each vertex. I added each of these vertices to a new graph H. I chose an arbitrary vertex u from that list (whose number on the list was positive), and then chose another vertex v randomly weighted by the number on the list. I subtracted 1 from the numbers on the list for u and v and added an edge to H for u and v. I repeated until all the vertices were exhausted. (If it turned out that one vertex was left, I rejected H and started over.)

I repeated this until I had 1000 different random. I then found, for each of those, how many edges were between "like" vertices.


Your Answer

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

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