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, according to the researchers.

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," said Goetz. "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.

Tighter knit communities also were happier, according to the study. People who live in communities with strong ties -- or high social capital -- have better general wellbeing and can rely on a network of support to help when stresses do arise.

"The more supported you are by the community, the happier you are, and the better you are able to cope with troubles," said Goetz, who worked with Meri Davlasheridze, assistant professor of marine sciences, Texas A&M and Yicheol Han, postdoctoral scholar in agricultural economics and regional economics, Penn State.

While the negative effects of income inequality are receiving more attention from economists lately, Goetz said that if community leaders are concerned with improving mental health, they should try to reduce poverty rather than attempt to manage income equality.

"When you live in poverty you might not care about how well-off your neighbors are, you just want to get out of poverty," said Goetz. "The research doesn't suggest that income equality doesn't matter, but it does indicate that the sting of actual poverty is far worse."

To gather information on poor mental health days, the 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.

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.

"As economists we talk a lot about financial costs, but often don't consider the high personal costs that are incurred in some of these communities, including those associated with drug abuse and crime," said Goetz. "It's gut wrenching to hear stories of how substance abuse has hurt people and destroyed families and we're eager to work with the Substance Abuse and Mental Health Services Administration of the Department of Health and Human Services to research the problem and find ways to help these communities."