I want to fit a regression on "unordered paired data", but I'm uncertain on how to code it. What I mean by paired data is the following:

The model looks like this:

$$o_i \sim \text{Binom}(1,p)\\ f(p) = \beta_0 + \beta_1 m_i + \beta_2 n_i + \beta_3 m_i n_i$$

And the data like this:

║  m  ║  n  ║ o      ║
║ xxx ║ yyy ║ 1      ║
║ xxx ║ aaa ║ 0      ║
║ yyy ║ aaa ║ 1      ║
║ ... ║ ... ║ ...    ║

Think of m and n as subjects and of o as coding whether they succeeded on a joint task. The issue is that columns m and n draw from the same pool of individuals. As a consequence, some subjects appear in column m in some rows but in n in others (as exemplified by subject yyy above). There is no way I can put all occurrences of an individual in the same column, but there's clearly something wrong in estimating $\beta_1$ and $\beta_2$ with data drawing from the same pool of subjects and - to make matters even worse - having some subjects influence both predictors.

I could merge the two columns and get something like

║  mn     ║ o   ║
║ xxx_yyy ║ 1   ║
║ xxx_aaa ║ 0   ║
║ yyy_aaa ║ 1   ║
║ ..._... ║ ... ║

and go for $f(p) = \beta_0 + \beta_1 mn_i$ but then I would not be able to estimate how much, say, xxx on her own contributes to outcome o.

In sum, my question is whether anyone has suggestions on how to code this data such that I can estimate the individual contribution of individuals to the outcome, as well as their interaction.

  • $\begingroup$ Do you have some other variables than the individuals in pairs? There is little scope for modeling without---and can you tell us the context, what is the practical situation? Can you have multiple independent observations with the same pair? One context where that would be impossible, is where the pair is a married couple, and the binary observation is if there is a rapid divorce (within some time interval), but what is your application? $\endgroup$ Commented Mar 3, 2020 at 14:55
  • 2
    $\begingroup$ Your model is overspecified: because the explanatory variables are unordered pairs, necessarily there is no distinction between one member and another. Thus $\beta_1=\beta_2$ is forced on you. This yields the model $f(p) = \beta_1(m_1+n_1)+\beta_3\,m_1n_1.$ That's straightforward to fit and analyze using familiar software for ordered pairs $(m_1+n_1, m_1n_1).$ $\endgroup$
    – whuber
    Commented Mar 3, 2020 at 15:35

1 Answer 1


I don't have time for a real answer no, but some hints/ideas. You have a set of individuals $X$. The set of ordered pairs from $X$ is the Cartesian product $X \times X$, and to get the set of unordered pairs from that we can quotient out by the equivalence relation $\sim$ given by $(x,y) \sim (y,x)$. Then the set of unordered pairs is the quotient $$ X \times X / \sim $$ So these ideas give you at least some search terms, one good friend will be Diaconis'. Search there for unpaired. Also look through this and this.


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.