Children who grow up in the San Jose area are better off than those raised in almost any other metro region in the country, according to a new report measuring which U.S. neighborhoods give children the best chance of achieving lasting economic success and good health.

Nationally, the San Jose-Sunnyvale-Santa Clara metro ranked second among the top 10 metropolitan areas nationwide, just behind Madison, Wisconsin. The San Francisco-Hayward-Oakland area ranked 9th in the study conducted by Brandeis University.

But while Bay Area communities have some of the nation’s highest rankings for childhood opportunity, California also has areas like Fresno, Bakersfield, Stockton and Riverside with some of the lowest scores, a division researchers say stood out in their analysis. To define childhood opportunity, the study looked at a host of factors, including neighborhood poverty, employment, housing vacancy rates, air quality levels, and access to healthy food, schools and parks.

In fact, Bakersfield was designated the worst place in the nation for child opportunity, with more than 20 % of families living in poverty; 12% of workers commuting at least two hours each day, and nearly a quarter of public school teachers with less than three years of professional experience, according to the study. Life expectancy in very low opportunity neighborhoods in Bakersfield, the study found, is 6.2 years less than in very high-opportunity neighborhoods.

“California is fascinating because there is such inequity within the state,” says Dolores Acevedo-Garcia, director of Brandeis’ Institute for Child, Youth and Family Policy and co-author of the report. “The inequities within the state, it’s huge. It is remarkable that you have literally one of the best — San Jose — and the worst within the same state.”

In San Jose, the data indicated that the difference in conditions in very low and very high opportunity neighborhoods is less extreme than many other metro areas, suggesting a child raised amid economic insecurity in San Jose may fare much better than one raised in a different part of the state. The highest opportunity neighborhoods in the San Jose area earned the best possible score — 100 — while the lowest neighborhoods scored 37, a gap of 63 points. In Los Angeles, the gap between the highest and lowest scoring neighborhoods was 15 points higher. And in Fresno, it was 73 points.

“On average, you would prefer to be a poor child in the Bay Area than a poor child than in Los Angeles or the Central Valley,” says Acevedo-Garcia. “Being low-income in San Jose might carry better child outcomes than in Los Angeles.”

The findings underscore a unique duality in the Bay Area: despite being home to a significant housing affordability crisis and the highest level of income inequality in California, the region seems to distribute resources and opportunity for children more evenly than other places in the state.

“The really interesting question for us is: Why?,” says Acevedo-Garcia.

Nationally, the study also highlighted stark divisions along racial lines in access to opportunities. About 60% of African-American and Hispanic children in the U.S. are concentrated in low- or very low-opportunity neighborhoods, the study found, compared to about 20% of white and Asian children.

This article is part of The California Divide, a collaboration among newsrooms examining income inequity and economic survival in California