strucchange : An R Package for Testing for Structural Change in Linear Regression Models

This paper introduces ideas and methods for testing for structural change in linear regression models and presents how these have been realized in an R package called strucchange 1 . It features tests from the generalized ﬂuctuation test framework as well as from the F test (Chow test) framework. Extending standard signiﬁcance tests it contains methods to ﬁt, plot and test empirical ﬂuctuation processes (like CUSUM, MOSUM and estimates-based processes) on the one hand and to compute, plot and test sequences of F statistics with the sup F , ave F and exp F test on the other. Thus, it makes powerful tools available to display information about structural changes in regression relationships and to assess their signiﬁcance. Furthermore it is described how incoming data can be monitored online.


Introduction
The problem of detecting structural changes in linear regression relationships has been an important topic in statistical and econometric research.The most important classes of tests on structural change are the tests from the generalized fluctuation test framework (Kuan and Hornik, 1995) on the one hand and tests based on F statistics (Hansen, 1992;Andrews, 1993;Andrews and Ploberger, 1994) on the other.The first class includes in particular the CUSUM and MOSUM tests and the fluctuation test, while the Chow and the supF test belong to the latter.A topic that gained more interest rather recently is to monitor structural change, i.e., to start after a history phase (without structural changes) to analyze new observations and to be able to detect a structural change as soon after its occurrence as possible.
This paper concerns ideas and methods for implementing generalized fluctuation tests as well as F tests in a comprehensive and flexible way, that reflects the common features of the testing procedures and offers facilities to display the results in various ways.These ideas have been realized in a package called strucchange in the R system 2 for statistical computing, the GNU implementation of the S language.This paper is organized as follows: In Section 2 the standard linear regression model upon which all tests are based will be described and the testing problem will be specified.Section 3 introduces a data set which is also available in the package and which is used for the examples in this paper.The following sections 4, 6 and 5 will then explain the tests, how they are implemented in strucchange and give examples for each.Section 4 is concerned with computing empirical fluctuation processes, plotting them and the corresponding boundaries and finally testing for structural change based on these processes.Analogoulsy Section 5 introduces the F statistics and their plotting and testing methods before Section 6 extends the tools from Section 4 for the monitoring case.

The model
Consider the standard linear regression model where at time i, y i is the observation of the dependent variable, x i = (1, x i2 , . . ., x ik ) is a k × 1 vector of observations of the independent variables, with the first component equal to unity, u i are iid(0, σ 2 ), and β i is the k × 1 vector of regression coefficients.Tests on structural change are concerned with testing the null hypothesis of "no structural change" against the alternative that the coefficient vector varies over time, with certain tests being more or less suitable (i.e., having good or poor power) for certain patterns of deviation from the null hypothesis.
It is assumed that the regressors are nonstochastic with ||x i || = O(1) and that for some finite regular matrix Q.These are strict regularity conditions excluding trends in the data which are assumed for simplicity.For some tests these assumptions can be extended to dynamic models without changing the main properties of the tests.But as these details are not part of the focus of this work they are omitted here.
Because most of the tests on structural change considered here are either based on estimates of the regression coefficients or on residuals, the most important ones are presented here for ease of notation.β(i,j) is the ordinary least squares (OLS) estimate of the regression coefficients based on the observations i + 1, . . ., i + j, and β(i) = β(0,i) is the OLS estimate based on all observations up to i. Hence β(n) is the common OLS estimate in the linear regression model.Similarly X (i) is the regressor matrix based on all observations up to i.The OLS residuals are denoted ûi = y i − x i β(n) with the variance estimate σ2 = 1 n−k n i=1 û2 i .Another type of residuals that are often used in tests on structural change are the recursive residuals which have zero mean and variance σ 2 under the null hypothesis.The corresponding variance estimate is

