Package 'cointsmall'

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

Help Index


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:

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

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)=ψ∞+∑k=1KψkT−k,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")