Philadelphia remains the unhealthiest county in Pennsylvania, according to the latest annual rankings, though it has improved substantially in its rates of smoking, violent crime, and premature death.

Chester County ranked as the state's healthiest county, a status that, like Philadelphia's, is strongly linked to social and economic factors.

Bucks and Montgomery Counties also made the top 10 in the analysis, commissioned by the Robert Wood Johnson Foundation, and Delaware County slid a few places to 41st out of the 67 counties.

In New Jersey, Burlington County ranked 11th out of the 21 counties, Gloucester County 13th, and Camden County 18th. Cumberland County finished last and Salem County was right above it; affluent Hunterdon County was first.

The analysis, performed by the University of Wisconsin, looks at five major health outcomes - premature death and four general measures of sickness - along with 25 "health factors" that contribute to them. Those include the rates of child poverty, teen pregnancy, violent crime, smoking, and obesity.

Philadelphia has been last in the state in overall health outcomes every year since the rankings were first issued, in 2010, yet the city's rate of premature death has dropped 13 percent since then. Premature deaths are defined as those occurring before age 75, and the rate is calculated as the total number of years of "potential life lost" per 100,000 people.

Many socio-economic factors that contribute to poor health are beyond the reach of public health departments, said James Marks, director of the health group at Robert Wood Johnson, a Princeton philanthropy devoted to public health.

Equally key are efforts to create jobs and improve graduation rates, he said. "It's not just the health departments," he said. "It is, in fact, what the business community can do, what schools can do with regard to high school graduation, what social service agencies can do."

Nevertheless, health departments are doing all they can to combat problems within their purview, such as smoking, obesity, and sexually transmitted disease, Philadelphia Health Commissioner Donald F. Schwarz said.

"We're not so daunted that we think we can't do anything," Schwarz said.

He said the city might be doing even better in some areas than was reported. For example, the analysis found the city's rate of adult obesity had risen this year. But a recent broader survey by the Public Health Management Corp. found a slight drop, Schwarz said.

Improvements might be even greater if the state were to increase spending on public health in Philadelphia rather than cut it, as has happened in recent years, the commissioner said.

As in Philadelphia, Delaware County had a decline in its rate of premature death, though its overall "outcomes" ranking slipped as other counties improved.

Residents would be healthier if the county established a public health department, said Rosemarie Halt, chair of a local group advocating for that goal. Philadelphia and the other three suburban counties all have health departments.

"They're able to really monitor and target the areas more effectively than we would in Delaware County," Halt said.

That was disputed by George Avetian, a family physician in Upper Darby who serves as the county's senior medical adviser.

The county accomplishes much with its Department of Intercommunity Health, and collaborates with partners such as Independence Blue Cross to offer health screenings and education sessions. Delaware County also benefits from having a state health center in Chester, Avetian said.