dq: Sequential Determination of the Number of Breaks Using the DQ...

View source: R/dq.R

dqR Documentation

Sequential Determination of the Number of Breaks Using the DQ Test

Description

This function determines the number of breaks in a model by sequentially applying the DQ(l | l+1) test. It tests for additional breaks by comparing the test statistic to critical values at various significance levels.

Usage

dq(
  y,
  x,
  vec.tau,
  q.L,
  q.R,
  n.size = 1,
  m.max,
  trim.size,
  mat.date,
  d.Sym,
  table.cv
)

Arguments

y

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

x

A numeric matrix of regressors (NT \times p).

vec.tau

A numeric vector of quantiles of interest.

q.L

A numeric value specifying the left-end quantile range for the DQ test.

q.R

A numeric value specifying the right-end quantile range for the DQ test.

n.size

An integer specifying the size of the cross-section (N).

m.max

An integer indicating the maximum number of breaks allowed.

trim.size

A numeric trimming value (the minimum length of a regime).

mat.date

A numeric matrix of break dates.

d.Sym

A logical value indicating whether the quantile range is symmetric satisfying q.R=1-q.L.

table.cv

A matrix of simulated critical values for cases not covered by the response surface.

Value

A list containing:

test

A numeric vector of DQ test statistics.

cv

A numeric matrix of critical values for the DQ test at 10, 5, and 1 percent significance levels.

date

A numeric matrix of estimated break dates.

nbreak

A numeric vector indicating the number of detected breaks at different significance levels.

Examples



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




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