gen.long: Dynamic Programming Algorithm

View source: R/gen.long.R

gen.longR Documentation

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)

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

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.

References

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

Examples



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




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