# \donttest{
# This example may take substantial time for automated package
# checks since it involves dynamic programming
data(gdp)
y = gdp$gdp
x = gdp[,c("lag1", "lag2")]
n.size = 1
T.size = length(y) # number of time periods
# setting
vec.tau = seq(0.20, 0.80, by = 0.150)
trim.e = 0.2
trim.size = round(T.size * trim.e) #minimum length of a regime
m.max = 3
# dynamic program algorithm to compute the objective function
out.long = gen.long(y, x, vec.tau, n.size, trim.size)
mat.long.s = out.long$mat.long ## for break estimation using individual quantile
vec.long.m = out.long$vec.long ## for break estimation using multiple quantiles jointly
# break date
mat.date = brdate(y, x, n.size, m.max, trim.size, vec.long.m)
## qunatile ranges (left and right)
q.L = 0.2
q.R = 0.8
d.Sym = TRUE ## symmetric trimming of quantiles
table.cv = NULL ##covered by the response surface because d.Sym = TRUE
# determine the number of breaks
out.m = dq(y, x, vec.tau, q.L, q.R, n.size, m.max, trim.size, mat.date, d.Sym, table.cv)
# result
print(out.m)
# }
Run the code above in your browser using DataLab