The data
The data used for examples throughout this paper are macroeconomic time series from the USA.The data set contains the monthly personal income and personal consumption expenditures (in billion US dollars) between January 1959 and February 2001, which are seasonally adjusted at annual rates.It is available in the strucchange package: the data can be loaded and a suitable subset chosen by Both time series can be seen in Figure 1.
We choose our regression model to have one "real" regressor income (and a constant) and a dependent variable expenditure and we want to investigate whether the way the income is spent changes over time.From a macroeconomic view it would probably be more correct to assume that the income is influenced by the expenditure, but our approach might be more intuitive and the results can be interpreted in the same way.We will investigate whether the way the income was spent for personal consumption changed during the 1970s and 1980s.To get a first impression of the data the ratio of expenditure and income is shown for this period in Figure 2. From this it can be seen that most of the time around 77 to 78 percent of the income were spent on consumption (ignoring the constant), but that there are two peaks: a smaller one around 1974 and a larger one around 1982.We suspect that these might be structural changes and we will come back to this question in the examples in the following sections.

Generalized fluctuation tests
The generalized fluctuation tests fit a model to the given data and derive an empirical process, that captures the fluctuation either in residuals or in estimates.Under the null hypothesis the fluctuation should not be too large, such that for each process type boundaries can be computed, whose crossing probability under the null hypothesis is α.If the empirical process path crosses these boundaries, the fluctuation is improbably large and hence the hypothesis should be rejected (at confidence level α).

Empirical fluctuation processes: function efp
Given a formula that describes a linear regression model to be tested the function efp creates an object of class "efp" which contains a fitted empirical fluctuation process of a specified type.The types available

CUSUM processes:
The first type of processes that can be computed are CUSUM processes, which contain cumulative sums of standardized residuals.Brown et al. (1975) suggested to consider cumulative sums of recursive residuals: where η = n − k is the number of recursive residuals and tη is the integer part of tη.
Under the null hypothesis the limiting process for the empirical fluctuation process W n (t) is the Standard Brownian Motion (or Wiener Process) W (t).More precisely the following functional central limit theorem (FCLT) holds: as n → ∞, where ⇒ denotes weak convergence of the associated probability measures.
Under the alternative, if there is just a single structural change point t 0 , the recursive residuals will only have zero mean up to t 0 .Hence the path of the process should be close to 0 up to t 0 and leave its mean afterwards.Krämer et al. (1988) show that the main properties of the CUSUM quantity remain even under weaker assumptions, in particular in dynamic models.Therefore efp has the logical argument dynamic; if set to TRUE the lagged observations x t−1 will be included as regressors.Ploberger and Krämer (1992) suggested to base a structural change test on cumulative sums of the common OLS residuals.Thus, the OLS-CUSUM type empirical fluctuation process is defined by: The limiting process for W 0 n (t) is the standard Brownian bridge W 0 (t) = W (t) − tW (1).It starts in 0 at t = 0 and it also returns to 0 for t = 1.Under a single structural shift alternative the path should have a peak around t 0 .
These processes are available in the function efp by specifying the argument type to be either "Rec-CUSUM" or "OLS-CUSUM", respectively.
MOSUM processes: Another possibility instead of using cumulative sums of residuals to detect a structural change is to analyze moving sums of the same residuals.The resulting empirical fluctuation process does then not contain the sum of all residuals up to a certain time t but the sum of a fixed number of residuals in a data window whose size is determined by the bandwidth parameter h ∈ (0, 1) and which is moved over the whole sample period.Hence the Recursive MOSUM process is defined by where N η = (η − ηh )/(1 − h).Similarly the OLS-based MOSUM process is defined by where As the representations ( 9) and ( 11) suggest, the limiting process for the empirical MOSUM processes are the increments of a Brownian motion or a Brownian bridge respectively.This is shown in detail in Chu et al. (1995a).
If again a single structural shift is assumed at t 0 , then both MOSUM paths should also have a strong shift around t 0 .
The MOSUM processes will be computed if type is set to "Rec-MOSUM" or "OLS-MOSUM", respectively.
Estimates-based processes: Alternatively to defining fluctuation processes on the basis of residuals they can be equally well based on estimates of the unknown regression coefficients.With the same ideas as for the residual-based CUSUM-and MOSUM-type processes the k ×1-vector β is either estimated recursively with a growing number of observations or with a moving data-window of constant bandwidth h and then compared to the estimates based on the whole sample.The first idea leads to the fluctuation process which is defined by where i = k + t(n − k) with t ∈ [0, 1].And the latter gives the moving estimates (ME) process where 0 ≤ t ≤ 1 − h.Both are k-dimensional empirical processes.Thus the limiting processes are a kdimensional Brownian Bridge or the increments thereof respectively.Instead of rescaling the processes for each i they can also be standardized by . This has the advantage that it has to be calculated only once, but Kuan and Chen (1994) showed that if there are dependencies between the regressors the rescaling improves the empirical size of the resulting test.Heuristically the rescaled empricial fluctuation process looks more like its theoretic counterpart.
Under a single shift alternative the recursive estimates processes should have a peak and the moving estimates process should again have a shift close to the shift point t 0 .
For type="fluctuation" the function efp returns the recursive estimates process, whereas set to "ME" the moving estimates process is returned.
These six processes can be fitted easily using the function efp.For our example we want to fit an OLSbased CUSUM process, and a moving estimates (ME) process with bandwith h = 0.2.The commands are simply R> ocus <-efp(expenditure~income, type="OLS-CUSUM", data=USIncExp2) R> me <-efp(expenditure~income, type="ME", data=USIncExp2, h=0.2) This would return objects of class "efp" which contain mainly the empirical fluctuation processes and a few further attributes like the process type.The process itself is of class "ts" (the time series class in R), which either preserves the time properties of the dependent variable if this is a time series (like in our example), or which is standardized to the interval [0, 1] (or a subinterval).For the MOSUM-and ME-processes Any other process type introduced in this section can be fitted by setting the type argument.The fitted process can then be printed, plotted or tested with the corresponding test on structural change.For the latter appropriate boundaries are needed; the concept of boundaries for fluctuation processes is explained in the next section.

