brdate: Estimating Break Dates in a Quantile Regression

View source: R/brdate.R

brdateR Documentation

Estimating Break Dates in a Quantile Regression

Description

This function estimates break dates in a quantile regression model, allowing for up to m breaks. When m = 1, this function finds the optimal single-break partition within a segment by evaluating the objective function at each possible break point to determine the break date. When m > 1, a dynamic programming algorithm is used to efficiently determine the break dates.

Usage

brdate(y, x, n.size = 1, m, trim.size, vec.long)

Arguments

y

A numeric vector of dependent variables (NT \times 1).

x

A numeric matrix of regressors (NT \times p); a column of ones will be automatically added to x.

n.size

An integer specifying the number of cross-sectional units (N), equal to 1 for time series data.

m

An integer specifying the maximum number of breaks allowed.

trim.size

An integer representing the minimum length of a regime, which ensures break dates are not too short or too close to the sample's boundaries.

vec.long

A numeric vector/matrix used in dynamic programming, storing pre-computed objective function values for all possible segments of the sample for optimization. Produced by the function gen.long().

Details

The function first determines the optimal one-break partition. If multiple breaks are allowed (m > 1), it applies a dynamic programming algorithm as in Bai and Perron (2003) to minimize the objective function. The algorithm finds break dates by iterating over all possible partitions, returning optimal break locations and associated objective function values.

Value

An upper triangular matrix (⁠m × m⁠) containing estimated break dates. The row index represents break dates, and the column index corresponds to the permitted number of breaks before the ending date.

References

Bai, J. and P. Perron (2003). Computation and analysis of multiple structural change models. Journal of Applied Econometrics, 18(1), 1-22.

Oka, T. and Z. Qu (2011). Estimating structural changes in regression quantiles, Journal of Econometrics, 162(2), 248-267.

Examples


  # data
  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

  # compute the objective function under all possible partitions
  out.long   = gen.long(y, x, vec.tau, n.size, trim.size)
  vec.long.m = out.long$vec.long  ## for break estimation using multiple quantiles

  # break date
  mat.date = brdate(y, x, n.size, m.max, trim.size, vec.long.m)
  print(mat.date)


QR.break documentation built on June 8, 2025, 1:53 p.m.