Falling housing prices and underwater mortgages
Unfortunately, you are also well aware that home prices don't always rise.
An underwater mortgage is when the remaining amount you owe on your mortgage is actually higher than the value of the house itself.
In this exercise, you will calculate the worst case scenario where home prices drop steadily at the rate of 0.45% per month. To speed things up, the cumulative drop in home prices has already been forecasted and stored for you in a variable called cumulative_decline_forecast
, which is an array of multiplicative discount factors compared to today's price - no need to add 1 to the rate array.
The outstanding principal on the mortgage is available as principal_remaining
.
This exercise is part of the course
Introduction to Financial Concepts in Python
Exercise instructions
- Forecast the home value over time using a simple operation between the
cumulative_decline_forecast
array and the initialhome_value
. - Calculate where the mortgage is
underwater
at each time period, storing an array of boolean values when the condition is true or false. - Run the existing code to plot the home value vs. principal remaining over time.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
import numpy as np
import pandas as pd
# Cumulative drop in home value over time as a ratio
cumulative_decline_forecast = np.cumprod(1+decline_array)
# Forecast the home value over time
home_value_forecast = ____
# Find all periods where your mortgage is underwater
underwater = ____
pd.value_counts(underwater)
# Plot the home value vs principal remaining
plt.plot(home_value_forecast, color='red')
plt.plot(principal_remaining, color='blue')
plt.legend(handles=[homevalue_plot, principal_plot], loc=2)
plt.show()