People who live in unhappy communities spend about a quarter of the month down in the dumps, according to a recent study.

Researchers from Penn State University found that residents in the community with the poorest mental health on average reported they spent 8.3 days a month in a negative mood. People in high mental health areas reported they were in poor mental health only a little less than half of a day each month. Sometimes they are so far down in the dumps that it can harm their productivity.

"This is a real concern not just in the United States, but across the world," Stephan Goetz, researcher and professor of agricultural economics and regional economics, said in a statement. "Poor mental health can result in considerable economic costs, including losses of billions of dollars to lower productivity and this doesn't even include the staggering personal costs of negative mental health and depression."

For the study, researchers studied census data and information from the Behavioral Risk Factor Surveillance System, a telephone survey that includes information on how many days in a month participants would describe their mental health as poor. Because the recent economic downturn could skew the mental health figures, the researchers used information from 2002 to 2008, a period before the recession.

The researchers also used information from the Economic Research Service of the U.S. Department of Agriculture and the U.S. Census.

Goetz said that suburban residents seem to be the happiest, compared to those who live in rural areas and inner cities. After controlling for certain conditions, such as commute time, people who lived in suburbs tended to report the fewest poor mental health days, according to the researchers, who report their findings in the online version of Social Indicators Research. Places where people felt more connected with the community also reported fewer poor mental health days.

"People who live in the suburbs are closer to jobs and all of the amenities that a big city can provide, but they're also far enough away from the stress of the inner city," Goetz said. "It may be that you don't want to be too close to people, but you don't want to be too far away either."

Another important result was that people facing longer commutes experienced significantly more poor mental health days, regardless of whether they lived in a suburb, rural area, or inner city, according to Goetz.

Future research may look at how improving the economic conditions and cohesion of a community could lead to more optimistic residents as an approach to curb drug and alcohol abuse in communities.

The findings are detailed in the online version of Social Indicators Research.