Package {cointests}


Type: Package
Title: Comprehensive Cointegration Tests with Fourier and Panel Methods
Version: 1.1.0
Description: A unified toolkit for cointegration testing including Fourier-based cointegration tests (FADL, FEG, FEG2, Tsong) that accommodate smooth structural breaks via flexible Fourier terms, and panel CADF cointegration tests with structural breaks using the Common Correlated Effects (CCE) estimator following Banerjee, Arcabic and Lee (2017) <doi:10.1016/j.econmod.2016.11.004>, Tsong, Lee, Tsai and Hu (2016) <doi:10.1007/s00181-015-1028-6>, and Banerjee and Carrion-i-Silvestre (2025) <doi:10.1080/07350015.2024.2327844>.
License: GPL-3
Encoding: UTF-8
RoxygenNote: 7.3.2
Depends: R (≥ 3.5.0)
Imports: stats
Suggests: testthat (≥ 3.0.0)
Config/testthat/edition: 3
NeedsCompilation: no
Packaged: 2026-09-28 16:56:12 UTC; root
Author: Muhammad Abdullah Alkhalaf ORCID iD [aut, cre, cph]
Maintainer: Muhammad Abdullah Alkhalaf <muhammedalkhalaf@gmail.com>
Repository: CRAN
Date/Publication: 2026-09-29 10:20:11 UTC

Fourier Cointegration Tests for Time Series

Description

Residual-based and ADL-based cointegration tests in which smooth structural change in the deterministic component is approximated by a single-frequency Fourier function: the Fourier ADL test (FADL), the Fourier Engle-Granger test (FEG), a covariate-augmented variant (FEG2), and the Fourier test for the null of cointegration of Tsong et al. (2016).

Usage

fcoint(
  y,
  x,
  test = c("fadl", "feg", "feg2", "tsong", "all"),
  model = c("constant", "trend"),
  max_freq = 5L,
  max_lag = 0L,
  criterion = c("aic", "bic"),
  adf_lags = c("tsig", "aic", "bic"),
  dols_lags = 0L,
  lrv = c("iid", "bartlett"),
  bandwidth = NULL
)

Arguments

y

Numeric vector. Dependent variable.

x

Numeric vector or matrix. Regressors (one column per variable).

test

Character. "fadl", "feg", "feg2", "tsong" or "all". Default "fadl".

model

Character. "constant" (default) or "trend".

max_freq

Integer. Largest Fourier frequency searched (1 to 5; at most 3 is used for the Tsong test). Default 5.

max_lag

Integer. Largest lag order. 0 (default) selects a default: 6 for FADL and floor(12 * (T/100)^0.25) for FEG and FEG2.

criterion

Character. Information criterion used by FADL to choose the lag orders: "aic" (default) or "bic".

adf_lags

Character. Lag selection in the ADF regressions of FEG and FEG2: "tsig" (default; general-to-specific, dropping the last lag while its absolute t-ratio is below 1.645), "aic" or "bic".

dols_lags

Integer. Leads and lags of the differenced regressors in the DOLS regression of the Tsong test. 0 (default) uses floor(4 * (T/100)^(2/9)).

lrv

Character. Long-run variance estimator in the Tsong test: "iid" (default) or "bartlett".

bandwidth

Integer. Bartlett bandwidth for lrv = "bartlett". NULL (default) uses round(4 * (T/100)^(2/9)).

Details

The Fourier terms are \sin(2\pi k t/T) and \cos(2\pi k t/T), t = 1, \dots, T. In every test the frequency is the one that minimises the sum of squared residuals.

FADL (Banerjee, Arcabic and Lee, 2017). The ADL regression

\Delta y_t = d(t) + \delta y_{t-1} + \gamma' x_{t-1} + \sum_{j=0}^{q} \phi_j' \Delta x_{t-j} + \sum_{i=1}^{p} \alpha_i \Delta y_{t-i} + e_t

is estimated on a common sample. For each frequency the lag orders p, q \in \{1, \dots, max_lag\} minimise the chosen information criterion (one q per regressor when there are at most two regressors, a common q otherwise); the statistic is the t-ratio of \delta. Critical values are those of the Stata module fcoint, which attributes them to Tables 1a and 1b of the paper (T = 100, 500, 2500; interpolated linearly in T between 100 and 500).

