Context: I have an e-commerce application - so I have users and products. I'm trying to build an item-to-item recommendation system based upon user behavior. In particular I'm taking all the users' product view histories and for each product I'm listing out the products that cooccur with it and tallying up number of times that each one cooccurs. So if we have the following user product views: * user 1 viewed A, B, C, * user 2 viewed A, B, D, * user 3 viewed A, C, E, Then this would be to cooccurrence counts for each product: * A cooccurred with B twice, and C twice, and E once * B cooccurred with A twice, and C once, and D once * C cooccurred with A twice, and B once, and E once But the question I can't solve is "How significant is the number of times that A occurred with B? Can it be attributed to simple luck?" In particular, if A and B are both unpopular products but nevertheless A cooccurs often with B, then this is significant. However if A and B are both popular, then perhaps the cooccurrence can be attributed to chance. How can I establish a threshold for statistically significant cooccurrence between each pair of products? _[(see this related question)](https://stats.stackexchange.com/questions/178728/statistical-test-for-clumpiness-of-graph)_