Formula and method
Start the renter with the down payment and buying costs they avoid. Each month, invest the difference for whichever option costs less. At the horizon, compare the renter portfolio with the owner portfolio plus home sale proceeds after selling costs and mortgage payoff.
Worked example
For a $12,000 home bought entirely with cash, no price growth or sale costs, $1,200 annual owner costs and $100 monthly rent, both options cost the same each month. With a 0% investment return and no buying fees, ending wealth is equal after one year.