Detroit has long endured abandonment. Even before Big Auto fled, before oil crises and globalization turned factories into rust, white families were already packing up for the suburbs. The population peaked some time in the 1950s, when there were 1.85 million residents, four-fifths of them white. Detroit these days is less than half that size, and four-fifths black.

The city continues to shrink. Between 2000 and 2010, Detroit lost another quarter of its population. The city’s remaining residents have retreated to less-blighted blocks, leaving poorer neighborhoods riddled with vacant houses.

The pattern is one that economists Veronica Guerrieri, Daniel Hartley and Erik Hurst call “reverse-gentrification.” When a city shrinks, the slums hollow out and people crowd in around the nicer neighborhoods. (If everyone left New York, wouldn’t you want to live off Central Park?) Detroit is a particularly stark example of how a declining city evaporates from some spots as it condenses in other areas.

One of the happier neighborhoods isn’t even technically part of Detroit. Hamtramck is a separate city contained entirely within Detroit’s borders. Unlike the rest of Detroit, Hamtramck is getting younger, which is a sign that families want to live there. In 2000, the median age in both cities was about 31. By 2010, Hamtramck’s median was 29, and it had 700 more children than it did in 2000. Detroit’s median age had risen to 35, and it had 100,000 fewer children.

The area owes part of its success to the nearby GM plant, which assembles the Chevy Volt. But immigrants are also part of the story. Over 40 percent of Hamtramck residents were born in a different country, and what was once a Polish enclave is now home to Bangladeshis, Iraqis, Serbians, Croatians and so on. Some see the foreign-born as the town’s salvation. Latino immigration has contributed to the growth of a lively neighborhood in the southwest called Mexicantown. Earlier this year, Michigan Gov. Rick Snyder proposed a special visa program for 50,000 people to settle in Detroit.