| Title: | Comprehensive Cointegration Tests with Fourier and Panel Methods |
|---|---|
| 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>. |
| Authors: | Muhammad Abdullah Alkhalaf [aut, cre, cph] (ORCID: <https://orcid.org/0009-0002-2677-9246>) |
| Maintainer: | Muhammad Abdullah Alkhalaf <[email protected]> |
| License: | GPL-3 |
| Version: | 1.1.1 |
| Built: | 2026-11-02 13:20:29 UTC |
| Source: | https://github.com/muhammedalkhalaf/cointests |
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).
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 )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 )
y |
Numeric vector. Dependent variable. |
x |
Numeric vector or matrix. Regressors (one column per variable). |
test |
Character. |
model |
Character. |
max_freq |
Integer. Largest Fourier frequency searched (1 to 5; at
most 3 is used for the Tsong test). Default |
max_lag |
Integer. Largest lag order. |
criterion |
Character. Information criterion used by FADL to choose
the lag orders: |
adf_lags |
Character. Lag selection in the ADF regressions of FEG
and FEG2: |
dols_lags |
Integer. Leads and lags of the differenced regressors in
the DOLS regression of the Tsong test. |
lrv |
Character. Long-run variance estimator in the Tsong test:
|
bandwidth |
Integer. Bartlett bandwidth for |
The Fourier terms are and ,
. In every test the frequency is the one that
minimises the sum of squared residuals.
FADL (Banerjee, Arcabic and Lee, 2017). The ADL regression
is estimated on a common sample. For each frequency the lag orders
max_lag minimise the chosen
information criterion (one per regressor when there are at most
two regressors, a common otherwise); the statistic is the
t-ratio of . Critical values are those of the Stata module
fcoint, which attributes them to Tables 1a and 1b of the paper
( = 100, 500, 2500; interpolated linearly in between 100
and 500).
FEG (Yilanci, 2019). The regression of on a constant
(and a trend), the Fourier terms and gives residuals
; the statistic is the t-ratio of in
(no deterministic terms). Critical
values are Table 1 of Yilanci (2019) for one to three regressors and
frequencies 1 to 5 ( = 100, 500, 1000; linear interpolation in
). Two entries of that table carry evident typesetting errors and
are corrected here: the 5% value for two regressors, , trend
model, is printed as 4.620 (sign lost), and the 5% and
10% values for three regressors, , constant model,
are printed in reverse order.
FEG2. As FEG, but the ADF regression includes a constant and
, and the long-run squared correlation
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 on a constant (and a trend),
and the Fourier terms is estimated by OLS and by DOLS, and
with 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 ; the entry for four regressors,
, constant model repeats the 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.
An object of class "fcoint": a list with test,
results (one list per test), model, criterion and
nobs.
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.
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)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
## S3 method for class 'fcoint' print(x, ...)## S3 method for class 'fcoint' print(x, ...)
x |
An object of class |
... |
Further arguments passed to or from other methods (unused). |
Invisibly returns x.
Print method for xtcadfcoint objects
## S3 method for class 'xtcadfcoint' print(x, ...)## S3 method for class 'xtcadfcoint' print(x, ...)
x |
An object of class |
... |
Additional arguments (ignored). |
Invisibly returns x.
Summary method for xtcadfcoint objects
## S3 method for class 'xtcadfcoint' summary(object, ...)## S3 method for class 'xtcadfcoint' summary(object, ...)
object |
An object of class |
... |
Additional arguments (ignored). |
Invisibly returns object.
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.
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 )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 )
formula |
A formula of the form |
data |
A data frame containing the panel data in long format. |
index |
A character vector of length 2: |
model |
Integer (0–5) specifying the deterministic component:
|
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: |
nfactors |
Integer. Number of common factors for CCE. Default 1. |
brk_slope |
Logical. If |
brk_loadings |
Logical. If |
cce |
Logical. If |
simulate |
Integer. Number of Monte Carlo replications used to simulate critical values from independent Gaussian random walks at the estimated break dates (see Details); this is not a bootstrap of the data. Use 0 (default) to skip simulation. |
level |
Confidence level (in percent) for hypothesis test decisions. Default 95. |
The pooled CCE estimator (equation 13 of the paper) is computed with the
projection on the deterministic terms and the cross-section averages of
and (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 ; 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 as in that code, and the MAIC and MBIC penalties follow Ng
and Perron (2001).
Critical values depend on , , , 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).
An object of class "xtcadfcoint" with components:
Panel CIPS statistic; with breaks, computed at the
break dates Tb_hat.
Panel statistic at the alternative break dates
Tb_tilde (NULL without breaks).
Panel statistic on the Kim and Perron (2009) trimmed data (model 5 only).
Individual CADF (or ADF) t-statistics.
Selected lag orders per unit.
Pooled CCE estimates of the
cointegrating vector (regime-specific when brk_slope = TRUE).
Sums of squared residuals: levels and first differences of the defactored and of the detrended residuals.
Estimated break dates (positions in
the sample; a break at shifts the level from
).
Simulated critical values (if simulate > 0): rows
panel and individual, columns 1%, 2.5%, 5%,
10%.
Settings of the call.
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
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)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)