Bay Area residents rank high in quality of life, a measurement of how they say they feel physically and mentally, according to the University of Wisconsin Population Health Institute and the Robert Wood Johnson Foundation.

The nine Bay Area counties all ranked in the top 20 among the 58 counties in the state in 2018. Three — Marin, San Mateo and Santa Clara — are in the top five.

Here’s how each Bay Area county ranks statewide:1. Marin — 22. San Mateo – 3 3. Santa Clara – 44. Sonoma – 75. Napa – 86. San Francisco – 97. Contra Costa – 158. Alameda – 199. Solano – 20The quality-of-life measurement consists of four elements: percentage of adults reporting fair or poor health; the average number of physically unhealthy days reported in the last 30 days; the average number of mentally unhealthy days in the last 30 days; and the percentage of babies born at a low birth weight.

The good feelings of Bay Area residents are generally a reflection of the region’s prosperity, according to Mary Pittman, president and CEO of the Public Health Institute.

“We always say that ZIP code is an important predictor of health — and that’s because communities with higher incomes can access and afford top-notch schools and hospitals,healthy foods and healthy homes, and parks and recreation sites — all factors that support good health.”

But, she added, while the the Bay Area has seen an influx of jobs and money, thousands of people with fewer resources have been priced out or pushed out of the region or are living on the margin and on the streets.

So the Bay Area’s high quality-of-life ranking ”does not mean that health for people at all income levels have improved,” she said.

SourceUniversity of Wisconsin Population Health Institute and the Robert Wood Johnson Foundation; Public Health Institute