Boundaries and plotting
The idea that is common to all generalized fluctuation tests is that the null hypothesis of "no structural change" should be rejected when the fluctuation of the empirical process efp(t) gets improbably large compared to the fluctuation of the limiting process.For the one-dimensional residual-based processes this comparison is performed by some appropriate boundary b(t), that the limiting process just crosses with a given probability α.Thus, if efp(t) crosses either b(t) or −b(t) for any t then it has to be concluded that the fluctuation is improbably large and the null hypothesis can be rejected at confidence level α.The procedure for the k-dimensional estimates-based processes is similar, but instead of a boundary for the process itself a boundary for ||efp(t)|| is used, where || • || is an appropriate functional.We have implemented the functionals 'max' and 'range'.The null hypothesis is rejected if ||efp(t)|| i gets larger than a constant λ, which depends on the confidence level α, for any i = 1, . . ., k.
The boundaries for the MOSUM processes are also constants, i.e., of form b(t) = λ, which seems natural as the limiting processes are stationary.The situation for the CUSUM processes is different though.Both limiting processes, the Brownian motion and the Brownian bridge, respectively, are not stationary.It would seem natural to use boundaries that are proportional to the standard deviation function of the corresponding theoretic process, i.e., for the Recursive CUSUM and the OLS-based CUSUM path respectively, where λ determines the confidence level.But the boundaries that are commonly used are linear, because a closed form solution for the crossing probability is known.So the standard boundaries for the two proccess are of type They were chosen because they are tangential to the boundaries ( 14) and ( 15) respectively in t = 0.5.However, Zeileis (2000a) examined the properties of the alternative boundaries ( 14) and ( 15) and showed that the power of the OLS-based CUSUM test can be improved for structural changes early and late in the sample period.
Given a fitted empirical fluctuation process the boundaries can be computed very easily using the function boundary, which returns a time series object with the same time properties as the given fluctuation process: It is also rather convenient to plot the process with its boundaries for some confidence level α (by default 0.05) to see whether the path exceeds the boundaries or not: The result of

