When looking for a home, figuring out whether to rent or buy can be tricky. There are many factors at play and trying to time the housing market is difficult.

However, there are mathematical ways to evaluate each city, so you can make an informed decision.

HomeArea.com today released the Cities in Arizona that are Better to Buy than Rent.

Based on the latest Census Bureau data for cities with a population of 60,000 or more, the rankings were determined by calculating the price to rent ratio.

The price to rent ratio is the median home value divided by the median annual rent and served as a benchmark for understanding whether it is better to rent or buy in an area.

When home prices rise significantly faster than the local rents, the ratio will rise – indicating a possible housing bubble where it may be better to rent.

A ratio under 20 are likely more affordable to buy, and a ratio over 20 are better to rent.

Here is a list of cities that are better to buy than rent

1. Yuma, AZ 16.7

2. San Tan Valley, AZ 17.4

3. Tucson, AZ 18.1

4. Surprise, AZ 18.2

5. Casas Adobes, AZ 18.2

6. Avondale, AZ 18.9

7. Buckeye, AZ 19.1

8. Peoria, AZ 21.2

9. Tempe, AZ 21.3

10. Mesa, AZ 21.7

11.  Chandler, AZ 21.9

12. Glendale, AZ 22.1

13. Gilbert, AZ 22.2

14. Phoenix, AZ 22.6

15. Goodyear, AZ 22.7

16. Flagstaff, AZ 25.0

17. Scottsdale, AZ 33.0