sq: Determine the Number of Breaks Using the SQ(l|l+1) Test

View source: R/sq.R

sqR Documentation

Determine the Number of Breaks Using the SQ(l|l+1) Test

Description

This procedure sequentially applies the SQ test to determine the number of breaks, based on a single quantile.

Usage

sq(y, x, v.tau, n.size = 1, m.max, trim.size, mat.date)

Arguments

y

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

x

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

v.tau

A numeric value representing the quantile of interest.

n.size

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

m.max

An integer specifying the maximum number of breaks allowed.

trim.size

A numeric value specifying the trimming size (the minimum length of a segment).

mat.date

A numeric matrix of break dates.

Value

A list with the following components:

test

A numeric vector of SQ test statistics.

cv

A numeric matrix of critical values for the SQ test, with the 1st, 2nd, and 3rd rows corresponding to the 10%, 5%, and 1% significance levels.

date

A numeric matrix of break dates, with the 1st, 2nd, and 3rd rows corresponding to the 10%, 5%, and 1% significance levels.

nbreak

A numeric vector indicating the number of breaks at the 10%, 5%, and 1% significance levels.

Examples


## data 
data(gdp)
y = gdp$gdp
x = gdp[,c("lag1", "lag2")] 

## quantile 
v.tau = 0.8 

# cross-sectional size 
n.size = 1 

# the maximum number of breaks 
m.max = 3

## trim 
T.size    = length(y)
trim.e    = 0.2
trim.size = round(T.size * trim.e)  #minimum length of a regime

# get.long 
out.long   = gen.long(y, x, v.tau, n.size, trim.size)
mat.long.s = out.long$mat.long  ## for individual quantile

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

# sq 
result = sq(y, x, v.tau, n.size, m.max, trim.size, mat.date)
print(result)



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