I did a similar calculation recently because we are going to move to a bigger house and sell/rent our current house. I was curious what the net cost of the current house was (we have lived here for 39 months).
The purchase price of the house was $175,000 and cash to close was $37,000 (down payment plus whatever taxes and so on). The mortgage payment, including taxes and insurance, is $1150 per month. HOA is 100 per month. We have redone 1 bathroom ($2200) and replaced 2 appliances ($800). We will need to do a few cosmetic things before we rent or sell, like paint, carpet, tile in another bathroom. I'll estimate $3000 for that. We've paid ~5000 early towards the mortgage and the balance is 108,000. Conservatively, I'll estimate that we will receive $170,000 at sale, net of all taxes and fees.
So our costs have been:
37,000 cash to close
1150*39 = 44,850 monthly payments
100*390 = 3900 HOA dues
2200 + 800 = 3000 upkeep which would be responsibility of a landlord
3000 repairs to rent or sell
5000 early mortgage payments
96,750 total expenses. I'm not counting utilities etc because we would have paid those as renters.
Estimated cash to us after sale is 170k, less 108k to pay off the mortgage, leaving us with 62k.
So the net cost of living here for 39 months is 96,750-62,000 = 34,750, or $891 per month.
You can compare that to the rent we were paying previously ($1120 per month) or to the approximate rental value of this house ($1600 per month). So we come out ahead by $8,931-27,651, depending on how generous you feel. And that's for a duration of only 39 months; odds are very good that for a longer duration of residence the numbers would come out better.
In fact, the more I think about it, the more I'm inclined to convert to a rental rather than sell this house, both to avoid paying the steep fees and taxes associated with sale and because the math sure looks better from the landlord's side than from the tenant's...