When the outside environment is attractive, apartment living is glorious. When the outside is gnarly (e.g. no amenities, bad neighbors, ...), apartment living is hell.
There's a weird tipping point, where all the negatives of living in an apartment evaporate. But it's hard to put it into numbers. You just "know", experience it.
Similar for houses, there's a weird tipping point where all the negatives of a home just congeal, and it's a drag and anchor, and the house starts to own you more than the other way around.