Learn R Programming

QR.break

Structural Breaks in Quantile Regression

Overview

Methods for detecting structural breaks, determining the number of breaks, and estimating break locations in linear quantile regression. The package implements approaches based on Qu (2008) and Oka and Qu (2011), supporting both single and multiple quantiles analysis for time series and repeated cross-sectional data.

Installation

You can install the development version from GitHub with:

install.packages("QR.break")

Example

This basic example shows how to detect structural breaks in a quantile regression model:

library(QR.break)

# Example 1
# Time series example, using US GDP data
# Data
data(gdp)

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

# Quantiles
vec.tau = seq(0.20, 0.80, by = 0.150)
N = 1
trim.e = 0.15
vec.time = gdp[,"yq"]
m.max = 3
v.a = 2
v.b = 2
options(warn=-1) #sometimes fit is non-unique

## Structural breaks in quantile regression
result = rq.break(y, x, vec.tau, N, trim.e, vec.time, m.max, v.a, v.b)

print(result)



## Example 2
## Repeated cross-section example, using youth driving data
data(driver)
Driving_data<-driver
y <- Driving_data[,"bac"]
x <- Driving_data[, c("age", "gender", "winter")]
vec.tau = seq(0.70, 0.85, 0.05)
N <- 108
trim.e <- 0.05
vec.time <- unique(Driving_data[,"yq"])
m.max <- 3
v.a <-2
v.b <-2
options(warn=-1) #sometimes fit is non-unique
result <- rq.break(y, x, vec.tau, N, trim.e, vec.time, m.max, v.a, v.b)

Features

  • Structural break detection for quantile regression models
  • Support for single or multiple quantiles
  • Methods to determine the optimal number of breaks
  • Estimation of break locations
  • Compatible with time series and cross-sectional data

References

  • Qu, Z. (2008). Testing for Structural Change in Regression Quantiles. Journal of Econometrics, 146(1), 170-184.
  • Oka, T., & Qu, Z. (2011). Estimating Structural Changes in Regression Quantiles. Journal of Econometrics, 162(2), 248-267.

Copy Link

Version

Install

install.packages('QR.break')

Monthly Downloads

523

Version

1.0.1

License

GPL (>= 3)

Maintainer

Zhongjun Qu

Last Published

April 7th, 2025

Functions in QR.break (1.0.1)

rq.est.full

Estimating Break Sizes and Confidence Intervals Given Break Dates
rq.break

Testing for Breaks and Estimating Break Dates and Sizes with Confidence Intervals
sq

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

Estimating Break Dates in a Quantile Regression
gen.long

Dynamic Programming Algorithm
gdp

US Real GDP Growth Data
ci.date.m

Confidence Intervals for Break Dates
dq.test.lvsl_1

Sequential Test for Additional Breaks within a Range of Quantiles
res.surface

Compute Critical Values for the DQ test using a Response Surface
dq

Sequential Determination of the Number of Breaks Using the DQ Test
dq.test.0vs1

Test for the Presence of a Break within a Range of Quantiles
sq.test.lvsl_1

Sequential Test for an Additional Break in a Conditional Quantile
sq.test.0vs1

Test for a Structural Break in a Conditional Quantile
rq.est.regime

Regime-Specific Coefficients and Confidence Intervals Given Break Dates
QR.break

Structural Breaks in Quantile Regression
driver

The Dataset for Young Drivers