Twitter Posts May Reveal Onset of Depression

And machine learning may be able to spot it before anyone else.

Here’s a phrase that psychiatrists will either love or hate: “State-space temporal analysis suggests that onset of depression may be detectable from Twitter data several months prior to diagnosis.”

Indeed, a team of researchers from the University of Vermont, Stanford, and Harvard found that depression and post-traumatic stress disorder (PTSD) can often be detected by applying machine learning to individuals’ Twitter feeds. The algorithms can also detect signs of the conditions long before a human doctor typically does.

Existing work on the topic informed the study’s predictive dimensions. The project examined affect, linguistic style, and context of hundreds of thousands of tweets from hundreds of users. Occurrence of negative terms like “death” and “never” as opposed to positive ones like “happy” factored into the analysis, as did tweet frequency, word count, and context.

The study recruited 105 patients with clinically diagnosed depression, alongside 99 healthy controls. The separate PTSD group featured 63 diagnosed participants and 111 controls. The high comorbidity of the conditions allowed researchers to use similar predictors in both arms of the study, which was published last month in Scientific Reports.

The team, led by Harvard’s Andrew Reece, chose to only evaluate tweets that predated clinical diagnosis of the conditions. This is because, they wrote, “individuals diagnosed with depression often come to identify with their diagnosis, and subsequent choices, including how to portray oneself on social media, may be influenced.”

A supervised learning algorithm discriminated between affected and healthy individuals, and a 2-state Hidden Markov Model (HMM) detected changes in user behavior over time.

In both the depression and PTSD cohorts, the methodology correctly predicted about 90% of diagnoses, far outperforming human physicians in reference studies. The language assessment by Mechanical Turk (labMT) tool, which gauges the relative “happiness” of chosen words, proved to be the strongest predictor. Researchers attributed that to labMT’s vocabulary, consisting of the 5,000 most commonly used words on Twitter, slang included.

The HMM insights showed probability of the conditions over time. Patients later diagnosed with depression showed slightly increased probability as early as 9 months before diagnosis, while healthy controls maintained low probability over 18 months. The HMM also showed that post-diagnosis, probability numbers began to wane in a trajectory that “matches closely with average improvement time frames observed in therapeutic programs.” In PTSD patients, tweet deviations from healthy controls began to reflect within months of the traumatic event, with probability also rising months before diagnosis.

The authors wrote that the HMM findings were intriguing and should be approached “with both optimism and caution.” Although the model quickly parsed the content generated by healthy or affected individuals, the team cautioned that HMM are unsupervised learning models that need to be validated.

“Our findings strongly support the claim that computational methods can effectively screen Twitter data for indicators of depression and PTSD,” the researchers wrote of their work, which they positioned as “accessible, accurate, and inexpensive” means of improving depression and PTSD screening practices.

Reece and his co-authors called the study’s predictive timeline “impressively realistic, given that it was generated analyzing only the text of 140-character messages.” But the algorithms will have a lot more to work with in future studies: Yesterday, Twitter officially doubled message length for all users.