OLS−based CUSUM test
is shown in Figure 3.It can be seen that the OLS-based CUSUM path has two peaks which correspond to the two peaks we have seen in Figure 2.So the two structural changes are detected, but with a short lag of a few observations.
It is also possible to suppress the boundaries and add them afterwards, e.g. in another colour R> plot(ocus, boundary=FALSE) R> lines(bound.ocus,col=4) R> lines(-bound.ocus,col=4) For residual-based processes it is only sensible to do time series plots if the functional 'max' is used because it is equivalent to reject the null hypothesis when max i=1,...,k ||efp(t)|| gets large or when the max t max i=1,...,k efp i (t) gets large.This again is equivalent to any one of the (one-dimensinal) processes efp i (t) for i = 1, . . ., k exceeding the boundary.The k-dimensional process can also be plotted by specifying the parameter functional (which defaults to "max") as NULL: R> plot(me, functional=NULL) The output from R can be seen in Figure 4, where the upper and lower half show the processes that correspond to the estimate of the intercept and the income regression coefficient, respectively.Both paths have two strong shifts that cross the upper and the lower boundary.The first shift starts in about 1975/6 and the second around 1981/2.Thus, the ME test leads to similar results as the OLS-based CUSUM test.
Both indicate two strong shifts, one in the mid-70s and another one in the early 80s.

Significance testing with empirical fluctuation processes
Although calculating and plotting the empiricial fluctuation process with its boundaries provides and visualizes most of the information, it might still be necessary or desirable to carry out a traditional significance test.This can be done easily with the function sctest (structural change test) which returns an object of class "htest" containing in particular the test statistic and the corresponding p value.The test statistics reflect what was described by the crossing of boundaries in the previous section.Hence the test statistic is S r from (18) for the residual-based processes and S e from ( 19) for the estimates-based processes: where f (t) depends on the shape of the boundary, i.e., b(t) = λ • f (t).For most boundaries is f (t) ≡ 1 but the linear boundary for the Recursive CUSUM test has shape f (t) = 1 + 2t, e.g.
It is either possible to supply sctest with a fitted empirical fluctuation process or with a formula describing the model that should be tested.Thus, the commands

F tests
A completely different approach to investigate whether the null hypothesis of "no structural change" holds, is to use F test statistics.An important difference is that the alternative is specified: whereas the generalized fluctuation tests are suitable for various patterns of structural changes, the F tests are designed to test against a single shift alternative.Thus, the alternative can be formulated on the basis of the model ( 1) where i 0 is some change point in the interval (k, n − k).Chow (1960) was the first to suggest such a test on structural change if the (potential) change point i 0 is known.He proposed to fit a full OLS model, where the regression coefficients are estimated twice: once for the observations before the change point and once for those after i 0 .The resulting residuals ê = (û A , ûB ) can then be compared to the residuals û from the restricted model, where the parameters are just fitted once for all observations.The test statistic has an F distribution with k and n−2k degrees of freedom.The major drawback of this "Chow test" is that the change point has to be known in advance, but there are tests based upon F statistics (Chow statistics), that do not require a specification of a certain change point and which will be introduced in the following sections.

F statistics: function Fstats
A natural idea to extend the ideas from the Chow test is to calculate the F statistics for all potential change points or for all potential change points in an interval [i, ı] and to reject if any of those statistics get too large.Therefore the first step is to compute the F statistics F i for k < i ≤ i ≤ ı < n − k, which can be easily done using the function Fstats.Again the model to be tested is specified by a formula interface and the parameters i and ı are respresented by from and to, respectively.Alternatively to indices these two parameters can also be specified by fractions of the sample; the default is to take from = 0.15 and implicitely to = 0.85.To compute the F test statistics for all potential change points between January 1972 and December 1981 the appropriate command would be: R> fs <-Fstats(expenditure ~income, from=c(1972,1), to=c (1981,12), data=USIncExp2) This returns an object of class "Fstats" which mainly contains a time series of F statistics.Analogously to the empiricial fluctuation processes these objects can be printed, plotted and tested.

