Is there a specific method to detect change points(structural breaks) in a timeseries? (stocks prices).
@Dail if you're more inclined to the applied rather than the theoretical behind detection of structural break, you might want try
http://cran.r-project.org/web/packages/cpm/index.html this is the link for
CPM package of
R, where you can use
processStream to find multiple break point in your time series.
Change Points can arise from a number of possible causes. Each of the possible causes can be evaluated. In terms of increasing complexity : 1. detecting a change in the expected value is essentially Intervention Detection. Pursue the work of Ruey Tsay to understand what you need to do. His work does not cover detecting the onset of a new time trend, The second item that you might consider is detecting when and if the parameters of the model have changed. If you pursue Gregory Chow's work on testing the difference between parameters for known groupings and simply generalize that to search for possible points in time where the parameters have changed you could be successful. Next in terms of complexity is to conduct a test for a significant change in the variance of the residuals. Simply evaluate different possible breal points for variance change and conduct a sequence of F tests to find the point ( if any ) that the variance has changed. I have had personal experience in developing each of these three tests and possible cures in order to render the final error process Gaussian.
Thanks for the kudos Whuber !
Here's some demo R code that shows how to detect (endogenously) structural breaks in time series / longitudinal data.
# assuming you have a 'ts' object in R # 1. install package 'strucchange' # 2. Then write down this code: library(strucchange) # store the breakdates bp_ts <- breakpoints(ts) # this will give you the break dates and their confidence intervals summary(bp_ts) # store the confidence intervals ci_ts <- confint(bp_ts) ## to plot the breakpoints with confidence intervals plot(ts) lines(bp_ts) lines(ci_ts)
Check out this example case that I have blogged about.
If you care the use of R, a selection of packages available are summarized in the CRAN task view on time series (https://cran.r-project.org/web/views/TimeSeries.html). Below is the relevant portion:
Change point detection is provided in
strucchangeRcpp(using linear regression models) and in trend (using nonparametric tests). The
changepointpackage provides many popular changepoint methods, and
ecpdoes nonparametric changepoint detection for univariate and multivariate series.
changepoint.npimplements the nonparametric PELT algorithm,
changepoint.mvdetects changepoints in multivariate time series, while
changepoint.geoimplements the high-dimensional changepoint detection method GeomCP. Factor-augmented VAR (FAVAR) models are estimated by a Bayesian method with FAVAR.
InspectChangepointuses sparse projection to estimate changepoints in high-dimensional time series.
Rbeastprovides Bayesian change-point detection and time series decomposition.
breakfastincludes methods for fast multiple change-point detection and estimation.
Searching on Google scholar for "Bayesian changepoint detection" will produce some useful references, such as Adams and MacKay, which looks very interesting and sounds the sort of thing you are looking for. There is also a good book on "Numerical Bayesian Methods Applied to Signal Processing" by O'Ruanaidh and Fitzgerald that I remember being very good on this sort of thing, but I don't have a copy anymore, so I can't check for relevant pages (but the index suggests there is a chapter on retrospective changepoint detection).
@Dail -- You don't need to know the date in advance. There are many options beyond the Chow Test. In practice, the Chow test can be undesirable because it assumes homoskedasticity, which is very often violated in real time series data. There is a famous paper on testing for structural breaks when the break dates are unknown and methods are now quite well developed. The reference is Andrews, 1993 but you probably would prefer to just have a look at these slides though, which provide an overview of the various tests, the theory, and examples of practical applications. There is an R package that you can use to implement the tests called
strucchange which you can find more info about here
I'd like to second what IrishStat has said and point you directly to two of Ruey Tsay's books:
Analysis of Financial Time Series, Third Edition, Wiley, 2010. ISBN: 0-470-41435-9; 10-digits: 978-0470414354 (book's website with some R code)
An Introduction to Analysis of Financial Data with R, Wiley, 2013 ISBN: 0-470-89081-3; 10-digits: 978-0470890813
Furthermore, I suggest investigating: Modelling Nonlinear Economic Time Series (Advanced Texts in Econometrics) (2011) by Timo Terasvirta, Dag Tjostheim, and Clive W. J. Granger. This book is very detailed and contains a great number of references. Chapter 6 of the book is where you should look.