Related Content

The researchers collected location data from more than 50 million tweets that contained words related to the flu, like coughing and vomiting. The data gave the researchers an idea of early flu activity around the country.

"The initial conditions of an epidemic are very important. To make an analogy, you need to know where a hurricane is to reflect its future path," Alessandro Vespignani, a professor at Northeastern and a coauthor of the paper, told CNNTech.

"We could have more [cases] in Texas than in Michigan or vice versa ... We want to know the areas with the largest activity," he said.

The tweets are used to predict the amount of flu cases and the virus's peak. They also provide information about the flu itself, such as whether it's more contagious than in past years. The researchers say their model is the first to simulate the entire population of the United States.

Over two flu seasons, the researchers found that their model reliably predicted the number of cases and the spread of the virus six weeks in advance when compared to traditional systems for monitoring the flu.

The new method could help public health agencies plan ahead to distribute medical resources. They could also start campaigns earlier to encourage people to get a flu shot or take other preventative measures.

The flu season starts in the fall, and usually peaks between December and February, although it can last as late as May. Between 5% and 20% of the U.S. population gets the virus each year.

During the 2015-2016 flu season, there was an estimated 25 million cases and 310,000 flu-related hospitalizations in the United States, according to the Centers for Disease Control and Prevention.

Twitter is a good way to forecast the flu and other infectious diseases, according to Vespignani. "[With Twitter], you get the data right at the very moment and it has very accurate localization of the data," Vespignani said.

This isn't the first time social media has been used to help track the flu.

In 2013, the CDC launched the "Predict the Influenza Season Challenge," a competition that encouraged researchers to use social media to predict the flu, which the Northeastern team has participated in.

Researchers at Johns Hopkins University and the University of Rochester have developed other methods of using Twitter to track the flu.

Google's Flu Trends looked at how the flu could be modeled using patterns in search data. However, in 2015 it decided to stop publishing current estimates.