Boundaries and plotting
Just as for the empirical fluctuation processes it is possible to compute a constant boundary such that the (asymptotic) probability that one of the statistics F i for i ≤ i ≤ ı exceeds this boundary is α under the null hypthesis of no structural change.Furthermore there are constant boundaries available for the mean of these statistics.The plotting of the process and its boundaries works in principle like introduced in the last section.So the command plots the process with its boundaries; the output can be seen in Figure 5.This shows a clear peak around 1981, which emphasizes the results from the analysis by empirical fluctuation processes and tests, respectively.
It is also possible to plot the p values instead of the F statistics themselves by R> plot(fs, pval=TRUE) which leads to equivalent results.Furthermore it is also possible to set up the boundaries for the average instead of the supremum by: R> plot(fs, aveF=TRUE) In this case another dashed line for the observed mean of the F statistics will be drawn.

Significance testing with F statistics
As already indicated in the previous section, there is more than one possibility to aggregate the series of F statistics into a test statistic.Hansen (1992) and Andrews (1993) respectively suggested three different test statistics and examined their asymptotic distribution: The supF statistic in ( 22) and the aveF statistic from ( 23) respectively reflect the testing procedures that have been described above.Either the null hypothesis is rejected when the maximal or the mean F statistic gets too large.A third possibility is to reject when the expF statistic from ( 24) gets too large.The tests can be carried out in the same way as the fluctuation tests: either by supplying the fitted Fstats object or by a formula that describes the model to be tested.Hence both commands R> sctest(fs, type="expF") R> sctest(expenditure ~income, type="expF", from = 25, to = 144, data = USIncExp2) lead to equivalent output: The p values are computed based on Hansen (1997).3

Monitoring with the generalized fluctuation test
In the previous sections we were concerned with the retrospective detection of structural changes in given data sets.Over the last years several structural change tests have been extended to online monitoring of linear regression models where new data arrive over time (Chu et al., 1996;Leisch et al., 2000).Such forward looking tests are closely related to sequential tests.When new observations arrive, estimates are computed sequentially from all available data (historical sample plus newly arrived data) and compared to the estimate based only on the historical sample.As in the retrospective case, the hypothesis of no structural change is rejected if the difference between these two estimates gets too large.
The standard linear regression model ( 1) is generalized to i.e., we expect new observations to arrive after time n (when the monitoring begins).The sample {(x 1 , y 1 ), . . ., (x n , y n )} will be called the historic sample, the corresponding time period 1, . . ., n the history period.Currently monitoring has only been developed for recursive (Chu et al., 1996) and moving (Leisch et al., 2000) estimates tests.The respective limiting processes are-as in the retrospective case-the Brownian Bridge and increments of the Brownian Bridge.The empirical processes are rescaled to map the history period to the interval [0,1] of the Brownian Bridge.For recursive estimates there exists a closed form solution for boundary functions, such that the limiting process Brownian Bridge stays within the boundaries on the interval (1, ∞) with probability 1 − α.Note that the monitoring period consisting of all data arriving after the history period corresponds to the Brownian Bridge after time 1.For moving estimates, only the growth rate of boundaries can be derived analytically and critical values have to be simulated.Consider that we want to monitor our income/expenditure data during the 1970's for structural change, using years 1969-1971 as history period.First we cut the historic sample from the complete data set and create an object of class "mefp": The software informs us that a structural break has been detected at observation #58, which corresponds to October 1973.Boundary and plotting methods for "mefp" objects work (almost) exactly as their "efp" counterparts, only the significance level alpha cannot be specified, because it is specified when the "mefp" object is created.The output of plot(me.mefp)can be seen in Figure 6.Instead of creating an "mefp" object using the formula interface like above, it could also be done re-using an existing "efp" object, e.g.: and discover the structural change even two observations earlier as we used the bandwidth h=0.5 instead of h=1.Due to this we have not one history estimate that is being compared with the new moving estimates, but we have a history process, which can be seen on the left in Figure 7.This plot can simply be generated by

