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).
Deze oefening maakt deel uit van de cursus
Quantitative Risk Management in Python
Oefeninstructies
- Import the
statsmodelsAPI. - Add an intercept term to the regression.
- Use OLS to fit
port_q_mintomort_del. - Extract and display the sum-of-squared residuals.
Praktische interactieve oefening
Probeer deze oefening eens door deze voorbeeldcode in te vullen.
# 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)