Essays on the macroeconomics of housing markets