Conclusions
In this paper, we introduce the strucchange package that implements methods for testing for structural change in linear regression relationships.It offers a unified framework to display information about structural changes flexibly and to assess their significance according to various tests.
Containing tests from the generalized fluctuation test framework as well as tests based on F statistics (Chow test ststistics) the package extends standard significance testing procedures: There are methods to fit empirical fluctuation processes (CUSUM, MOSUM and estimates-based processes), compute an appropriate boundary, plot these results and finally carry out a formal significance test.Analogously a sequence of F statistics with the corresponding boundary can be computed, plotted and tested.Finally the methods for estimates-based fluctuation processes have extensions to monitor incoming data online.

A Implementation details for p values
An important and useful tool concerning significance tests are p values, especially for application in a software package.Their implementation is therefore crucial and in this section we will give more detail about the implementation in the strucchange package.
For the CUSUM tests with linear boundaries there are rather exact approximations to the asymptotic p value functions given in Zeileis (2000a).For the recursive estimates fluctuation test there is a series expansion, which is evaluated for the first hundred terms.

Arguments
x an object of class "Fstats".alpha numeric from interval (0,1) indicating the confidence level for which the boundary of the supF test will be computed.
tol tolerance when solve is used data an optional data frame containing the variables in the model.By default the variables are taken from the environment which covHC is called from.

Details
When type = "const" constant variances are assumed and and covHC gives the usual estimate of the covariance matrix of the coefficient estimates: All other methods do not assume constant variances and are suitable in case of heteroskedasticity."HC" gives White's estimator; for details see the references.

Value
A matrix containing the covariance matrix estimate.rescale logical.If TRUE the estimates will be standardized by the regressor matrix of the corresponding subsample according to Kuan & Chen (1994); if FALSE the whole regressor matrix will be used.(only if type is either "fluctuation" or "ME") tol tolerance when solve is used

Details
If type is one of "Rec-CUSUM", "OLS-CUSUM", "Rec-MOSUM" or "OLS-MOSUM" the function efp will return a one-dimensional empiricial process of sums of residuals.Either it will be based on recursive residuals or on OLS residuals and the process will contain CUmulative SUMs or MOving SUMs of residuals in a certain data window.For the MOSUM and ME processes all estimations are done for the observations in a moving data window, whose size is determined by h and which is shifted over the whole sample.
If there is a single structural change point t * , the standard CUSUM path starts to depart from its mean 0 at t * .The OLS-based CUSUM path will have its peak around t * .The MOSUM path should have a strong change at t * .
If type is either "fluctuation" or "ME" a k-dimensional process will be returned, if k is the number of regressors in the model, as it is based on recursive OLS estimates of the regression coefficients or moving OLS estimates respectively.
Both paths should have a peak around t * if there is a single structural shift.

Value
efp returns an object of class "efp" which inherits from the class "ts" or "mts" respectively, to which a string with the type of the process, the number of regressors (nreg), the bandwidth (h) and the function call (call) are added as attributes.The function plot has a method to plot the empirical fluctuation process; with sctest the corresponding test on structural change can be performed.

Description
Computes a series of F statistics for a specified data window.

Usage
Fstats(formula, from = 0.15, to = NULL, data, cov.type = c("const", "HC", "HC1"), tol=1e-7) Arguments formula a symbolic description for the model to be tested from, to numeric.If from is smaller than 1 they are interpreted as percentages of data and by default to is taken to be 1from.F statistics will be calculated for the observations (n*from):(n*to), when n is the number of observations in the model.If from is greater than 1 it is interpreted to be the index and to defaults to n -from.If from is a vector with two elements, then from and to are interpreted as time specifications like in ts, see also the examples.
data an optional data frame containing the variables in the model.By default the variables are taken from the environment which Fstats is called from.
cov.type a string indicating which type of covariance matrix estimator should be used.Constant homoskedastic variances are assumed if set to "const" and White's heteroskedasticity consistent estimator is used if set to "HC".And "HC1" stands for a standardized estimator of "HC", see also covHC.
tol tolerance when solve is used.

