Staying at home and watching TV during a flu epidemic may actually reduce the spread of the disease, according to a new study of the 2009 "swine flu" epidemic.

Researchers analyzed the television-viewing habits of people in central Mexico during spring 2009, when that year's H1N1 flu epidemic began.

At that time, officials in Mexico City implemented measures to reduce people's contact with one another (a public health strategy called "social distancing"). They closed public schools and canceled large public events. The researchers used television viewing to estimate the population's amount of social contact — when people are watching TV, they are generally at home, and thus have limited contact with others.

In the first week after the city's social-distancing measures were put into place, television viewing in Mexico City increased to 20 percent above average, the study found. The increase was greatest for children and those with higher incomes, compared to other groups. [5 Scariest Disease Outbreaks of the Past Century]

The researchers also modeled what would have happened if people had not changed their behavior at all during the epidemic (meaning they had not taken measures to distance themselves from others). In this scenario, new flu cases would have more than quadrupled over about five weeks. But in reality, cases in Mexico City stabilized, and then decreased within that time period, the study found.

"The swine flu outbreak that hit Mexico City in April 2009 could have been worse, but spread of the virus was reduced by people's behavioral response of distancing themselves from each other," Michael Springborn, an economist at the University of California, Davis, said in a statement.

However, the researchers also found that there may be a limit to how long people are willing to stay cooped up at home, even during a flu epidemic. During the second week after schools were closed in Mexico City, television-viewing habits started to drop down from their initial high, and returned to normal around the same time that schools opened again, in mid-May.

"This suggests that efforts to utilize social distancing to mitigate disease spread may have a limited window of efficacy," Springborn said. After that, pent-up demand for activities outside the home may take precedence.

However, it's possible that people turned off their TVs but were still at home during this time period, doing other activities, the researchers said.

The study is published today Jan. 22 in the journal BMC Infectious Diseases.

Copyright 2015 LiveScience, a TechMediaNetwork company. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.