Breaking point in a time series

What function can I use to find breakpoints (more than one) in a time series in order to divide the entire period into subperiods?

I don't have that much experience with it, but the prophet package does something like that. It uses some sort of Bayesian statistics to segment the time series into different spans of time to detect shifts.

I think strucchange R package is a good choice for your multiple break points problem.

strucchange provides breakpoints() function. This function uses dynamic programming to find breakpoints that minimize residual sum of squares (RSS) of a linear model with m + 1 segments. Bayesian Information criterion (BIC) is used to find an optimal number of structural breaks.
Here, h is the minimum number of observations in each segment.

For more information, refer to the following two references.

Bai J., Perron P. (2003), Computation and Analysis of Multiple Structural Change Models, Journal of Applied Econometrics, 18, 1-22.

strucchange : An R Package for Testing for Structural Change in Linear Regression Models by Zeileis et al.


# Bai & Perron (2003)
# US ex-post real interest rate: 
# the three-month treasury bill deflated by the CPI inflation rate.

## estimate breakpoints
bp.ri <- breakpoints(RealInt ~ 1, h = 15)
x11(); plot(bp.ri)

## fit segmented model with two breaks from minimized BIC
fac.ri <- breakfactor(bp.ri, breaks = 2, label = "seg")
fm.ri <- lm(RealInt ~ 0 + fac.ri)

## Visualization
x11(); plot(RealInt)
lines(as.vector(time(RealInt)), fitted(fm.ri), col = 4)
1 Like

Hello, please read this documentation, It could be of much benefit for your project.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.