| Title: | Cointegration Tests with Structural Breaks in Small Samples |
|---|---|
| Description: | Implements cointegration tests with structural breaks designed for small sample sizes, following the methodology of Trinh (2022) <https://ideas.repec.org/p/ema/worpap/2022-01.html>. Supports models with no breaks, breaks in constant only, and breaks in both constant and slope. Provides endogenous break date detection using ADF or SSR minimization criteria, with small-sample adjusted critical values via response surface methodology. |
| Authors: | Muhammad Alkhalaf [aut, cre, cph] (ORCID: <https://orcid.org/0009-0002-2677-9246>), Hoang Huy Trinh [ctb] |
| Maintainer: | Muhammad Alkhalaf <[email protected]> |
| License: | GPL-3 |
| Version: | 1.0.2 |
| Built: | 2026-05-28 07:24:22 UTC |
| Source: | https://github.com/muhammedalkhalaf/cointsmall |
Tests for cointegration between a dependent variable and one or more independent variables, allowing for structural breaks. The method is designed specifically for small sample sizes following Trinh (2022).
cointsmall( y, x, breaks = 1, model = NULL, criterion = "adf", trim = 0.15, maxlags = -1, level = 5 ) ## S3 method for class 'cointsmall' print(x, ...) ## S3 method for class 'cointsmall' summary(object, ...)cointsmall( y, x, breaks = 1, model = NULL, criterion = "adf", trim = 0.15, maxlags = -1, level = 5 ) ## S3 method for class 'cointsmall' print(x, ...) ## S3 method for class 'cointsmall' summary(object, ...)
y |
Numeric vector of the dependent variable (must be I(1)). |
x |
Numeric vector or matrix of independent variable(s) (must be I(1)). |
breaks |
Integer specifying the number of structural breaks to test for. Must be 0, 1, or 2. Default is 1. |
model |
Character string specifying the model type:
|
criterion |
Character string specifying the criterion for break date
selection: |
trim |
Numeric value between 0 and 0.5 specifying the trimming parameter for break date search. Default is 0.15. |
maxlags |
Integer specifying the maximum number of lags for the ADF
test. If -1 (default), automatically determined using the rule
|
level |
Numeric confidence level for critical values (1, 5, or 10). Default is 5. |
... |
Additional arguments (currently unused). |
object |
A cointsmall object. |
The test follows the two-step Engle-Granger procedure with modifications for structural breaks:
Estimate the cointegrating regression (with break dummies if applicable)
Apply an ADF test to the residuals
For models with breaks, the break date(s) are determined endogenously by searching over all possible dates within the trimmed sample and selecting the date that minimizes the ADF statistic or SSR.
Critical values are computed using response surface methodology following Trinh (2022), which accounts for the small sample bias.
An object of class "cointsmall" containing:
statistic |
The ADF* test statistic |
cv |
Critical value at the specified level |
cv01 |
Critical value at 1% level |
cv05 |
Critical value at 5% level |
cv10 |
Critical value at 10% level |
pvalue |
Approximate p-value |
decision |
Character string with test decision |
reject |
Logical indicating whether to reject null hypothesis |
breaks |
Number of breaks tested |
model |
Model specification used |
criterion |
Selection criterion used |
break_dates |
Vector of estimated break date indices (if breaks > 0) |
lags |
Number of lags used in ADF test |
ssr |
Sum of squared residuals from cointegrating regression |
nobs |
Number of observations |
nvar |
Number of independent variables |
coefficients |
Estimated cointegrating coefficients |
residuals |
Residuals from cointegrating regression |
Trinh, H. H. (2022). Testing for cointegration with structural changes in very small sample. THEMA Working Paper n°2022-01, CY Cergy Paris Université. https://ideas.repec.org/p/ema/worpap/2022-01.html
# Generate cointegrated series set.seed(42) n <- 50 e <- cumsum(rnorm(n)) # Common stochastic trend y <- 2 + 3 * e + rnorm(n, sd = 0.5) x <- e + rnorm(n, sd = 0.3) # Test with no break result0 <- cointsmall(y, x, breaks = 0) print(result0) # Test with one break (break in constant and slope) result1 <- cointsmall(y, x, breaks = 1, model = "cs") print(result1) # Generate series with structural break y_break <- c(2 + 2 * e[1:25], 5 + 4 * e[26:50]) + rnorm(n, sd = 0.3) result_break <- cointsmall(y_break, x, breaks = 1) print(result_break)# Generate cointegrated series set.seed(42) n <- 50 e <- cumsum(rnorm(n)) # Common stochastic trend y <- 2 + 3 * e + rnorm(n, sd = 0.5) x <- e + rnorm(n, sd = 0.3) # Test with no break result0 <- cointsmall(y, x, breaks = 0) print(result0) # Test with one break (break in constant and slope) result1 <- cointsmall(y, x, breaks = 1, model = "cs") print(result1) # Generate series with structural break y_break <- c(2 + 2 * e[1:25], 5 + 4 * e[26:50]) + rnorm(n, sd = 0.3) result_break <- cointsmall(y_break, x, breaks = 1) print(result_break)
Performs cointegration tests under all model specifications (no break, break in constant, break in constant and slope) and provides model selection guidance.
cointsmall_combined(y, x, breaks = 1, trim = 0.15, maxlags = -1, level = 5) ## S3 method for class 'cointsmall_combined' print(x, ...) ## S3 method for class 'cointsmall_combined' summary(object, ...)cointsmall_combined(y, x, breaks = 1, trim = 0.15, maxlags = -1, level = 5) ## S3 method for class 'cointsmall_combined' print(x, ...) ## S3 method for class 'cointsmall_combined' summary(object, ...)
y |
Numeric vector of the dependent variable (must be I(1)). |
x |
Numeric vector or matrix of independent variable(s) (must be I(1)). |
breaks |
Integer specifying the number of structural breaks to test for. Must be 1 or 2. Default is 1. |
trim |
Numeric value between 0 and 0.5 specifying the trimming parameter for break date search. Default is 0.15. |
maxlags |
Integer specifying the maximum number of lags for the ADF test. If -1 (default), automatically determined. |
level |
Numeric confidence level for critical values (1, 5, or 10). Default is 5. |
... |
Additional arguments (currently unused). |
object |
A cointsmall_combined object. |
The combined procedure tests three model specifications:
Model "o": No structural break
Model "c": Break in constant only
Model "cs": Break in constant and slope
Model selection follows these rules:
If no model rejects H0: No evidence of cointegration
If exactly one model rejects H0: Select that model
If multiple models reject H0: Select the most general model that rejects H0 (cs > c > o)
An object of class "cointsmall_combined" containing:
results |
List of cointsmall objects for each model |
summary |
Data frame summarizing test statistics and decisions |
selected_model |
Character string indicating the selected model |
nobs |
Number of observations |
nvar |
Number of independent variables |
breaks |
Number of breaks tested |
Trinh, H. H. (2022). Testing for cointegration with structural changes in very small sample. THEMA Working Paper n°2022-01, CY Cergy Paris Université. https://ideas.repec.org/p/ema/worpap/2022-01.html
# Generate cointegrated series with break set.seed(123) n <- 50 e <- cumsum(rnorm(n)) x <- e + rnorm(n, sd = 0.3) y <- c(2 + 2 * e[1:25], 5 + 4 * e[26:50]) + rnorm(n, sd = 0.3) # Combined test result <- cointsmall_combined(y, x, breaks = 1) print(result)# Generate cointegrated series with break set.seed(123) n <- 50 e <- cumsum(rnorm(n)) x <- e + rnorm(n, sd = 0.3) y <- c(2 + 2 * e[1:25], 5 + 4 * e[26:50]) + rnorm(n, sd = 0.3) # Combined test result <- cointsmall_combined(y, x, breaks = 1) print(result)
Computes critical values for the small-sample cointegration test using response surface methodology following Trinh (2022).
cointsmall_cv(TT, m, breaks = 0, model = "o", level = NULL)cointsmall_cv(TT, m, breaks = 0, model = "o", level = NULL)
TT |
Sample size. |
m |
Number of independent variables in the cointegrating regression. |
breaks |
Number of structural breaks (0, 1, or 2). |
model |
Model specification ("o", "c", or "cs"). |
level |
Significance level (1, 5, or 10). If NULL, returns all levels. |
Critical values are computed using response surface equations that account for:
Small sample sizes (TT)
Number of regressors (m)
Number of structural breaks
Model specification (level shift vs. regime shift)
The response surface follows the general form:
where the coefficients depend on m, breaks, and model.
For model "o" (no breaks), critical values are based on Engle-Granger (1987) and MacKinnon (1991, 2010) response surfaces.
For models with breaks, critical values incorporate adjustments from Gregory-Hansen (1996), Hatemi-J (2008), and small-sample corrections from Trinh (2022).
If level is specified, returns the critical value. If NULL, returns a named list with cv01, cv05, and cv10.
Trinh, H. H. (2022). Testing for cointegration with structural changes in very small sample. THEMA Working Paper n°2022-01, CY Cergy Paris Université. https://ideas.repec.org/p/ema/worpap/2022-01.html
MacKinnon, J. G. (2010). Critical values for cointegration tests. Queen's Economics Department Working Paper No. 1227. doi:10.22004/ag.econ.279422
# Critical values for m=1 regressor, TT=30, no breaks cointsmall_cv(TT = 30, m = 1, breaks = 0, model = "o") # Critical values with one break (model cs) cointsmall_cv(TT = 50, m = 2, breaks = 1, model = "cs")# Critical values for m=1 regressor, TT=30, no breaks cointsmall_cv(TT = 30, m = 1, breaks = 0, model = "o") # Critical values with one break (model cs) cointsmall_cv(TT = 50, m = 2, breaks = 1, model = "cs")