Proceeds from a home sale could enable an older adult to live in a senior living community anywhere from less than a year to more than 22 years. It depends on where the home is located, among other factors, according to new research by senior living referral service A Place for Mom and national real estate brokerage Redfin.

Older adults who live in areas with higher home prices may be able to use home sale proceeds to afford more years of living in a private-pay senior community than those who live in less affluent areas, senior living researcher and data scientist Ben Hanowell noted in a blog for A Place for Mom. That’s because, geographically, senior living prices don’t vary as much as home prices.

“On average across cities and types of care, a median-priced home sale could fund nearly five years of senior living at a median cost of $50,000 per year nationally,” he wrote. The fewer services and less care needed, of course, the longer home sale proceeds will last.

Using data on median home sale prices and median senior living cost estimates and making some assumptions, A Place for Mom and Redfin performed calculations for 162 cities.

At the high end, proceeds from a home sale in San Francisco could pay for 22.1 years of independent living, 16 years in assisted living or 13 years in memory care, they found, even factoring in 3% annual growth in senior living costs. Proceeds from a home sale in Hartford, CT, on the other hand, would pay for 0.7 years of independent living, 0.5 years of assisted living or 0.4 years of memory care.