| 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 the size-corrected 5% critical values of the response surfaces in Trinh (2022), for up to three regressors. |
| Authors: | Muhammad Alkhalaf [aut, cre, cph] (ORCID: <https://orcid.org/0009-0002-2677-9246>) |
| Maintainer: | Muhammad Alkhalaf <[email protected]> |
| License: | GPL-3 |
| Version: | 1.0.4 |
| Built: | 2026-10-28 12:08:25 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 |
Significance level in percent. Only 5 is available, because Trinh (2022) reports 5% critical values only. |
... |
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 |
|
cv05 |
Critical value at 5% level |
cv10 |
|
pvalue |
|
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, J. (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 |
Significance level in percent. Only 5 is available, because Trinh (2022) reports 5% critical values only. |
... |
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, J. (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 the size-corrected 5% critical values of the ADF* test of no cointegration from the response surfaces estimated by 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 (1, 2 or 3). |
breaks |
Number of structural breaks (0, 1, or 2). |
model |
Model specification ("o", "c", or "cs"). |
level |
Significance level. Only 5 is available, because Trinh (2022)
reports the response surfaces for the 5% quantile only. If NULL, the
list of all levels is returned, with |
The critical value is
with the coefficients of Table 13 of Trinh (2022), estimated from 10,000 replications for T = 12 to 1,000 with the polynomial order K chosen by AIC (K at most 6). They cover m = 1, 2, 3 regressors, zero breaks (model "o"), and one or two breaks in the constant (model "c") or in the constant and the slopes (model "cs"). The resulting values reproduce Table 1 of the paper (for example -5.40 for m = 1, one break, model "cs" and T = 50).
If level is specified, returns the critical value. If NULL, returns
a named list with cv01, cv05, and cv10 (cv01 and cv10 are NA).
Trinh, J. (2022). Testing for cointegration with structural changes in very small sample. THEMA Working Paper 2022-01, CY Cergy Paris Universite. https://ideas.repec.org/p/ema/worpap/2022-01.html
# 5% critical value for m = 1 regressor, T = 30, no breaks cointsmall_cv(TT = 30, m = 1, breaks = 0, model = "o", level = 5) # One break in constant and slope, m = 2, T = 50 cointsmall_cv(TT = 50, m = 2, breaks = 1, model = "cs")# 5% critical value for m = 1 regressor, T = 30, no breaks cointsmall_cv(TT = 30, m = 1, breaks = 0, model = "o", level = 5) # One break in constant and slope, m = 2, T = 50 cointsmall_cv(TT = 50, m = 2, breaks = 1, model = "cs")