-
Notifications
You must be signed in to change notification settings - Fork 8
Adding changes in second order structure to changepoint package.
## Background
Detecting changes in statistical properties of a time series is important in a large number of fields. A large amount of research has taken place considering changes in mean and variance in time series. However a typical assumption is that the error process is indpendent.
Similarly more and more users of existing packages, for example [[https://cran.r-project.org/web/packages/changepoint/][changepoint]], are facing problems using real world data due to the depedence structures present.
## Related work
There are many R packages available for changepoint detection but, to our knowledge, only a limited number that offer change in dependence.
- [[https://cran.r-project.org/web/packages/wbsts/][wbsts]] Assumes a zero-mean process and identifies change in the LSW spectrum.
- [[https://cran.r-project.org/web/packages/TSMCP/][TSMCP]] fits piecewise AR(p) processes with an upper limit on p set by the user, choice of SCAD or MCP approximate methods.
- [[https://cran.r-project.org/web/packages/segMGarch/][segMGarch]] fits piecewise GARCH models in multivariate time series
- [[https://cran.r-project.org/web/packages/ecp/][ecp]] non-parametric energy test statistic
None of these packages use exact search methodology. ECP is the closest with its probabilistic pruning but the authors accept that the test statistic implemented is not suitable for detecting changes in second order structure.
## Details of your coding project
This project will expand the =changepoint= R package by including functionality to detect changes in second order structure. The function will mirror the functionality of the =cpt.mean= and =cpt.var= functions. More specifically:
- Fork changepoint, with [[https://docs.travis-ci.com/user/languages/r/][TravisCI for GNU/Linux testing]], [[https://github.com/krlmlr/r-appveyor][Appveyor for windows testing]] and [[https://github.com/jimhester/covr][Coveralls for code coverage]].
- Understand the structure of the changepoint package.
- Port the change in AR1 and AR2 using PELT functionality from EnvCpt to changepoint whilst ensuring EnvCpt still works as expected.
- Extend the AR1/2 code to AR(p) functionality.
- Write functionality for a change in LSW autocorrelation based on a recent paper from Chapman, Eckley and Killick (2018+).
- Write user facing functions and plotting tools.
- Write some extensive test cases using =testthat= and building on existing tests in the =changepoint= package. Goal: 100% coverage in both R and C code by the end of summer. If time allows, port applicable tests back to =EnvCpt= to increase coverage.
- Extend the JSS changepoint paper to include how to use the updated package. Include this as a vignette to the package
## Expected impact
The update will provide a new and important alternative to the packages currently available. The package will also include models which are not included in existing packages within a familiar framework. Additionally we have received a considerable number of requests for this functionality over the last year so we expect the package to be well used by the community.
## Mentors
Students, please contact mentors below after completing at least one of the tests below.
- Rebecca Killick <[email protected]>
## Tests
Easy: Load the changepoint and EnvCpt packages, create a time series with changing AR structure, run only the change in AR1 and AR2 algorithms from EnvCpt NOT using the envcpt function (i.e. using the non-exported functions in the package) and plot the results.
Medium: Fork the [[https://github.com/rkillick/changepoint][changepoint]] or [[https://github.com/rkillick/EnvCpt][EnvCpt]] package on github and write some new tests to increase the code coverage. Commit these back to the main repository.
Hard: Wrap your easy task into an R function that takes arguments to fit a change in AR1/AR2 with or without a trend, remembering to include checks on your code. Write a package which includes tests for your functions. Upload to github and link in =TravisCI= testing and code coverage via =covr=.
## Solutions of tests
Students, please post a link to your test results here.