Just to be clear, opportunity cost and maintenance / upkeep are both modeled and incorporated in the values you see on the buy vs rent chart.
There are also several components to the decision. Even if you give greater weight to the emotional rather than empirical factors (as many do), it is still prudent to make sure you can afford your home.