sq | R Documentation |
This procedure sequentially applies the SQ test to determine the number of breaks, based on a single quantile.
sq(y, x, v.tau, n.size = 1, m.max, trim.size, mat.date)
y |
A numeric vector of dependent variables ( |
x |
A numeric matrix of regressors ( |
v.tau |
A numeric value representing the quantile of interest. |
n.size |
An integer specifying the size of the cross-section ( |
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. |
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.
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.