Essays on the economics of housing markets