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?
This exercise is part of the course
Quantitative Risk Management in Python
Exercise instructions
- Add an OLS intercept term to
mort_del
forbefore
andafter
. - Fit an OLS regression of the
returns
column against themort_del
column, forbefore
andafter
. - Place the sum-of-squared residuals into
ssr_before
andssr_after
, forbefore
andafter
, respectively. - Create and display the Chow test statistic.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# 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 / ____)