FEG (Yilanci, 2019). The regression of y_t on a constant (and a trend), the Fourier terms and x_t gives residuals \hat u_t; the statistic is the t-ratio of \rho in \Delta\hat u_t = \rho\hat u_{t-1} + \sum_{i=1}^{p}\gamma_i \Delta\hat u_{t-i} + \varepsilon_t (no deterministic terms). Critical values are Table 1 of Yilanci (2019) for one to three regressors and frequencies 1 to 5 (T = 100, 500, 1000; linear interpolation in T). Two entries of that table carry evident typesetting errors and are corrected here: the 5% value for two regressors, k = 3, trend model, T = 500 is printed as 4.620 (sign lost), and the 5% and 10% values for three regressors, k = 4, constant model, T = 1000 are printed in reverse order.

FEG2. As FEG, but the ADF regression includes a constant and \Delta x_t, and the long-run squared correlation \rho^2 between the FEG and FEG2 errors is reported. The Stata module attributes this test and its critical values to an unpublished working paper by Banerjee and Lee, whose tables could not be verified (the Stata table also fills several cells by copying other cells). No critical values are therefore reported for FEG2.

Tsong et al. (2016). Following the TSPDLIB implementation of Nazlioglu, the regression of y_t on a constant (and a trend), x_t and the Fourier terms is estimated by OLS and by DOLS, and CI_f = T^{-2}\sum_t S_t^2/\hat\omega^2 with S_t the partial sums of the residuals. Large values reject the null of cointegration. Critical values (DOLS statistic) are the TSPDLIB table for up to four regressors and k \le 3; the entry for four regressors, k = 3, constant model repeats the k = 2 row in TSPDLIB and differs from the Stata module, so it is reported as NA. The F statistics for the Fourier terms are reported without critical values.

Value

An object of class "fcoint": a list with test, results (one list per test), model, criterion and nobs.

References

Banerjee, P., Arcabic, V. and Lee, H. (2017). Fourier ADL cointegration test to approximate smooth breaks with new evidence from crude oil market. Economic Modelling, 67, 114-124. doi:10.1016/j.econmod.2016.11.004

Tsong, C.-C., Lee, C.-F., Tsai, L.-J. and Hu, T.-C. (2016). The Fourier approximation and testing for the null of cointegration. Empirical Economics, 51(3), 1085-1113. doi:10.1007/s00181-015-1028-6

Yilanci, V. (2019). A residual-based cointegration test with a Fourier approximation. MPRA Paper No. 95395, University Library of Munich.

Examples

set.seed(42)
n <- 100
x <- cumsum(rnorm(n))
y <- 1 + 0.5 * x + sin(2 * pi * (1:n) / n) + rnorm(n, sd = 0.3)
fcoint(y, x, test = "feg", max_freq = 3)


Print Method for fcoint Objects

Description

Print Method for fcoint Objects

Usage

## S3 method for class 'fcoint'
print(x, ...)

Arguments

x

An object of class "fcoint".

...

Further arguments passed to or from other methods (unused).

Value

Invisibly returns x.


Print method for xtcadfcoint objects

Description

Print method for xtcadfcoint objects

Usage

## S3 method for class 'xtcadfcoint'
print(x, ...)

Arguments

x

An object of class "xtcadfcoint".

...

Additional arguments (ignored).

Value

Invisibly returns x.


Summary method for xtcadfcoint objects

Description

Summary method for xtcadfcoint objects

Usage

## S3 method for class 'xtcadfcoint'
summary(object, ...)

Arguments

object

An object of class "xtcadfcoint".

...

Additional arguments (ignored).

Value

Invisibly returns object.


Panel CADF Cointegration Test with Structural Breaks

Description

Tests the null hypothesis of no cointegration in panel data using the cross-sectionally augmented Dickey-Fuller (CADF) approach of Banerjee and Carrion-i-Silvestre (2025). Accounts for cross-sectional dependence via the Common Correlated Effects (CCE) estimator and allows for structural breaks.

Usage

xtcadfcoint(
  formula,
  data,
  index,
  model = 1L,
  breaks = 0L,
  trimming = 0.15,
  maxlags = 4L,
  lagselect = "bic",
  nfactors = 1L,
  brk_slope = FALSE,
  brk_loadings = FALSE,
  cce = TRUE,
  simulate = 0L,
  level = 95L
)

Arguments

formula

A formula of the form y ~ x1 + x2 + ... specifying the cointegrating relationship to test.

data

A data frame containing the panel data in long format.

index

A character vector of length 2: c("id_var", "time_var").

model

Integer (0–5) specifying the deterministic component:

  • 0: No deterministic component

  • 1: Constant (default)

  • 2: Linear trend

  • 3: Constant with level shifts (requires breaks >= 1)

  • 4: Linear trend with level shifts (requires breaks >= 1)

  • 5: Linear trend with level and slope shifts (requires breaks >= 1)

