Panel cointegration tests allowing for structural breaks and cross-section dependence, implementing the methodology of Banerjee and Carrion-i-Silvestre (2015).
You can install the development version from GitHub:
# install.packages("devtools")
The xtbreakcoint package tests for panel cointegration when:
The methodology follows four steps:
library(xtbreakcoint)
# Generate example panel data
set.seed(42)
N <- 10 # panels
T <- 50 # time periods
panel_data <- data.frame(
id = rep(1:N, each = T),
time = rep(1:T, N),
y = NA,
x = NA
)
# Create cointegrated data with a structural break at t=25
for (i in 1:N) {
idx <- panel_data$id == i
x <- cumsum(rnorm(T))
u <- rnorm(T, sd = 0.5)
beta <- ifelse(1:T <= 25, 1, 1.5) # Break in slope
y <- 1 + beta * x + u
panel_data$x[idx] <- x
panel_data$y[idx] <- y
}
# Test for cointegration
result <- xtbreakcoint(y ~ x, data = panel_data, id = "id", time = "time")
print(result)
| Model | Name | Deterministics | |-------|------|----------------| | 1 | constant | Constant only | | 2 | trend | Constant + trend | | 3 | levelshift | Constant + level shift | | 4 | trendshift | Constant + trend + level shift (default) | | 5 | regimeshift | Constant + trend + level + slope shift |
Banerjee, A., & Carrion-i-Silvestre, J. L. (2015). Cointegration in panel data with structural breaks and cross-section dependence. Journal of Applied Econometrics, 30(1), 1-22. doi:10.1002/jae.2348
Bai, J., & Ng, S. (2004). A PANIC attack on unit roots and cointegration. Econometrica, 72(4), 1127-1177. doi:10.1111/j.1468-0262.2004.00528.x
Bai, J., & Ng, S. (2002). Determining the number of factors in approximate factor models. Econometrica, 70(1), 191-221. doi:10.1111/1468-0262.00273
Based on original GAUSS code by A. Banerjee and J.L. Carrion-i-Silvestre.
GPL (>= 3)
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.