Details
For every potential change point in from:to a F statistic (Chow test statistic) is computed.For this an OLS model is fitted for the observations before and after the potential change point, i.e. 2k parameters have to be estimated, and the error sum of squares is computed (ESS).Another OLS model for all obervations with a restricted sum of squares (RSS) is computed, hence k parameters have to be estimated here.If n is the number of observations and k the number of regressors in the model, the formula is:

Value
Fstats returns an object of class "Fstats", which contains mainly a time series of F statistics.
The function plot has a method to plot the F statistics or the corresponding p values; with sctest a supF-, aveF-or expF-test on structural change can be performed.

Details
mefp creates an object of class "mefp" either from a model formula or from an object of class "efp".In addition to the arguments of efp, the type of statistic and a significance level for the monitoring must be specified.The monitoring itself is performed by monitor, which can be called arbitrarily often on objects of class "mefp".If new data have arrived, then the empirical fluctuation process is computed for the new data.If the process crosses the boundaries corresponding to the significance level alpha, a structural break is detected (and signaled).
The typical usage is to initialize the monitoring by creation of an object of class "mefp" either using a formula or an "efp" object.Data available at this stage are considered the history sample, which is kept fixed during the complete monitoring process, and may not contain any structural changes.
Subsequent calls to monitor perform a sequential test of the null hypothesis of no structural change in new data against the general alternative of changes in one or more of the coefficients of the regression model.

Arguments
x an object of class "Fstats".type a character string specifying which test will be performed.asymptotic logical.Only necessary if x contains just a single F statistic and type is "supF" or "aveF".If then set to TRUE the asymptotic (chi-square) distribution instead of the exact (F) distribution will be used to compute the p value.

Details
If x contains just a single F statistic and type is "supF" or "aveF" the Chow test will be performed.
The original GAUSS code for computing the p values of the supF-, aveF-and expF-test was written by Bruce Hansen and is available from http://www.ssc.wisc.edu/~bhansen/.R port by Achim Zeileis.

Figure 1 :
Figure 1: Personal income and personal consumption expenditures in the US

Figure 7 :
Figure 7: Monitoring structural change with bandwidth h = 0.5 pval logical.If set to TRUE a boundary for the corresponding p values will be computed.aveF logical.If set to TRUE the boundary of the aveF (instead of the supF) test will be computed.The resulting boundary then is a boundary for the mean of the F statistics rather than for the F statistics themselves.asymptotic logical.If set to TRUE the asymptotic (chi-square) distribution instead of the exact (F) distribution will be used to compute the p values (only if pval is TRUE).... currently not used.Value an object of class "ts" with the same time properties as the time series in x Examples df1 <-data.frame(y=rnorm(300))df1[150:300,"y"] <-df1[150:300,"y"]+1 me1 <-mefp(y~1, data=df1[1:50,,drop=FALSE], type="ME", h=1, alpha=0.05)me2 <-monitor(me1, data=df1) plot(me2, boundary=FALSE) lines(boundary(me2), col="green", lty="44") boundary Boundary Function for Structural Change Tests Description A generic function computing boundaries for structural change tests Usage boundary(x, ...) Arguments x an object.Use methods to see which class has a method for boundary.... additional arguments affecting the boundary.Value an object of class "ts" with the same time properties as the time series in x Author(s) Achim Zeileis zeileis@ci.tuwien.ac.atSee Also boundary.efp,boundary.mefp,boundary.Fstats covHC Heteroskedasticity-Consistent Covariance Matrix Estimation Description Heteroskedasticity-consistent estimation of the covariance matrix of the coefficient estimates in a linear regression model.
MacKinnon J.G.,White H. (1985), Some heteroskedasticity-consistent covariance matrix estimators with improved finite sample properties.Journal of Econometrics 29, fluctuation process according to a specified method from the generalized fluctuation test framework Usage efp(formula, data, type = <<see below>>, h = 0.15, dynamic = FALSE, rescale = TRUE, tol = 1e-7) Arguments formula a symbolic description for the model to be tested.data an optional data frame containing the variables in the model.By default the variables are taken from the environment which efp is called from.typespecifies which type of fluctuation process will be computed.For details see below.

