Crisis structural break: III
Now you can put everything together to perform the Chow test.
The 2005 - 2010 data have been split into two available DataFrames, before and after, using June 30, 2008 as the structural break point (identified in the first exercise in this series). The columns of both DataFrames are mort_del and returns for mortgage delinquency data and returns data, respectively.
You'll run two OLS regressions on before and after, regressing the returns column against the mort_del column in each DataFrame, and derive the sum-of-squared residuals.
Then you'll compute the Chow test statistic as in the video, using ssr_total (provided from the second exercise) and the derived residuals. The critical F-value at 99% confidence is around 5.85. What value do you find for your test statistic?
Diese Übung ist Teil des Kurses
Quantitative Risk Management in Python
Anleitung zur Übung
- Add an OLS intercept term to 
mort_delforbeforeandafter. - Fit an OLS regression of the 
returnscolumn against themort_delcolumn, forbeforeandafter. - Place the sum-of-squared residuals into 
ssr_beforeandssr_after, forbeforeandafter, respectively. - Create and display the Chow test statistic.
 
Interaktive Übung
Vervollständige den Beispielcode, um diese Übung erfolgreich abzuschließen.
# Add intercept constants to each sub-period 'before' and 'after'
before_with_intercept = sm.____(before['mort_del'])
after_with_intercept  = sm.____(____['mort_del'])
# Fit OLS regressions to each sub-period
r_b = sm.____(____['returns'], before_with_intercept).____
r_a = sm.____(after['returns'],  after_with_intercept).____
# Get sum-of-squared residuals for both regressions
ssr_before = r_b.____
ssr_after = ____.ssr
# Compute and display the Chow test statistic
numerator = ((ssr_total - (ssr_before + ____)) / 2)
denominator = ((____ + ssr_after) / (24 - 4))
print("Chow test statistic: ", numerator / ____)