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.
library(strucchange)
# Bai & Perron (2003)
# US ex-post real interest rate:
# the three-month treasury bill deflated by the CPI inflation rate.
data("RealInt")
## estimate breakpoints
bp.ri <- breakpoints(RealInt ~ 1, h = 15)
x11(); plot(bp.ri)
summary(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)
summary(fm.ri)
## Visualization
x11(); plot(RealInt)
lines(as.vector(time(RealInt)), fitted(fm.ri), col = 4)