Well-being captures the happiness of individuals. Happier workers are often more productive, and a healthy economy can improve the well-being of residents. Measuring well-being is a complex process, and the well-being of populations varies tremendously across the United States.

24/7 Wall St. reviewed polling company Gallup’s 2015 Healthways Well-Being Index, which measures the well-being of Americans in each metropolitan statistical area based on interviews conducted over the last two years. The index incorporates a range of metrics grouped into five essential categories: the purpose, social, financial, community, and physical elements of well-being. We examined the metro areas with the highest and lowest scores alongside a range of other social and economic measures.

In an interview with 24/7 Wall St., Dan Witters, research director at Gallup-Healthways Well-Being Index, said, “Cities are good for well-being.” There is a tradeoff, however. Largely due to the high density of urban areas, residents are more vulnerable to disease and tend to feel less secure compared to their counterparts in more rural areas. While, on the whole, cities are perhaps better places to find happiness, some are far better than others.

Residents of the Naples-Immokalee-Marco Island metro area in Florida and of the Salinas, California area are tied as the happiest in the United States. Charleston, West Virginia, residents, on the other hand, have the lowest well-being score.

46. Miami-Fort Lauderdale-West Palm Beach, FL

> Poverty rate: 17.2%
> 2016 unemployment rate: 5.2%
> Adult obesity rate: 21.6%
> Violent crimes per 100,000: 595.2

Gallup’s index is based primarily on subjective survey measures. Self-assessments of well-being and the underlying social and economic outcomes are not necessarily in perfect alignment, but they are very closely tied to one another. “You absolutely find very robust relationships between subjective well-being the way we measure it, and these other more objectively derived statistics that come from government agencies,” Witters said.

The cities with the lowest well-being tend to have higher unemployment rates, lower incomes, and worse health outcomes, while the opposite tend to be true in the cities with the highest well-being.

Median household incomes exceed the national median of $53,657 in 18 of the 25 cities with the highest well-being scores. At the other end, in all but one of the 25 cities with the lowest well-being scores median household incomes are below average.

The relationship between well-being and these more objective factors is a two-way street. Witters explained that businesses, for example, benefit from happier employees, while businesses with unhappy employees often incur unseen costs. People with high well-being are less likely to miss work and less likely to search for other jobs and leave — by choice, or involuntarily. Happier workers also have fewer accidents on the job and utilize less health care, Witters noted.

Health is another major component of well-being. One of the most important healthy behaviors common among happy individuals, according to Witters, is going to the dentist. In areas with the highest well-being scores, dentists are far more concentrated than in low well-being metro areas. Oral health is among the many factors contributing to good health.

To determine the happiest and most miserable cities, 24/7 Wall St. used the Gallup-Healthways Well-being Index. Gallup’s results are based on nearly 354,000 telephone interviews conducted between January 2014 and December 2015. To supplement each city’s index score, we considered income and poverty statistics from the U.S. Census Bureau’s 2014 American Community Survey (ACS). Also from the ACS, we included the share of households that receive food stamps, educational attainment rates, and the share of the population without health insurance. Violent crime rates came from the Federal Bureau of Investigation (FBI) and are as of 2014. From the Bureau of Labor Statistics (BLS), we looked at unemployment rates for January 2016, the most recent rates available for metropolitan areas. Regional price parity — a proxy for the cost of living in each area — is from the Bureau of Economic Analysis (BEA) and is as of 2013. All other data were aggregated from the county level using data from County Health Rankings & Roadmaps, a Robert Wood Johnson Foundation and University of Wisconsin Population Health Institute joint program.

Click here to see the happiest cities in America.

Click here to see the most miserable cities in America.