I wondered about this problem too, so I looked into the maths and made this demo.  (It needs auto download of Wolfram computable document format (CDF) Player.) :-

https://www.facebook.com/mortgagedilemma

If you try it out you can see what conditions favour renting vs buying.  My own conclusion was to aim to buy a property outright upon reaching retirement age, if not sooner.

**Edit**

The app is under the Welcome section:

https://www.facebook.com/mortgagedilemma/app_190322544333196

It uses the free Wolfram CDF Player :

http://demonstrations.wolfram.com/download-cdf-player.html