Type: Package
Title: Cointegration Tests with Structural Breaks in Small Samples
Version: 1.0.2
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.
License: GPL-3
URL: https://github.com/muhammedalkhalaf/cointsmall
BugReports: https://github.com/muhammedalkhalaf/cointsmall/issues
Encoding: UTF-8
Depends: R (≥ 3.5.0)
Imports: stats
Suggests: testthat (≥ 3.0.0)
RoxygenNote: 7.3.1
Config/testthat/edition: 3
NeedsCompilation: no
Packaged: 2026-03-13 20:45:25 UTC; acad_
Author: Muhammad Alkhalaf ORCID iD [aut, cre, cph], Hoang Huy Trinh [ctb]
Maintainer: Muhammad Alkhalaf <muhammedalkhalaf@gmail.com>
Repository: CRAN
Date/Publication: 2026-03-19 14:00:02 UTC

cointsmall: Cointegration Tests with Structural Breaks in Small Samples

Description

The cointsmall package implements cointegration tests designed for small sample sizes with potential structural breaks. It follows the methodology of Trinh (2022), which provides small-sample adjusted critical values for testing the null hypothesis of no cointegration.

Main Functions

cointsmall

Main function to perform cointegration tests with optional structural breaks

cointsmall_combined

Combined testing procedure that evaluates all model specifications

cointsmall_cv

Retrieve critical values for different model specifications

Models

Three model specifications are supported:

Model "o"

No structural break - standard cointegration test

Model "c"

Break in constant only - shift in intercept at break date

Model "cs"

Break in constant and slope - shift in both intercept and cointegrating coefficients

Author(s)

Maintainer:

Other contributors:

References

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

Gregory, A. W., & Hansen, B. E. (1996). Residual-based tests for cointegration in models with regime shifts. Journal of Econometrics, 70(1), 99-126. doi:10.1016/0304-4076(69)41685-7

Hatemi-J, A. (2008). Tests for cointegration with two unknown regime shifts with an application to financial market integration. Empirical Economics, 35(3), 497-505. doi:10.1007/s00181-007-0175-9

Engle, R. F., & Granger, C. W. J. (1987). Co-integration and error correction: Representation, estimation, and testing. Econometrica, 55(2), 251-276. doi:10.2307/1913236


Cointegration Test with Structural Breaks in Small Samples

Description

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).

Usage

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, ...)

Arguments

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:

"o"

No structural break (only valid when breaks = 0)

"c"

Break in constant only

"cs"

Break in constant and slope (default for breaks > 0)

criterion

Character string specifying the criterion for break date selection: "adf" (minimize ADF statistic) or "ssr" (minimize sum of squared residuals). Default is "adf".

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 floor(12*(TT/100)^0.25).

level

Numeric confidence level for critical values (1, 5, or 10). Default is 5.

...

Additional arguments (currently unused).

object

A cointsmall object.

Details

The test follows the two-step Engle-Granger procedure with modifications for structural breaks:

  1. Estimate the cointegrating regression (with break dummies if applicable)

  2. 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.

Value

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

References

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

Examples

# 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)


Combined Cointegration Testing Procedure

Description

Performs cointegration tests under all model specifications (no break, break in constant, break in constant and slope) and provides model selection guidance.

Usage

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, ...)

Arguments

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.

Details

The combined procedure tests three model specifications:

  1. Model "o": No structural break

  2. Model "c": Break in constant only

  3. Model "cs": Break in constant and slope

Model selection follows these rules:

Value

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

References

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

Examples

# 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)


Critical Values for Cointegration Tests with Structural Breaks

Description

Computes critical values for the small-sample cointegration test using response surface methodology following Trinh (2022).

Usage

cointsmall_cv(TT, m, breaks = 0, model = "o", level = NULL)

Arguments

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.

Details

Critical values are computed using response surface equations that account for:

The response surface follows the general form:

cv = c_\infty + c_1/TT + c_2/TT^2

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).

Value

If level is specified, returns the critical value. If NULL, returns a named list with cv01, cv05, and cv10.

References

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

Examples

# 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")