ESSAYS ON THE HOUSING AND MORTGAGE MARKETS