The U.S. housing market improved over the course of 2016. Home purchases are up, foreclosure activity is down, and interest rates are on the rise after the Federal Reserve hiked rates recently in response to favorable economic conditions — and will likely continue to do so.

Due in part to these developments, owning a home — for those who can afford the down payment — continues to be more affordable than renting in most of the United States. Despite the economic improvements, however, rents and home prices are rising faster than wages in most housing markets across the nation.

16. San Francisco, California

> Ownership as % of monthly wage: 89.4% of $3,636
> Rent as % of monthly wage: 54.3% of $3,636
> Home prices or wages rising faster?: HOME PRICES
> Rents or wages rising faster?: RENTS

Americans deciding whether to rent, buy, or move likely consider the timing and location of their potential home purchases. To highlight the regional patterns of the U.S. housing market, 24/7 Wall St. reviewed homeownership and rental affordability measures for over 500 counties nationwide, based on a comparison of regional monthly home payments and rents to average monthly wages.

The least affordable housing markets are not necessarily undesirable areas. In fact, high rental costs are often the result of strong demand. Rents rose by around 4% on average across the more than 500 counties reviewed. In most of the 25 least affordable areas, the year-over-year rent increase outpaced that average. In eight, rents rose by at least 15%.

In an interview with 24/7 Wall St., Daren Blomquist, senior vice president with property and real estate data company ATTOM Data Solutions, described rising rents as part of a vicious cycle. High home prices encourage more renting, which pushes up the demand and prices for rentals. Eventually, at high enough rental prices, buying becomes more attractive.

In most areas, especially the relatively unaffordable counties on this list, wages are also not keeping pace with rising rents and home prices. Rent or home price increases are outpacing wage growth in all but two of the 25 least affordable markets. For Blomquist, this trend is unsustainable. “Eventually, have to be supported by incomes,” he said.

It is also notable that 20 of the 25 least affordable housing markets are in either New York or California, and disproportionately in high income areas. In some of these areas, the affordability ratio exceeds 100%, meaning that even a person with an average wage would not be able to afford even the average housing unit. The pattern of slow wage growth with the already very high housing costs is ultimately unsustainable.

To identify the least affordable housing markets, 24/7 Wall St. reviewed home affordability and rental affordability for U.S. counties from an analysis by ATTOM Data Solutions of U.S. Department of Housing and Urban Development data. For the ranking, we calculated a weighted average of the homeownership and rental affordability measures in each county, weighted by the percentages of owner- and renter-occupied housing units. Home prices and wage data — used to determine whether home prices or wages or whether rents or wages are rising faster in each market — also came from ATTOM.

Rental affordability is median fair market rent for a three-bedroom property as a percentage of the average monthly wage (based on average weekly wages). Home buying affordability is the monthly house payment for a median-priced home (based on a 3% down payment and including mortgage, property tax, homeowner’s insurance and private mortgage insurance) as a percentage of the average monthly wage.

Click here to see the America’s 25 least affordable housing markets.