Package {cointsmall}


Type: Package
Title: Cointegration Tests with Structural Breaks in Small Samples
Version: 1.0.4
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.
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)
Config/testthat/edition: 3
Config/roxygen2/version: 8.1.0
NeedsCompilation: no
Packaged: 2026-09-28 15:23:40 UTC; root
Author: Muhammad Alkhalaf ORCID iD [aut, cre, cph]
Maintainer: Muhammad Alkhalaf <muhammedalkhalaf@gmail.com>
Repository: CRAN
Date/Publication: 2026-09-28 20:00:20 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:

References

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

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

Significance level in percent. Only 5 is available, because Trinh (2022) reports 5% critical values only.

...

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

NA; Trinh (2022) tabulates the 5% quantile only

cv05

Critical value at 5% level

cv10

NA; see cv01

pvalue

NA; p-values are not available from the published response surfaces

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

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

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.

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

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 the size-corrected 5% critical values of the ADF* test of no cointegration from the response surfaces estimated by 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 (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 NA at 1% and 10%.

Details

The critical value is

cv(T) = \psi_\infty + \sum_{k=1}^{K} \psi_k T^{-k},

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

Value

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

References

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

Examples

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