h
a numeric from interval (0,1) sepcifying the bandwidth.determins the size of the data window relative to sample size (for MOSUM and ME processes only).dynamic logical.If TRUE the lagged observations are included as a regressor.
is a generic function which has methods not only for fluctuation tests, but all structural change tests (on historic data) introduced in this paper, i.e., also the F tests, which are described in the next section. sctest For all other tests from the generalized fluctuation test framework the p values are computed by linear interpolation from tabulated critical values.For the Recursive CUSUM test with alternative boundaries p values from the interval [0.001, 1] and [0.0001, 1] for the OLS-based version respectively are approximated from tables given in Zeileis (2000b).The critical values for the Recursive MOSUM test for levels in [0.01, 0.2] are taken from Chu et al. (1995a), while the critical values for the levels in [0.01, 0.1] for the OLS-based MOSUM and the ME test are given in Chu et al. (1995b); the parameter h is in both cases interpolated for values in [0.05, 0.5].The p values for the supF , aveF and expF test are approximated based onHansen (1997), who also wrote the original code in GAUSS, which we merely ported to R. The computation uses tabulated simulated regression coefficients.
Zeileis A. (2000), p Values and Alternative Boundaries for CUSUM Tests, Working Paper 78, SFB "Adaptive Information Systems and Modelling in Economics and Management Science", Vienna University of Economics, http://www.wu-wien.ac.at/am/wp00.htm#78.)indicating the confidence level for which the boundary of the supF test will be computed.boundarylogical.If set to FALSE the boundary will be computed but not plotted.aveFlogical.If set to TRUE the boundary of the aveF test will be plotted.As this is a boundary for the mean of the F statistics rather than for the F statistics themselves a dashed line for the mean of the F statistics will also be plotted.xlab,ylab, ylim, ... high-level plot function parameters.Achim Zeileis zeileis@ci.tuwien.ac.at temp.me<-efp(nhtemp ~1, type = "ME", h = 0.2) ## plot the process with functional = "max" plot(temp.me)## and perform the corresponding test sctest(temp.me) pval logical.If set to TRUE the corresponding p values instead of the original F statistics will be plotted.asymptotic logical.If set to TRUE the asymptotic (chi-square) distribution instead of the exact (F) distribution will be used to compute the p values (only if pval is TRUE).
If from is smaller than 1 they are interpreted as percentages of data and by default to is taken to be the 1from.F statistics will be calculated for the observations (n*from):(n*to), when n is the number of observations in the model.If from is greater than 1 it is interpreted to be the index and to defaults to n -from.(forFtestsonly)pointparameter of the Chow test for the potential change point.Interpreted analogous to the from parameter.By default taken to be floor(n*0.5)ifnisthenumber of observations in the model.asymptoticlogical.If TRUE the asymptotic (chi-square) distribution instead of the exact (F) distribution will be used to compute the p value (for Chow test only).dataanoptionaldataframecontaining the variables in the model.By default the variables are taken from the environment which sctest is called from.... further arguments passed to efp or Fstats.Detailssctest.formula is mainly a wrapper for sctest.efpandsctest.Fstats as it fits an empirical fluctuation process first or computes the F statistics respectively and subsequently performs the corresponding test.The Chow test is available explicitely here.Achim Zeileis zeileis@ci.tuwien.ac.at