Crisis structural break: II
The video identified a structural break for a simple relationship between population size and time in China. In this and the following exercise you'll use the richer factor model relationship between portfolio returns and mortgage delinquencies from Chapter 1 to test for a structural break around 2008, by computing the Chow test statistic for the factor model.
First, after importing the statsmodels
API, you'll run an OLS regression for 2005 - 2010, with quarterly minimum returns port_q_min
as the dependent variable, and mortgage delinquencies mort_del
as the independent variable (plus an intercept term).
Take note of the sum of squared residuals ssr_total
from the regression result
(this will be provided in the next exercise to help derive the Chow test statistic).
This exercise is part of the course
Quantitative Risk Management in Python
Exercise instructions
- Import the
statsmodels
API. - Add an intercept term to the regression.
- Use OLS to fit
port_q_min
tomort_del
. - Extract and display the sum-of-squared residuals.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Import the statsmodels API to be able to run regressions
import ____.____ as sm
# Add a constant to the regression
mort_del = sm.____(mort_del)
# Regress quarterly minimum portfolio returns against mortgage delinquencies
result = sm.____(port_q_min, ____).fit()
# Retrieve the sum-of-squared residuals
ssr_total = result.____
print("Sum-of-squared residuals, 2005-2010: ", ssr_total)