## Structural Breaks in a Time Series Model

4

3

The Chow test is a test of whether the true coefficients in two linear regressions on different data sets are equal.

In econometrics, Chow test is most commonly used in time series analysis to test for the presence of a structural break.

## Data

Here is data taken from the explanation image of the referenced Wikipedia article for Chow test.

data = {{0.08, 0.34}, {0.16, 0.55}, {0.24, 0.54}, {0.32,
0.77}, {0.4, 0.77}, {0.48, 1.2}, {0.56, 0.57}, {0.64,
1.3}, {0.72, 1.}, {0.8, 1.3}, {0.88, 1.2}, {0.96,
0.88}, {1., 1.2}, {1.1, 1.3}, {1.2, 1.3}, {1.3,
1.4}, {1.4, 1.5}, {1.4, 1.5}, {1.5, 1.5}, {1.6,
1.6}, {1.7, 1.1}, {1.8, 0.98}, {1.8, 1.1}, {1.9,
1.4}, {2., 1.3}, {2.1, 1.5}, {2.2, 1.3}, {2.2,
1.3}, {2.3, 1.2}, {2.4, 1.1}, {2.5, 1.1}, {2.6,
1.2}, {2.6, 1.4}, {2.7, 1.3}, {2.8, 1.6}, {2.9,
1.5}, {3., 1.4}, {3., 1.8}, {3.1, 1.4}, {3.2,
1.4}, {3.3, 1.4}, {3.4, 2.}, {3.4, 2.}, {3.5,
1.5}, {3.6, 1.8}, {3.7, 2.1}, {3.8, 1.6}, {3.8,
1.8}, {3.9, 1.9}, {4., 2.1}};
ListPlot[data] This code illustrates the presence of a structural break:

Show[
Map[
Function[{data},
ff = Fit[data, {1, x}, x];
Show[ListPlot[data],
ListLinePlot[{#, ff /. x -> #} & /@ data[[All, 1]]]]],
{Select[data, #[] < 1.5 &], Select[data, #[] >= 1.5 &]}],
PlotRange -> All] How can we identify structural breaks in time series data using Mathematica?

# Original post

I am having troubles in performing structural break analysis on Mathematica. I have the following time series model for S&P500 starting January 1, 2015. So I obtain the following AR model that describes the prices:

$$y_t = 0.996271y_{t-1} + u_t$$

From the above graph, it is obvious that there are structural breaks. Is there a way to perform a structural break test on Mathematica for unknown dates?

It is not clear what are you asking. What table do you refer to? What are “structural breaks”? – Anton Antonov – 2019-06-12T12:49:56.653

Apologies for not being clear. I meant graph. I want to perform a Chow test (F- test) to see if there is a statistically significant change in the model (hence 'structural break'). To my understanding, mathematica does not have a command for the test. So how can I perform the Chow test? @AntonAntonov – Waie – 2019-06-13T16:13:09.493

1Please complete or rewrite your question! (It is a potentially interesting one to answer...) – Anton Antonov – 2019-06-13T16:38:55.593

2I provided a new formulation of the question with references, data, and code that illustrates what a "structural break" is. – Anton Antonov – 2019-06-14T11:22:42.650

@AntonAntonov in your investigations, are these related to “Statistical breakpoints”? OP may want to implement something similar to this: https://www.ncbi.nlm.nih.gov/m/pubmed/6496934/

– CA Trevillian – 2019-06-14T11:26:21.573

@CATrevillian From OP's previous comments I am 97% sure that OP wants the Chow test described in Wikipedia's Chow test entry.

– Anton Antonov – 2019-06-14T12:04:08.703

@AntonAntonov ah that makes sense, even still, I kind of ignore the fancier words and read the structural breakpoint as a statistical breakpoint—I do this as it can be related to what they call priori, as that was my first introduction to the uses of statistical breakpoints, in conversation analysis, you relate levels of focus on certain tasks to their associated causes, or priori, as they describe it. – CA Trevillian – 2019-06-14T12:08:24.767

As @CATrevillian sort of hints at, the a priori assumption means that there is a single known break point in the series. It appears from the S&P500 data that there might be an unknown number of unknown breakpoints. So Chow's test in not appropriate in this situation. Chow's test is also not appropriate even if there was a single known breakpoint because Chow's test assumes independence of errors while the OP states that the errors are serially correlated (i.e., the AR - autoregressive - process). Better to ask this question on CrossValidated then back here for implementation. – JimB – 2019-08-01T17:20:00.590

5

## Update 2019-08-01

The Community blog post:

provides demonstrations and explanations for the code used to make the plot below.

(This is a preview / clarification for an answer I will post later today.)

@Waie Is the attached screenshot close to what you want or expect? ## Code

This function definition follows the formula given in Wikipedia's Chow test entry.

Clear[ChowTestStatistic]

ChowTestStatistic::empfuncs = "A non empty list of functions is expected.";
ChowTestStatistic::novar = "The specified variable is not a symbol.";
ChowTestStatistic::nofuncsvar = "The specified variable should be found in the functions list.";

ChowTestStatistic[data : {{_?NumberQ, _?NumberQ} ..}, splitPoint_?NumberQ, funcs_: {1, x}, var_: x] :=
Block[{S, S1, S2, k, data1, data2, fm, res},
If[Length[funcs] == 0, Message[ChowTestStatistic::empfuncs]; Return[$$Failed]]; If[! DeveloperSymbolQ[var], Message[ChowTestStatistic::novar]; Return[$$Failed]];
If[FreeQ[funcs, var], Message[ChowTestStatistic::nofuncsvar]; Return[\$Failed]];

k = Count[DeveloperSymbolQ /@ funcs, True];

data1 = Select[data, #[] < splitPoint &];
data2 = Select[data, #[] >= splitPoint &];

{S, S1, S2} =
Map[
Function[{d},
res = Fit[d, funcs, var, "FitResiduals"];
res.res
],
{data, data1, data2}];

((S - (S1 + S2))/k)/((S1 + S2)/(Length[data1] + Length[data2] - 2 k))
];


## Examples

Here is an example run of the Chow test statistic with the data data provided in the question.

res = {#, ChowTestStatistic[data, #, {1, x}, x]} & /@
Rest[Most[data[[All, 1]]]];
ListPlot[res, Filling -> Axis, PlotRange -> All] Here is a plot of structural break splits (the point in blue is the best split): 