Facebook’s algorithm can tell whether you take drugs or not — even if you don’t post about your extracurricular activities. According to a new study, the social network’s can figure out if you drink or do drugs, based solely on likes and status updates.

The study was conducted by researchers at USC Berkeley who analyzed the activities of 11 million Facebook users, as well as an extra 22 million status updates from 150,000 people. The scientists used a machine-learning software that...