Learn R Programming

QR.break (version 1.0.1)

gen.long: Dynamic Programming Algorithm

Description

This function computes the objective function values for all possible segments of the sample.

Usage

gen.long(y, x, vec.tau, n.size = 1, trim.size)

Value

A list containing:

mat.long

A matrix of objective function values for separate quantiles.

vec.long

A matrix of objective function values for combined quantiles.

Arguments

y

A numeric vector of dependent variables (NT × 1).

x

A numeric matrix of regressors (NT × p).

vec.tau

A vector of quantiles of interest.

n.size

The size of the cross-section; default is set to 1.

trim.size

The minimum length of a regime (integer).

References

Bai, J and P. Perron (2003). Computation and Analysis of Multiple Structural Change Models. Journal of Applied Econometrics, 18(1), 1-22.

Examples

Run this code

# \donttest{
# This example may take substantial time for automated package checks
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

out.long   = gen.long(y, x, vec.tau, n.size, trim.size)

# }

Run the code above in your browser using DataLab