The app logo for Twitter.

This Twitter algorithm can predict if users are mentally ill

Mental illness is a concerning crisis. More and more people are gradually becoming aware of its prevalence and debilitating effects. Unfortunately, the stigma surrounding mental health issues, or any frank discussion of the subject, has always held us back as a society and left those afflicted by mental sickness largely marginalised by medical professionals and the general public. Things are only just beginning to change, but we still have a way to go before we can stamp out shaming completely. Scratch beneath the surface and you'll find that a lot more people are suffering than you might have otherwise assumed.

For instance, according to studies conducted by the National Alliance on Mental Illness, nearly 20 per cent of adults in the United States - some 43.8 million people - will experience at least one form of mental illness every year on average. Moreover, the stats for children and youths are just as alarming. Approximately 21.5 per cent of adolescents between the ages of 13 to 18 will experience a severe mental disorder at some point, and 13 per cent of children aged 8 to 13. The worst part? Those are just the figures for those people who have been conclusively diagnosed. There are even more people out there who will never have their mental malady formally identified by a doctor.

A number of antidepressant and antipsychotic drugs. Credit: Negative Space

But the cost that mental illness bears, both financial and emotional, is staggering. The same NAMI study also determined that serious mental illnesses cost America $193.2 billion in lost earnings per annum and that America's already-overstretched healthcare system is struggling to cope with the shocking number of people who have been admitted to hospital as a result of mental problems. Additionally, many Americans are unable to afford healthcare insurance, meaning that these mental problems remain ultimately untreated.

The situation is little better in the United Kingdom, a nation which does boast free healthcare. In Great Britain, austerity measures and public service cuts have left the National Health Service in dire straits and last year thousands of doctors around the country went on strike to protest being overworked and underpaid. Under these conditions, where patients can expect to wait months, or even years to receive cognitive behavioural therapy and other forms of treatment, is it any wonder that so many people are subjected to inadequate psychiatric care long after they should have been diagnosed? Quick and early diagnoses are utterly necessary, yet they remain elusively uncommon.

The good news is that scientists have managed to develop an unconventional solution, in the form of a digital doctor which can assess mental health over social media. This computerised shrink never sleeps, doesn't need to be paid and can give almost anyone a quick and accurate consultation eventually. It's all thanks to a new Twitter algorithm. Pretty amazing huh?

The Twitter logo on a computer monitor. Credit: Getty

Researchers from Harvard University, Stanford University and the University of Vermont collaborated on the project, which collected data and details of depression from 204 individuals using Twitter. Of these 204 people, 99 had no previous or current history of mental illness and 105 had suffered or were suffering from a mental illness. The scientists then employed a bespoke supervised learning algorithm that they had personally designed. This algorithm analysed certain keywords and word choices, as well as the sentence structure and syntax, of mentally ill people.

Eventually, the program was capable of finding language that indicated symptoms of mental illness and was able to apply this knowledge proactively in order to forecast which Twitter users were mentally unwell and which were neurotypical. The program discovered that depressed individuals employed negative words such as "no", "never", and "death" in their tweets, and words which had a positive association, like "happy" and "photo". The algorithm was also capable of detecting symptoms of depression in the subject approximately 100 to 200 days before they were clinically diagnosed.

The same algorithm was also applied to Twitter users to determine whether it could detect who was suffering from PTSD. The algorithm eventually managed to predict PTSD in Twitter accounts approximately 90 per cent of the time, according to a screening characteristic known as positive predictive value. By comparison, an average doctor can only expect to boast a PPV of around 50 per cent.

A doctor's stethoscope resting next to a smartphone. Credit: Negative Space

Commenting on their findings, researcher Chris Danforth, from the University of Vermont, stated that: "We recruited individuals who were active on social media, and had been diagnosed by a psychiatrist as having depression or PTSD. Using a subset of their tweets, we trained an algorithm to identify differences between their behaviour and that of a control population on Twitter who had not been diagnosed. Our main finding is that there are predictive markers distinguishing the two groups, and this is often true well before individuals are first diagnosed with these mental health problems."

Fellow-researcher Katharina Lix concurred, stating: "We hope that our research will eventually help improve mental health care, for example in preventive screening. We could imagine clinicians using this technology as a supporting tool during a patient’s initial assessment, provided that the patient has agreed to have their social media data used in this way. We want to emphasise that any real-world application of this technology must carefully take into account ethical and privacy concerns."

We often hear people decry the role of Twitter when it comes to modern communication, with some critics of the social media tool claiming that it provokes division, sows poor debate and encourages political echo chambers, fake news, online shaming and mob rule. Yet this experiment proves that, properly harnessed, it has the potential to act as a profound tool to improve overall quality of life.