breaks

Integer (0, 1, or 2). Number of structural breaks. Default is 0.

trimming

Numeric trimming fraction for break date search. Default 0.15.

maxlags

Maximum lag order for ADF augmentation. Default 4.

lagselect

Lag selection method: "bic" (default), "aic", "maic", "mbic", or "fixed".

nfactors

Integer. Number of common factors for CCE. Default 1.

brk_slope

Logical. If TRUE, allows breaks in the cointegrating vector slopes. Default FALSE.

brk_loadings

Logical. If TRUE, allows breaks in factor loadings. Default FALSE.

cce

Logical. If TRUE (default), applies CCE cross-sectional augmentation to account for common factors.

simulate

Integer. Number of bootstrap replications for critical value simulation. Use 0 (default) to skip simulation.

level

Confidence level (in percent) for hypothesis test decisions. Default 95.

Details

The pooled CCE estimator (equation 13 of the paper) is computed with the projection on the deterministic terms and the cross-section averages of y and x (interacted with the break dummies when brk_loadings = TRUE). With breaks, the break dates are chosen by a grid search: Tb_hat minimises the sum of squared defactored residuals (equation 14) and Tb_tilde the sum of squared residuals after removing only the deterministic terms (equations 15 and 16). Each unit's statistic is the t-ratio of the lagged residual in the cross-section augmented ADF regression (equation 17), with impulse dummies at T_b + 1; nfactors sets how many cross-section averages enter. For model 5 the statistic is also computed on data trimmed by three observations on each side of the break (Kim and Perron, 2009), with maxlags fixed lags.

The computations reproduce the Stata module xtcadfcoint, which states that it translates the authors' GAUSS code; results were checked against it. The information criteria and the residual variance use the full T as in that code, and the MAIC and MBIC penalties follow Ng and Perron (2001).

Critical values depend on N, T, k, the model and the break fractions (Tables B.1 to B.24 of the supplementary material of the paper cover one break). simulate draws them from independent random walks at the estimated break dates Tb_hat, without lag augmentation. The Stata module instead fixes the break fractions at 0.5 (one break) or 0.3 and 0.7 (two breaks).

Value

An object of class "xtcadfcoint" with components:

panel_cips

Panel CIPS statistic; with breaks, computed at the break dates Tb_hat.

panel_cips_alt

Panel statistic at the alternative break dates Tb_tilde (NULL without breaks).

panel_cips_trim

Panel statistic on the Kim and Perron (2009) trimmed data (model 5 only).

t_individual, t_trim

Individual CADF (or ADF) t-statistics.

p_selected

Selected lag orders per unit.

beta_ccep, beta_ccep_alt

Pooled CCE estimates of the cointegrating vector (regime-specific when brk_slope = TRUE).

SSR

Sums of squared residuals: levels and first differences of the defactored and of the detrended residuals.

Tb_hat, Tb_tilde, Tb_trim

Estimated break dates (positions in the sample; a break at T_b shifts the level from T_b + 1).

cv

Simulated critical values (if simulate > 0): rows panel and individual, columns 1%, 2.5%, 5%, 10%.

N, TT, k, model, breaks, ...

Settings of the call.

References

Banerjee, A. and Carrion-i-Silvestre, J.L. (2025). Panel Data Cointegration Testing with Structural Instabilities. Journal of Business & Economic Statistics, 43(1), 122–133. doi:10.1080/07350015.2024.2327844

Kim, D. and Perron, P. (2009). Unit root tests allowing for a break in the trend function at an unknown time under both the null and alternative hypotheses. Journal of Econometrics, 148(1), 1–13. doi:10.1016/j.jeconom.2008.08.019

Ng, S. and Perron, P. (2001). Lag length selection and the construction of unit root tests with good size and power. Econometrica, 69(6), 1519–1554. doi:10.1111/1468-0262.00256

Pesaran, M.H. (2006). Estimation and Inference in Large Heterogeneous Panels with a Multifactor Error Structure. Econometrica, 74(4), 967–1012. doi:10.1111/j.1468-0262.2006.00692.x

Examples


set.seed(42)
n <- 8; tt <- 30
dat <- data.frame(
  id   = rep(1:n, each = tt),
  time = rep(1:tt, times = n),
  y    = cumsum(rnorm(n * tt)),
  x1   = cumsum(rnorm(n * tt))
)
res <- xtcadfcoint(y ~ x1, data = dat, index = c("id", "time"),
                   model = 1, breaks = 0)
print(res)
summary(res)