I have table with user purchase events. I want to create a co-occurence matrix to compute loglikehood ratio using the formula mentioned here. I am first trying to create the 2X2 table: Can some help with the calcuation. Below is sample data. How do I create 2X2 co-occurence table for item 1&3(I have a table below. Want to validate if it is correct)
user_id,item_id
1,3
2,4
3,4
2,3
3,2
1,1
2,1
user_id, item_id
1, {1,3}
2, {4,3,1}
3, {2,4}
Item to Item co-occurence output(I want to confirm if this is correct)
purchased item both 1 & 3 : 2
purchased item 1 but not 3 : 0
purchased item 3 but not 1 : 0
neither item 1 or 3 : 5
| 3 |not3
---------------
1 |2 |0
not1 |0 |5