I have a large co-occurrence network where nodes refer to word terms. We create a relation between "Term 1" and "Term 2" if both terms co-occur in the same sentence. For each pair we also have co-occurrence frequency (i.e., number of sentences where pairs occur).

Now I want to calculate which pairs occur together more often than by chance. We can do that by applying Pearson's chi-square test for independence. I briefly outline the approach which is common in computational linguistics. For each pair of terms we create contingency table, as demonstrated in Table 1.

Table 1

$U$ in Table 1 refers to word term $u$ and $V$ refers to word term $v$. $O_{11}$ is the joint frequency of the co-occurrence, the number of times the terms in a co-occurrence are seen together. The cell $O_{12}$ is the frequency in which "Term 1" occurs in the first position, but "Term 2" does not occur in the second position. Likewise, the $O_{21}$ is the frequency in which "Term 2" occurs in the second position of the co-occurrence but "Term 1" does not occur in the first position. The cell $O_{22}$ is the frequency in which neither "Term 1" nor "Term 2" occurs in their respective positions in the co-occurrence.

Next we calculate the corresponding expected frequencies $E_{ij}$ for each table cell, as demonstrated in Table 2.

Table 2

Given the observed and expected frequencies for each pair, the $\chi^2$ statistic is calculated as \[ \chi^2 = \sum_{i=1}^{2} \sum_{j=1}^{2} \frac{\left(O_{ij} - E_{ij}\right)^2}{E_{ij}}. \]

To make long story short, if the $\chi^2$ is greater than the critical value, we can conclude that a particular pair occurs more often than by chance.

My question. The approach described above is suitable only when we consider the order of the terms in the sentence (e.g., pair »Term1 – Term2« is not equal to pair »Term2 – Term1« because in the first case »Term1« occurs in the first position while in the second case »Term1« occurs in the second position in the sentence. This situation is reflected by cells O12 and O21 in Table1). So, my question is, how to modify the presented approach if we don't want to consider the order (direction in terms of network anlysis) of the co-occurrence. Any pointers are greatly appreciated.


1 Answer 1


The described approach does not consider the order of the terms. The cell $O_{12}$ refers to the occurrence of $u$ without $v$, and $O_{21}$ viceversa.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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