I have done my math and it points to the fact that if one is disciplined enough to invest each month in the stock market the equivalent of what they would pay in mortgage; they would eventually come out ahead.
Let me illustrate.
Sam and Tim both have the ability to invest Kshs 50,000 per month.
Sam takes out a morgage which eats into the entire Kshs. 50,000 each month.
Tim invests Kshs 30,000 each month without fail and rents for Kshs. 20,000.
With Real Estate appreciating only single digit figures over the longterm whereas stocks appreciate by double figures. I can bet you that if Tim remains disciplined, he will own stocks worth much more than Tim's house in the long term.
My 2 cents attached the following image(s):

buyrent.jpg
(6kb) downloaded 7 time(s).