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.
You can install the development version from GitHub with:
install.packages("QR.break")
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)
= gdp[,"gdp"]
y = gdp[, c("lag1", "lag2")]
x
# Quantiles
= seq(0.20, 0.80, by = 0.150)
vec.tau = 1
N = 0.15
trim.e = gdp[,"yq"]
vec.time = 3
m.max = 2
v.a = 2
v.b options(warn=-1) #sometimes fit is non-unique
## Structural breaks in quantile regression
= rq.break(y, x, vec.tau, N, trim.e, vec.time, m.max, v.a, v.b)
result
print(result)
## Example 2
## Repeated cross-section example, using youth driving data
data(driver)
<-driver
Driving_data<- Driving_data[,"bac"]
y <- Driving_data[, c("age", "gender", "winter")]
x = seq(0.70, 0.85, 0.05)
vec.tau <- 108
N <- 0.05
trim.e <- unique(Driving_data[,"yq"])
vec.time <- 3
m.max <-2
v.a <-2
v.b options(warn=-1) #sometimes fit is non-unique
<- rq.break(y, x, vec.tau, N, trim.e, vec.time, m.max, v.a, v.b)
result