Package {ardlverse}


Type: Package
Title: Comprehensive ARDL: Panel, Bootstrap and Fourier Methods
Version: 2.1.0
Date: 2026-10-03
Description: A unified framework for Autoregressive Distributed Lag (ARDL) modeling and cointegration analysis. Implements Panel ARDL with Pooled Mean Group (PMG), Mean Group (MG), and Dynamic Fixed Effects (DFE) estimators following Pesaran, Shin and Smith (1999) <doi:10.1080/01621459.1999.10474156>. Provides the bounds test of Pesaran, Shin and Smith (2001) <doi:10.1002/jae.616> with the critical values of Kripfganz and Schneider (2020) <doi:10.1111/obes.12377> and with recursive bootstrap critical values following Bertelli, Vacca and Zoia (2022) <doi:10.1016/j.econmod.2022.105987> and McNown, Sam and Goh (2018) <doi:10.1080/00036846.2017.1366643>. Includes Quantile Nonlinear ARDL (QNARDL) combining distributional and asymmetric effects based on Shin, Yu and Greenwood-Nimmo (2014) <doi:10.1007/978-1-4899-8008-3_9>, Fourier ARDL for modeling smooth structural breaks following Enders and Lee (2012) <doi:10.1016/j.econlet.2012.04.081>, and Fourier (bootstrap) nonlinear ARDL. Features include Augmented ARDL (AARDL) with deferred t and F tests, Multiple-Threshold NARDL for complex asymmetries, Rolling/Recursive ARDL for time-varying relationships, and Panel NARDL for nonlinear panel cointegration. All methods include comprehensive diagnostics, publication-ready outputs, and visualization tools.
License: GPL-3
URL: https://github.com/muhammedalkhalaf/ardlverse
BugReports: https://github.com/muhammedalkhalaf/ardlverse/issues
Encoding: UTF-8
LazyData: true
Depends: R (≥ 4.0.0)
Imports: stats, MASS, quantreg, lmtest, ggplot2, gridExtra, graphics, grDevices
Suggests: testthat (≥ 3.0.0), knitr, rmarkdown, covr
RoxygenNote: 7.3.3
Config/testthat/edition: 3
NeedsCompilation: no
Packaged: 2026-10-03 16:38:49 UTC; root
Author: Muhammad Abdullah Alkhalaf ORCID iD [aut, cre], Yeleazar Levchenko [ctb] (Bug fixes and PMG/MG/DFE corrections for panel_ardl in v2.0.0 (KSE))
Maintainer: Muhammad Abdullah Alkhalaf <muhammedalkhalaf@gmail.com>
Repository: CRAN
Date/Publication: 2026-10-10 08:00:15 UTC

Comprehensive ARDL Modeling Framework

Description

A unified framework for Autoregressive Distributed Lag (ARDL) modeling and cointegration analysis. Implements Panel ARDL with Pooled Mean Group (PMG), Mean Group (MG), and Dynamic Fixed Effects (DFE) estimators. Provides bootstrap-based bounds testing for small samples, Quantile Nonlinear ARDL (QNARDL) combining distributional and asymmetric effects, and Fourier ARDL for modeling smooth structural breaks.

Details

The main functions are:

Supporting functions:

Data generation for examples:

Author(s)

Muhammad Abdullah Alkhalaf <muhammedalkhalaf@gmail.com>

Maintainer: Muhammad Abdullah Alkhalaf <muhammedalkhalaf@gmail.com>

References

Pesaran, M. H., Shin, Y. and Smith, R. P. (1999). Pooled mean group estimation of dynamic heterogeneous panels. Journal of the American Statistical Association.

Pesaran, M. H., Shin, Y. and Smith, R. J. (2001). Bounds testing approaches to the analysis of level relationships. Journal of Applied Econometrics.

Shin, Y., Yu, B. and Greenwood-Nimmo, M. (2014). Modelling asymmetric cointegration and dynamic multipliers in a nonlinear ARDL framework.

Cho, J. S., Kim, T. H. and Shin, Y. (2015). Quantile cointegration in the autoregressive distributed-lag modeling framework. Journal of Econometrics.

Banerjee, P., Arcabic, V. and Lee, H. (2017). Fourier ADL cointegration test. Economic Modelling.

Examples


# Panel ARDL
data <- generate_panel_data()
model <- panel_ardl(gdp ~ inflation + investment, data = data,
                    id = "country", time = "year", estimator = "pmg")
summary(model)

# Bootstrap bounds test
ts_data <- generate_ts_data()
boot <- boot_ardl(gdp ~ investment, data = ts_data, nboot = 99, seed = 1)
summary(boot)

# QNARDL
oil <- generate_oil_data()
qmodel <- qnardl(gasoline ~ oil_price, data = oil, tau = c(0.25, 0.5, 0.75))
asymmetry_test(qmodel, var = "oil_price")


AARDL Conclusion

Description

Bootstrap decision (F_pss, t_dep and F_ind must all reject; degenerate cases labelled), Kripfganz and Schneider (2020) bounds decision for the models without Fourier terms, and no decision for the Fourier models without bootstrap.

Usage

.aardl_conclusion(F_pss, t_dep, F_ind, cv, boot = NULL, fourier = FALSE)

AARDL Critical Values

Description

Bounds for the overall F and the t test from the response surfaces of Kripfganz and Schneider (2020). The F test on the lagged regressors has no tabulated bounds; the bootstrap types give critical values for it.

Usage

.aardl_critical_values(k, case, n, sr = 0)

Design matrix of aardl()

Description

Design matrix of aardl()

Usage

.aardl_design(y, X0, spec)

Statistics of aardl(): F_pss (Fov), t_dep (t) and F_ind (Find)

Description

Statistics of aardl(): F_pss (Fov), t_dep (t) and F_ind (Find)

Usage

.aardl_stats(dy, design, k, case)

ARCH Test

Description

ARCH Test

Usage

.arch_test(resid, lags)

Statistics of boot_ardl on a (bootstrap) sample

Description

Fov, t and Find with the design of boot_ardl().

Usage

.boot_ardl_stats(y, X, x_vars, p, q, case)

Breusch-Godfrey Serial Correlation Test

Description

Breusch-Godfrey Serial Correlation Test

Usage

.breusch_godfrey_test(resid, order = 2)

Breusch-Pagan Heteroskedasticity Test

Description

Breusch-Pagan Heteroskedasticity Test

Usage

.breusch_pagan_test(model)

Cluster Nearby Breaks

Description

Cluster Nearby Breaks

Usage

.cluster_breaks(breaks, min_gap = 5)

Compute Overall F-statistic

Description

Compute Overall F-statistic

Usage

.compute_F_overall(model_ur, model_r, k, case)

Compute F-statistic for Bounds Test

Description

Compute F-statistic for Bounds Test

Usage

.compute_F_stat(model_ur, model_r, k, case)

Compute Multiple-Threshold Dynamic Multipliers

Description

Cumulative dynamic multipliers by the full recursion of the estimated ECM (see .ecm_multiplier).

Usage

.compute_mt_multipliers(coefs, fit, regime_names, horizons = 30)

Compute t-statistic for EC Coefficient

Description

Compute t-statistic for EC Coefficient

Usage

.compute_t_stat(model_ur)

Create Fourier Terms

Description

Create Fourier Terms

Usage

.create_fourier_terms(n, k)

CUSUM Test

Description

CUSUM Test

Usage

.cusum_test(resid)

CUSUM of Squares Test

Description

CUSUM of Squares Test

Usage

.cusumsq_test(resid)

Decompose Variables for Asymmetric Analysis

Description

Decompose Variables for Asymmetric Analysis

Usage

.decompose_asymmetric(X, threshold = 0)

Demean Panel Data

Description

Demean Panel Data

Usage

.demean_panel(data, y_var, x_vars, id)

Detect Structural Breaks

Description

Detect Structural Breaks

Usage

.detect_ardl_breaks(F_stats, ec_coefs, lr_coefs)

Detect Fourier Structural Breaks

Description

Detect Fourier Structural Breaks

Usage

.detect_fourier_breaks(fourier_coefs, n, k)

Estimate Restricted ARDL Model

Description

Estimate Restricted ARDL Model

Usage

.estimate_ardl_restricted(ardl_data, case)

Estimate Unrestricted ARDL Model

Description

Estimate Unrestricted ARDL Model

Usage

.estimate_ardl_unrestricted(ardl_data, case)

Estimate ARDL for Single Window

Description

Estimate ARDL for Single Window

Usage

.estimate_ardl_window(data, y_var, x_vars, p, q, case)

Internal Fourier ARDL Estimation

Description

Internal Fourier ARDL Estimation

Usage

.estimate_fourier_ardl(data, y_var, x_vars, p, q, k, case)

Estimate QNARDL for Single Quantile

Description

Estimate QNARDL for Single Quantile

Usage

.estimate_qnardl_tau(model_data, y_col, x_cols, tau)

Estimate Unit NARDL

Description

Estimate Unit NARDL

Usage

.estimate_unit_nardl(data, y_var, x_vars, p, q)

Extract Long-Run Coefficients

Description

Extract Long-Run Coefficients

Usage

.extract_long_run(results_by_tau, level_vars, tau)

Generate Fourier Terms

Description

Generate Fourier Terms

Usage

.generate_fourier_terms(n, k)

Jarque-Bera Test

Description

Jarque-Bera Test

Usage

.jarque_bera_test(resid)

Make Regime Names

Description

Make Regime Names

Usage

.make_regime_names(x_vars, thresholds)

Manual Breusch-Godfrey Test

Description

Manual Breusch-Godfrey Test

Usage

.manual_bg_test(resid, lags)

Manual Breusch-Pagan Test

Description

Manual Breusch-Pagan Test

Usage

.manual_bp_test(resid, fitted)

Multiple-Threshold Decomposition

Description

Regime partial sums: regime r of a column collects its change when it lies between thresholds r - 1 (excluded) and r (included), with the change at the first observation set to zero. thresholds is a numeric vector used for every column, or a list with one vector per column.

Usage

.mt_decompose(X, thresholds)

MT-NARDL Bounds Test Conclusion

Description

Bootstrap decision (Fov, t and Find must all reject) or Kripfganz and Schneider (2020) bounds decision on F and t.

Usage

.mtnardl_bounds_conclusion(F_stat, t_stat, cv, boot = NULL)

Package Startup

Description

Functions run on package load

Usage

.onLoad(libname, pkgname)

Panel Hausman Test

Description

Panel Hausman Test

Usage

.panel_hausman_test(pmg_result, mg_result)

Panel NARDL Decomposition

Description

Panel NARDL Decomposition

Usage

.panel_nardl_decompose(data, x_vars, id, time, threshold)

Panel NARDL Bootstrap

Description

Panel NARDL Bootstrap

Usage

.pnardl_bootstrap(
  data,
  y_var,
  x_vars,
  id,
  time,
  p,
  q,
  estimator,
  effect,
  nboot,
  groups
)

Panel NARDL DFE Estimator

Description

Panel NARDL DFE Estimator

Usage

.pnardl_dfe(data, y_var, x_vars, orig_vars, id, time, p, q, effect, k)

Panel NARDL MG Estimator

Description

Panel NARDL MG Estimator

Usage

.pnardl_mg(data, y_var, x_vars, orig_vars, id, time, p, q, effect, k, groups)

Panel NARDL PMG Estimator

Description

Panel NARDL PMG Estimator

Usage

.pnardl_pmg(data, y_var, x_vars, orig_vars, id, time, p, q, effect, k)

Prepare Time Series Data for ARDL

Description

Prepare Time Series Data for ARDL

Usage

.prepare_ardl_ts_data(data, y_var, x_vars, p, q, case)

Prepare Fourier ARDL Data

Description

Prepare Fourier ARDL Data

Usage

.prepare_fourier_data(data, y_var, x_vars, p, q, k, case)

Prepare QNARDL Data with Partial Sum Decomposition

Description

Prepare QNARDL Data with Partial Sum Decomposition

Usage

.prepare_qnardl_data(data, y_var, x_vars, decompose, p, q, trend)

PSS bounds test p-values (Kripfganz and Schneider, 2020)

Description

PSS bounds test p-values (Kripfganz and Schneider, 2020)

Usage

.pss_pvalues(F_stat, t_stat, k, case, n = NULL, sr = 0)

Select Optimal Thresholds

Description

With one threshold, the value minimising the AIC of the MT-NARDL model over 0 and the deciles of the changes of the first decomposed variable; with more, equally spaced quantiles of those changes.

Usage

.select_optimal_thresholds(y, X, n_thresholds, p, q, case, x_vars, decompose)

Significance Stars Helper

Description

Significance Stars Helper

Usage

.signif_stars(p)

Stack Long-Run Data for PMG

Description

Stack Long-Run Data for PMG

Usage

.stack_lr_data(data, y_var, x_vars, id, time, phi, sr_results, groups)

Test for Long-Run Asymmetry

Description

Test for Long-Run Asymmetry

Usage

.test_asymmetry(results_by_tau, var, tau)

Test Panel Asymmetry

Description

Test Panel Asymmetry

Usage

.test_panel_asymmetry(result, x_vars, k)

Test Regime Asymmetry

Description

Pairwise and joint Wald tests of equal level coefficients (equivalently equal long-run coefficients) across the regimes of each decomposed variable, and delta-method differences of the long-run coefficients.

Usage

.test_regime_asymmetry(coefs, vcov_mat, lr_coefs, VL, fit, decompose)

Augmented ARDL Bounds Test (AARDL)

Description

Augmented ARDL bounds test with the overall F test, the t test on the lagged dependent variable and the F test on the lagged independent variables, in linear, nonlinear (NARDL) and Fourier variants, with Kripfganz and Schneider (2020) bounds or bootstrap critical values.

Usage

aardl(
  formula,
  data,
  p = 1,
  q = 1,
  case = 3,
  type = c("linear", "nardl", "fourier", "fnardl", "bootstrap", "bnardl", "fbootstrap",
    "fbnardl"),
  nboot = 2000,
  fourier_k = 1,
  threshold = 0,
  seed = NULL,
  nulls = c("separate", "joint")
)

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

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

Arguments

formula

A formula such as gdp ~ investment + trade; only plain variable names are accepted.

data

A data frame containing the time series (no missing values).

p

Integer. Number of lagged differences of the dependent variable (default: 1)

q

Integer or vector. Number of differences of each regressor, lags 0 to q - 1 (default: 1)

case

Integer from 1-5 specifying deterministic components

type

Character. Model type: "linear", "nardl", "fourier", "fnardl", "bootstrap", "bnardl", "fbootstrap", "fbnardl" (default: "linear")

nboot

Number of bootstrap replications (default: 2000)

fourier_k

Integer. Number of Fourier frequencies (default: 1, max: 3)

threshold

Numeric. Threshold value for NARDL decomposition (default: 0)

seed

Random seed; used locally, the session's random number generator state is restored afterwards.

nulls

Bootstrap nulls, "separate" (default) or "joint"; see boot_ardl.

x, object

An object of class "aardl"

...

Not used

Details

Three statistics are computed from the conditional error correction model:

The function supports 8 sub-models:

  1. "linear": ARDL, Kripfganz and Schneider (2020) bounds for F_pss and t_dep (F_ind has no tabulated bounds)

  2. "nardl": NARDL with positive and negative partial sums; the bounds use k = number of partial sums

  3. "fourier": ARDL with Fourier terms. No valid bounds exist for the bounds test with Fourier terms; no decision is reported and the bounds shown are those of the model without Fourier terms, for reference only (as in fourier_bounds_test)

  4. "fnardl": NARDL with Fourier terms; as "fourier"

  5. "bootstrap": ARDL with bootstrap critical values

  6. "bnardl": NARDL with bootstrap critical values

  7. "fbootstrap": Fourier ARDL with bootstrap critical values

  8. "fbnardl": Fourier NARDL with bootstrap critical values

The bootstrap types use the recursive bootstrap of boot_ardl (separate nulls of Bertelli, Vacca and Zoia, 2022, by default, or the Fov null for all statistics of McNown, Sam and Goh, 2018, applied to the conditional ECM, a package choice): y* and x* are generated recursively, the partial sums are rebuilt from x* with the same decomposition as the data, and the Fourier terms at the chosen fourier_k are held fixed. The decision requires F_pss, t_dep and F_ind to reject; the degenerate cases are labelled. With Fourier terms the bootstrap is valid for the given fourier_k; it does not account for a data-based choice of fourier_k. With Fourier terms and partial sums (type "fbnardl") the F_ind test of the separate-null bootstrap over-rejects: in a Monte Carlo with independent random walks (n = 100, 200 samples, B = 199) it rejected in 16.0% (Monte Carlo s.e. 2.6%) of the samples at the 5% level, and an independent review Monte Carlo gave 11.3% (s.e. 1.8%); the combined decision rejected in 6.0% (s.e. 1.7%). The name follows the augmented ARDL bounds test of Sam, McNown and Goh (2019); that paper was not available for this release, so its bootstrap details are not reproduced here (pending verification): the bootstrap is the one of Bertelli, Vacca and Zoia (2022) or McNown, Sam and Goh (2018).

Value

An object of class "aardl" containing:

References

Bertelli, S., Vacca, G. and Zoia, M. (2022). Bootstrap cointegration tests in ARDL models. Economic Modelling, 116, 105987. doi:10.1016/j.econmod.2022.105987

Kripfganz, S. and Schneider, D. C. (2020). Response surface regressions for critical value bounds and approximate p-values in equilibrium correction models. Oxford Bulletin of Economics and Statistics, 82(6), 1456-1481. doi:10.1111/obes.12377

McNown, R., Sam, C. Y. and Goh, S. K. (2018). Bootstrapping the autoregressive distributed lag test for cointegration. Applied Economics, 50(13), 1509-1521. doi:10.1080/00036846.2017.1366643

Pesaran, M. H., Shin, Y. and Smith, R. J. (2001). Bounds testing approaches to the analysis of level relationships. Journal of Applied Econometrics, 16(3), 289-326. doi:10.1002/jae.616

Sam, C. Y., McNown, R. and Goh, S. K. (2019). An augmented autoregressive distributed lag bounds test for cointegration. Economic Modelling, 80, 130-141. doi:10.1016/j.econmod.2018.11.001

Examples

data <- generate_ts_data(n = 80, seed = 1)
result <- aardl(gdp ~ investment + trade, data = data, p = 2, q = 2, case = 3)
result
boot <- aardl(gdp ~ investment, data = data, type = "bnardl", nboot = 29,
              seed = 1)
boot

summary(result)
result_fourier <- aardl(gdp ~ investment, data = data, type = "fbootstrap",
                        fourier_k = 1, nboot = 49, seed = 1)
summary(result_fourier)



ARDL Model Diagnostics

Description

Comprehensive diagnostic tests for ARDL models.

Usage

ardl_diagnostics(model, lags = 4, arch_lags = 4)

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

## S3 method for class 'ardl_diagnostics'
plot(x, which = 1:4, ...)

Arguments

model

An estimated model object (panel_ardl, boot_ardl, qnardl, or fourier_ardl)

lags

Integer. Number of lags for serial correlation tests (default: 4)

arch_lags

Integer. Number of lags for ARCH test (default: 4)

object, x

An object of class "ardl_diagnostics"

which

Integer vector. Which plots to display (1:4)

...

Additional arguments

Details

This function performs a battery of diagnostic tests:

Value

An object of class "ardl_diagnostics" containing:

serial_corr

Breusch-Godfrey test results

ljung_box

Ljung-Box test results

hetero_bp

Breusch-Pagan test results

arch

ARCH-LM test results

normality

Jarque-Bera test results

shapiro

Shapiro-Wilk test results

reset

RESET test results

cusum

CUSUM test results

cusumsq

CUSUM of squares test results

residuals

Model residuals

See Also

fourier_ardl, boot_ardl

Examples


# Estimate a model
data <- generate_ts_data(n = 100)
model <- fourier_ardl(gdp ~ investment, data = data)

# Run diagnostics
diag <- ardl_diagnostics(model)
summary(diag)
plot(diag)


Test Asymmetry in QNARDL Model

Description

Perform Wald test for long-run asymmetry in QNARDL models.

Usage

asymmetry_test(object, var)

Arguments

object

A qnardl object

var

Variable name to test asymmetry for

Details

Tests the null hypothesis that positive and negative long-run effects are equal (H0: theta+ = theta-) against the alternative of asymmetric effects (H1: theta+ != theta-).

The test is performed separately for each quantile.

Value

A data frame with test results by quantile:

tau

Quantile

theta_pos

Positive long-run coefficient

theta_neg

Negative long-run coefficient

diff

Difference (theta+ - theta-)

wald_stat

Wald test statistic

p_value

P-value

See Also

qnardl, dynamic_multipliers

Examples


data <- generate_oil_data(n = 200)

model <- qnardl(
  gasoline ~ oil_price,
  data = data,
  tau = c(0.25, 0.5, 0.75)
)

asymmetry_test(model, var = "oil_price")


Bootstrap ARDL Bounds Test

Description

Bounds test for cointegration in an ARDL model with bootstrap critical values from a recursive bootstrap under the null hypothesis.

Usage

boot_ardl(
  formula,
  data,
  p = 1,
  q = 1,
  case = 3,
  nboot = 2000,
  seed = NULL,
  parallel = FALSE,
  ncores = 2,
  nulls = c("separate", "joint"),
  xmodel = NULL,
  level = 0.05
)

Arguments

formula

A formula such as gdp ~ investment + trade; only plain variable names are accepted.

data

A data frame containing the time series (no missing values).

p

Integer. ARDL order of the dependent variable; the model has p - 1 lagged differences of y (default: 1)

q

Integer or vector. Lags of the differenced regressors: lags 0 to q enter the model (default: 1)

case

Integer from 1-5 specifying deterministic components:

  • 1: No intercept, no trend

  • 2: Restricted intercept, no trend

  • 3: Unrestricted intercept, no trend (default)

  • 4: Unrestricted intercept, restricted trend

  • 5: Unrestricted intercept, unrestricted trend

nboot

Number of bootstrap replications (default: 2000)

seed

Random seed (default: NULL). The seed is used locally and the random number generator state of the session is restored afterwards.

parallel

Deprecated and ignored (the bootstrap runs serially).

ncores

Deprecated and ignored.

nulls

"separate" (default; Bertelli, Vacca and Zoia, 2022) or "joint" (Fov null for all statistics, McNown, Sam and Goh, 2018, applied to the conditional ECM); see Details.

xmodel

Model generating \Delta x^*: "vecm" (default with separate nulls), "var" (default with the joint null) or "rw" (random walk with the deterministic terms).

level

Significance level of the decision (default: 0.05).

Details

The model is the conditional error correction form of the ARDL(p, q) model of Pesaran, Shin and Smith (2001):

\Delta y_t = c + \rho y_{t-1} + \theta' x_{t-1} + \sum_{i=1}^{p-1}\phi_i \Delta y_{t-i} + \sum_{j=0}^{q}\pi_j' \Delta x_{t-j} + u_t.

Three statistics are computed:

The bootstrap is recursive: y* and x* are generated from the estimated model, observation by observation, with resampled residual pairs, and the three statistics are recomputed with the same design on each bootstrap sample. With nulls = "separate" (default) the procedure follows Bertelli, Vacca and Zoia (2022, Section 3): each statistic has its own restricted model (eqs. 16-18), x* is generated from the marginal model of \Delta x_t on x_{t-1} and lagged differences (eqs. 19-20), the residuals are recentred after each draw (eqs. 21-22) and the initial values are a random block of the data. With nulls = "joint" the null of the Fov test generates the samples for all statistics (McNown, Sam and Goh, 2018, Steps 1-8) applied to the conditional ECM above, which is a package choice (MSG write the y equation without the contemporaneous \Delta x_t); \Delta x_t follows the unrestricted equation that also contains y_{t-1}, the residuals are recentred once (MSG eq. 13 subtracts the residual mean; no rescaling) and the initial values are the first observations. The x equation has p - 1 lags of \Delta y and \Delta x, as in BVZ eq. 19. Bertelli, Vacca and Zoia (2022) treat cases 2 and 3; cases 1, 4 and 5 are handled by the same algorithm with the deterministic terms of the case (the intercept or trend is restricted under the Fov null in cases 2 and 4), which is a package choice.

Critical values are order statistics of the bootstrap distributions (BVZ eqs. 24-25). Cointegration is concluded only when Fov, t and Find all reject; Fov rejecting without t is reported as the degenerate case of the first type and Fov and t rejecting without Find as the degenerate case of the second type (Pesaran, Shin and Smith, 2001; McNown, Sam and Goh, 2018).

Value

An object of class "boot_ardl" containing:

References

Bertelli, S., Vacca, G. and Zoia, M. (2022). Bootstrap cointegration tests in ARDL models. Economic Modelling, 116, 105987. doi:10.1016/j.econmod.2022.105987

McNown, R., Sam, C. Y. and Goh, S. K. (2018). Bootstrapping the autoregressive distributed lag test for cointegration. Applied Economics, 50(13), 1509-1521. doi:10.1080/00036846.2017.1366643

Pesaran, M. H., Shin, Y. and Smith, R. J. (2001). Bounds testing approaches to the analysis of level relationships. Journal of Applied Econometrics, 16(3), 289-326. doi:10.1002/jae.616

Examples

data(macro_data)
boot_test <- boot_ardl(gdp ~ inflation, data = macro_data[1:60, ],
                       p = 2, q = 1, nboot = 49, seed = 1)
boot_test

summary(boot_test)
plot(boot_test)



Dynamic Multipliers for QNARDL

Description

Compute and plot cumulative dynamic multipliers for QNARDL models.

Usage

dynamic_multipliers(object, var, tau = 0.5, horizon = 20)

Arguments

object

A qnardl object

var

Variable name

tau

Quantile to compute multipliers for (default: 0.5)

horizon

Number of periods (default: 20)

Details

Computes the cumulative dynamic multipliers showing how the effect of a unit change in x accumulates over time towards the long-run equilibrium.

Separate multipliers are computed for positive and negative changes, allowing visualization of asymmetric adjustment paths.

Value

A data frame with:

horizon

Time horizon (0 to horizon)

multiplier

Cumulative multiplier value

type

Either "Positive" or "Negative"

See Also

qnardl, asymmetry_test

Examples


data <- generate_oil_data(n = 200)

model <- qnardl(
  gasoline ~ oil_price,
  data = data,
  tau = c(0.25, 0.5, 0.75)
)

# Plot dynamic multipliers at median
dynamic_multipliers(model, var = "oil_price", tau = 0.5, horizon = 30)


Fourier (Bootstrap) Nonlinear ARDL

Description

Nonlinear ARDL model with positive and negative partial sums (Shin, Yu and Greenwood-Nimmo, 2014), optional Fourier terms for smooth breaks, data-based selection of the Fourier frequency and of the lags, and cointegration tests with Kripfganz and Schneider (2020) bounds (no Fourier terms) or bootstrap critical values.

Usage

fbnardl(
  formula,
  data,
  decompose,
  exog = NULL,
  type = c("fnardl", "fbnardl"),
  maxlag = 4,
  maxk = 3,
  kgrid = c("integer", "fractional"),
  fourier = TRUE,
  kstar = NULL,
  lags = NULL,
  ic = c("aic", "bic"),
  bootstrap = c("bvz", "mcnown"),
  xdgp = c("vecm", "rw"),
  reps = 999,
  vcov = c("ols", "HC1", "HAC"),
  horizon = 20,
  bands = 500,
  level = 0.95,
  seed = NULL,
  graph = FALSE
)

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

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

## S3 method for class 'fbnardl'
coef(object, ...)

## S3 method for class 'fbnardl'
vcov(object, ...)

## S3 method for class 'fbnardl'
nobs(object, ...)

Arguments

formula

A formula y ~ x1 + x2 + ...; only plain variable names are accepted.

data

A data frame with consecutive observations (no missing values or gaps).

decompose

Names of the regressors decomposed into positive and negative partial sums.

exog

Optional names of exogenous variables in data that enter at time t in the short run only (for example dummies); held fixed in the bootstrap.

type

"fnardl" (bounds) or "fbnardl" (bootstrap).

maxlag

Largest lag considered (default 4).

maxk

Largest Fourier frequency (default 3).

kgrid

"integer" (default) or "fractional".

fourier

Logical; include Fourier terms (default TRUE).

kstar

Optional Fourier frequency fixed by the user; it is then not selected, neither on the data nor in the bootstrap.

lags

Optional list with elements p, q (one per decomposed variable) and r (one per other regressor) fixing the lags.

ic

"aic" or "bic".

bootstrap

"bvz" (default) or "mcnown".

xdgp

"vecm" (default) or "rw", the model of x* with bootstrap = "bvz".

reps

Bootstrap replications (default 999).

vcov

Covariance matrix for the long-run standard errors, asymmetry tests and multiplier bands: "ols", "HC1" or "HAC" (Newey-West with Bartlett weights and \lfloor 4 (n/100)^{2/9} \rfloor lags). The bounds and bootstrap statistics always use the OLS covariance.

horizon

Largest horizon of the dynamic multipliers (default 20).

bands

Number of parametric draws for the multiplier bands (default 500; 0 for none).

level

Confidence level of the bands (default 0.95).

seed

Optional seed for the bootstrap and the bands; the session's random number generator state is restored afterwards.

graph

Logical; plot the multipliers (default FALSE).

x, object

An object of class "fbnardl"

...

Not used

Details

The model (case 3, unrestricted intercept) is

\Delta y_t = c + \rho y_{t-1} + \sum_i (\beta_i^+ x^+_{i,t-1} + \beta_i^- x^-_{i,t-1}) + \sum_j \delta_j z_{j,t-1} + \sum_{l=1}^{p}\phi_l \Delta y_{t-l} + \sum_i \sum_{l=0}^{q_i} (\theta^+_{il}\Delta x^+_{i,t-l} + \theta^-_{il}\Delta x^-_{i,t-l}) + \sum_j \sum_{l=0}^{r_j}\pi_{jl}\Delta z_{j,t-l} + \gamma' e_t + a_1\sin(2\pi k^* t/T) + a_2\cos(2\pi k^* t/T) + u_t,

where x^+_t = \sum_{s \le t}\max(\Delta x_s, 0) and x^-_t = \sum_{s \le t}\min(\Delta x_s, 0) start at zero at the first observation, z are the regressors that are not decomposed and e_t the exogenous short-run variables (exog).

Selection. When fourier = TRUE and kstar is not given, k^* minimises the sum of squared residuals of the model with every lag at maxlag; the grid is 1, \dots, maxk (kgrid = "integer"; integer frequencies chosen by minimum SSR as in Enders and Lee, 2012, Oxford Bulletin of Economics and Statistics) or 0.1, 0.2, \dots, maxk (kgrid = "fractional"). The default and the validity of the fractional grid are package choices pending verification against Yilanci, Bozoklu and Gorus (2020) and Omay (2015). Then p (1 to maxlag) and each q_i, r_j (0 to maxlag) minimise the AIC or BIC. Every candidate and the final model use the same sample, t > maxlag + 1, so the criteria are comparable. lags fixes the lags instead.

Cointegration tests. Fov is the F test that \rho, all \beta and \delta are zero, t the t test on \rho and Find the F test on the \beta and \delta. Without Fourier terms (fourier = FALSE) and type = "fnardl", the bounds of Kripfganz and Schneider (2020) are used for Fov and t, with k = 2 times the number of decomposed variables plus the number of other regressors, n the number of observations used and the number of short-run coefficients sr = p + sum 2(q_i + 1) + sum (r_j + 1) + number of exog; the bounds decision requires both statistics beyond their I(1) bounds. With Fourier terms no valid bounds exist: no decision is given for type = "fnardl" and the bounds printed are those of the model without Fourier terms, for reference only. Inference with Fourier terms is by the bootstrap (type = "fbnardl").

Bootstrap. type = "fbnardl" uses the recursive bootstrap engine of boot_ardl: bootstrap = "bvz" has separate nulls for Fov, t and Find (Bertelli, Vacca and Zoia, 2022), x* from the marginal model of \Delta x_t on the intercept, x_{t-1}, p lags of \Delta y and \Delta x, the Fourier terms and exog (xdgp = "vecm", default; BVZ eqs. 19-20), or from the regression of \Delta x_t on the intercept, the Fourier terms and exog only (xdgp = "rw", a random walk with these deterministic terms; a package choice that is not the x model of BVZ), residuals recentred after each draw and a random block of initial values (the partial sums continue the data's levels in the block); bootstrap = "mcnown" uses the null of the Fov test for all statistics (McNown, Sam and Goh, 2018, Steps 1-8) applied to the conditional ECM, which is a package choice (MSG write the y equation without the contemporaneous differences), with the unrestricted equation for \Delta x that also contains y_{t-1}, residuals recentred once and the observed initial values. The partial sums are rebuilt from x*; the Fourier terms and exog are held fixed. On every bootstrap sample k^* (unless fixed by kstar) and the lags (unless fixed by lags) are selected again, so the bootstrap distribution accounts for the selection (package choice; BVZ step 5(c) re-estimates the unrestricted model but does not discuss re-selection). The decision requires Fov, t and Find to reject; the degenerate cases are labelled. Failed replications are NA and counted. In a Monte Carlo with independent random walks (n = 100, 200 samples, B = 199, maxlag = 1, integer grid) the 5% rejection rates were 7.0% (Monte Carlo s.e. 1.8%) for Fov, 11.5% (2.3%) for t and 11.5% (2.3%) for Find, and 3.5% (1.3%) for the combined decision. Find tends to over-reject with Fourier terms and partial sums (16.0%, s.e. 2.6%, for aardl(type = "fbnardl") in the same design).

Asymmetry and multipliers. The long-run coefficients -\beta^\pm/\rho have delta-method standard errors, and the long-run symmetry test is the delta-method Wald test of -\beta^+/\rho = -\beta^-/\rho (chi-squared, 1 df). The short-run symmetry test compares the sums over lags 0 to q_i, \sum_l\theta^+_{il} = \sum_l\theta^-_{il} (F(1, df)); testing the sums is a package choice pending verification against Shin, Yu and Greenwood-Nimmo (2014). The cumulative dynamic multipliers are the responses of the level of y to a permanent unit increase in x^+ or x^- at horizon 0, computed by the full recursion of the estimated ECM (all lagged differences included), with parametric confidence bands from bands draws of the coefficients from their estimated normal distribution. The sign convention of the multiplier of x^- (response to a unit increase in the negative partial sum) is pending verification against Shin, Yu and Greenwood-Nimmo (2014).

The R code is a port written for this package, following the Stata module fbnardl.

Value

An object of class "fbnardl" with elements coefficients, vcov, se, residuals, fitted.values, lags, kstar, ic_value, ssr_by_k, multipliers (short- and long-run, with standard errors), asymmetry_tests, bounds_test (statistics, bounds or bootstrap results and decision), dynamic_multipliers (paths and bands), diagnostics, nobs, df.residual, r.squared, adj.r.squared, sigma, design, call and the settings.

References

Bertelli, S., Vacca, G. and Zoia, M. (2022). Bootstrap cointegration tests in ARDL models. Economic Modelling, 116, 105987. doi:10.1016/j.econmod.2022.105987

Enders, W. and Lee, J. (2012). A unit root test using a Fourier series to approximate smooth breaks. Oxford Bulletin of Economics and Statistics, 74(4), 574-599. doi:10.1111/j.1468-0084.2011.00662.x

Kripfganz, S. and Schneider, D. C. (2020). Response surface regressions for critical value bounds and approximate p-values in equilibrium correction models. Oxford Bulletin of Economics and Statistics, 82(6), 1456-1481. doi:10.1111/obes.12377

McNown, R., Sam, C. Y. and Goh, S. K. (2018). Bootstrapping the autoregressive distributed lag test for cointegration. Applied Economics, 50(13), 1509-1521. doi:10.1080/00036846.2017.1366643

Omay, T. (2015). Fractional frequency flexible Fourier form to approximate smooth breaks in unit root testing. Economics Letters, 134, 123-126. doi:10.1016/j.econlet.2015.07.010

Pesaran, M. H., Shin, Y. and Smith, R. J. (2001). Bounds testing approaches to the analysis of level relationships. Journal of Applied Econometrics, 16(3), 289-326. doi:10.1002/jae.616

Shin, Y., Yu, B. and Greenwood-Nimmo, M. (2014). Modelling asymmetric cointegration and dynamic multipliers in a nonlinear ARDL framework. In R. C. Sickles and W. C. Horrace (Eds.), Festschrift in Honor of Peter Schmidt (pp. 281-314). Springer. doi:10.1007/978-1-4899-8008-3_9

Yilanci, V., Bozoklu, S. and Gorus, M. S. (2020). Are BRICS countries pollution havens? Evidence from a bootstrap ARDL bounds testing approach with a Fourier function. Sustainable Cities and Society, 55, 102035. doi:10.1016/j.scs.2020.102035

Examples

d <- generate_oil_data(n = 100)
m <- fbnardl(gasoline ~ oil_price, data = d, decompose = "oil_price",
             maxlag = 2, fourier = FALSE)
m

mb <- fbnardl(gasoline ~ oil_price, data = d, decompose = "oil_price",
              type = "fbnardl", maxlag = 1, maxk = 2, reps = 49, bands = 50,
              seed = 1)
summary(mb)



Fourier ARDL Model

Description

Estimate ARDL models with Fourier terms for smooth structural breaks.

Usage

fourier_ardl(formula, data, p = 1, q = 1, k = 1, case = 3,
             selection = c("fixed", "aic", "bic"))

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

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

## S3 method for class 'fourier_ardl'
plot(x, which = "both", ...)

Arguments

formula

A formula specifying the model: gdp ~ investment + trade + ...

data

A data frame containing the time series data

p

Integer. Number of lags for dependent variable (default: 1)

q

Integer or vector. Number of lags for independent variables (default: 1)

k

Integer. Number of Fourier frequencies (default: 1, max: 3)

case

Integer from 1-5 specifying deterministic components (default: 3)

selection

Character. Method for selecting optimal k: "aic", "bic", or "fixed"

object, x

An object of class "fourier_ardl"

which

Character. "fourier", "fit", or "both" for plotting

...

Additional arguments

Details

This function implements the Fourier ARDL approach that captures smooth structural changes using trigonometric functions. The Fourier terms approximate unknown structural breaks without requiring prior specification of break dates.

The Fourier terms are defined as:

f_t = \sum_{k=1}^{K} [a_k \sin(2\pi k t/T) + b_k \cos(2\pi k t/T)]

where K is the number of frequencies and T is the sample size.

Value

An object of class "fourier_ardl" containing:

coefficients

Estimated coefficients

long_run

Long-run coefficients

fourier_coefs

Fourier term coefficients

ec_coef

Error correction coefficient

bounds_test

F and t statistics for bounds test

k

Number of Fourier frequencies used

aic

AIC values for k = 1, 2, 3

bic

BIC values for k = 1, 2, 3

structural_breaks

Detected structural break periods

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.

Enders, W. and Lee, J. (2012). A unit root test using a Fourier series to approximate smooth breaks. Oxford Bulletin of Economics and Statistics, 74(4), 574-599.

See Also

fourier_bounds_test, generate_ts_data

Examples


# Generate example data
data <- generate_ts_data(n = 100)

# Estimate Fourier ARDL with automatic selection
model <- fourier_ardl(
  gdp ~ investment + trade,
  data = data,
  selection = "aic"
)
summary(model)
plot(model)


Fourier ARDL Bounds Test

Description

Reports the bounds test statistics of a Fourier ARDL model.

Usage

fourier_bounds_test(object)

Arguments

object

A fourier_ardl object

Details

No critical values for the PSS bounds F test with Fourier terms have been tabulated in the literature cited by this package, and the Fourier terms change the null distribution. The function therefore returns no decision. For reference only, it also reports the Pesaran, Shin and Smith (2001) bounds for the model without Fourier terms, from the response surfaces of Kripfganz and Schneider (2020); these are not valid for the Fourier model. Use a bootstrap for inference.

Value

Invisibly, a list with F_stat, t_stat, cv_F = NA and cv_pss_reference.

References

Kripfganz, S. and Schneider, D. C. (2020). Response surface regressions for critical value bounds and approximate p-values in equilibrium correction models. Oxford Bulletin of Economics and Statistics, 82(6), 1456-1481. doi:10.1111/obes.12377


Generate Oil Price Data

Description

Generate simulated oil and gasoline price data with asymmetric effects.

Usage

generate_oil_data(n = 200, seed = 789)

Arguments

n

Number of observations (default: 200)

seed

Random seed for reproducibility (default: 789)

Details

Generates a simulated dataset exhibiting the "rockets and feathers" phenomenon where gasoline prices respond more quickly to oil price increases than decreases. Suitable for demonstrating QNARDL methods and asymmetry testing.

Value

A data frame with columns:

week

Week number (1 to n)

gasoline

Retail gasoline price (cents/gallon)

oil_price

Crude oil price ($/barrel)

exchange_rate

USD exchange rate index

See Also

qnardl, asymmetry_test

Examples

# Generate oil price data
oil <- generate_oil_data(n = 200)
head(oil)

# Plot prices
plot(oil$week, oil$oil_price, type = "l", col = "blue",
     main = "Oil and Gasoline Prices")
lines(oil$week, oil$gasoline/4, col = "red")  # Scaled for comparison

Generate Example Panel Data

Description

Generate simulated panel data for examples and testing.

Usage

generate_panel_data(n_groups = 10, n_time = 50, seed = 123)

Arguments

n_groups

Number of groups/countries (default: 10)

n_time

Number of time periods (default: 50)

seed

Random seed for reproducibility (default: 123)

Details

Generates a simulated panel dataset with cointegrated variables suitable for demonstrating panel ARDL methods. The data generating process includes country-specific fixed effects and error correction dynamics.

Value

A data frame with columns:

country

Country identifier (1 to n_groups)

year

Year (starting from 1970)

gdp

Log GDP per capita (I(1))

inflation

Inflation rate (I(0))

investment

Investment as % of GDP (I(1))

trade

Trade openness (I(1))

See Also

panel_ardl, generate_ts_data

Examples

# Generate panel data for 5 countries, 30 years
panel <- generate_panel_data(n_groups = 5, n_time = 30)
head(panel)

# Check dimensions
table(panel$country)

Generate Example Time Series Data

Description

Generate simulated time series data for examples and testing.

Usage

generate_ts_data(n = 100, seed = 456)

Arguments

n

Number of observations (default: 100)

seed

Random seed for reproducibility (default: 456)

Details

Generates a simulated time series dataset with cointegrated variables and a smooth structural break (modeled via Fourier component). Suitable for demonstrating Fourier ARDL and bootstrap bounds testing methods.

Value

A data frame with columns:

quarter

Quarter number (1 to n)

gdp

Log real GDP (I(1) with structural break)

inflation

Inflation rate (I(0))

investment

Investment growth (I(1))

trade

Trade balance (I(1))

See Also

fourier_ardl, boot_ardl, generate_panel_data

Examples

# Generate 100 quarters of data
ts_data <- generate_ts_data(n = 100)
head(ts_data)

# Plot GDP series
plot(ts_data$quarter, ts_data$gdp, type = "l",
     main = "Simulated GDP with Structural Break")

Hausman Test for Panel ARDL Estimators

Description

Compare two panel_ardl estimators (typically MG vs PMG) to test for long-run slope homogeneity.

Usage

hausman_test(inefficient, efficient, sigmamore = TRUE)

Arguments

inefficient

A panel_ardl object - the always-consistent estimator (typically MG).

efficient

A panel_ardl object - the under-H0 efficient estimator (typically PMG).

sigmamore

Logical. If TRUE (default, matches Stata's sigmamore option), rescale the inefficient variance matrix to address non-positive-definite difference matrices.

Details

Under the null of long-run homogeneity, the PMG (efficient) estimator is consistent and efficient; the MG (inefficient) estimator is consistent but less efficient. A significant test statistic rejects PMG in favour of MG.

Argument order in v2.0.0 follows Stata's convention: pass the inefficient estimator first (e.g. MG), then the efficient one (e.g. PMG). This is a breaking change from earlier versions.

Value

An (invisible) list with statistic, df, p.value, and theta_diff.

References

Hausman, J. A. (1978). Specification tests in econometrics. Econometrica, 46(6), 1251-1271.

Examples

## Not run: 
fit_mg  <- panel_ardl(y ~ x, data = d, id = "i", time = "t", estimator = "mg")
fit_pmg <- panel_ardl(y ~ x, data = d, id = "i", time = "t", estimator = "pmg")
hausman_test(fit_mg, fit_pmg)

## End(Not run)


Time Series Macroeconomic Data

Description

A simulated time series dataset of macroeconomic variables for a single country over 100 quarters.

Usage

macro_data

Format

A data frame with 100 rows and 5 variables: quarter, gdp, inflation, investment, trade.

Source

Simulated data for demonstration purposes

Examples

data(macro_data)
head(macro_data)


Simulated Macroeconomic Panel Data

Description

A simulated panel dataset of macroeconomic variables for 10 countries over 50 years.

Usage

macro_panel

Format

A data frame with 500 rows and 6 variables: country, year, gdp, inflation, investment, trade.

Source

Simulated data for demonstration purposes

Examples


data(macro_panel)
head(macro_panel)

# Estimate Panel ARDL
model <- panel_ardl(
  gdp ~ inflation + investment,
  data = macro_panel,
  id = "country",
  time = "year",
  estimator = "pmg"
)



Multiple-Threshold Nonlinear ARDL (MT-NARDL)

Description

Extends NARDL to allow multiple threshold decomposition for capturing complex asymmetric relationships.

Usage

mtnardl(
  formula,
  data,
  thresholds = c(0),
  p = 1,
  q = 1,
  case = 3,
  auto_select = FALSE,
  n_thresholds = 2,
  bootstrap = FALSE,
  nboot = 2000,
  seed = NULL,
  decompose = NULL,
  threshold_type = c("value", "quantile"),
  bounds_k = c("partial_sums", "original"),
  nulls = c("separate", "joint"),
  horizon = 30
)

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

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

## S3 method for class 'mtnardl'
plot(x, type = c("multipliers", "asymmetry"), ...)

Arguments

formula

A formula such as gasoline ~ oil_price; only plain variable names are accepted (create transformed variables in data).

data

A data frame containing the time series (no missing values).

thresholds

Numeric vector of threshold values (default: c(0)), or probabilities when threshold_type = "quantile".

p

Integer. Number of lagged differences of y (default: 1)

q

Integer or vector (one entry per regressor). Number of differences of each regressor, lags 0 to q - 1 (default: 1)

case

Integer from 1-5 specifying deterministic components (default: 3)

auto_select

Logical. Automatically select thresholds (default: FALSE). With n_thresholds = 1 the threshold minimising the AIC over 0 and the deciles of the changes of the first decomposed variable is chosen; with more thresholds, equally spaced quantiles of those changes are used.

n_thresholds

Integer. Number of thresholds to select if auto_select = TRUE

bootstrap

Logical. Use bootstrap inference (default: FALSE)

nboot

Number of bootstrap replications (default: 2000)

seed

Random seed; used locally, the session's random number generator state is restored afterwards.

decompose

Character vector of regressors to decompose (default: all regressors). The other regressors enter linearly.

threshold_type

"value" (default) or "quantile".

bounds_k

"partial_sums" (default) or "original"; the k used for the bounds, see Details.

nulls

Bootstrap nulls, "separate" (default) or "joint"; see boot_ardl.

horizon

Largest horizon of the dynamic multipliers (default: 30).

x, object

An object of class "mtnardl"

...

Not used

type

For plot: "multipliers" or "asymmetry".

Details

Each decomposed regressor x is split into regimes according to the size of its change \Delta x_t: with thresholds c_1 < \dots < c_{R-1}, regime r collects \Delta x_t when c_{r-1} < \Delta x_t \le c_r (c_0 = -\infty, c_R = \infty), and its partial sum is the cumulative sum of these changes, starting at zero at the first observation. For example, with thresholds c(-0.02, 0, 0.02) a variable is decomposed into large decreases, small decreases, small increases and large increases. With threshold_type = "quantile" the thresholds are probabilities and are converted to the sample quantiles of \Delta x_t of each decomposed variable (a quantile partition of the changes). Regressors not listed in decompose enter linearly.

The conditional error correction model is

\Delta y_t = \rho y_{t-1} + \sum_m \theta_m w_{m,t-1} + \sum_{i=1}^{p} \phi_i \Delta y_{t-i} + \sum_m \sum_{l=0}^{q-1} \pi_{ml} \Delta w_{m,t-l} + d_t + u_t,

where w are the regime partial sums and the linear regressors and d_t holds the deterministic terms of the case.

Bounds test. The statistics are the F test on all lagged levels (Fov), the t test on y_{t-1} and the F test on the lagged regressors (Find). The Kripfganz and Schneider (2020) bounds are computed with k equal to the number of level regressors (partial sums plus linear regressors) by default (bounds_k = "partial_sums"), or the number of original regressors (bounds_k = "original"). This is a package choice pending verification against Pal and Mitra (2016) and Shin, Yu and Greenwood-Nimmo (2014); in a Monte Carlo with independent random walks the first choice gave sizes close to the nominal level. The bounds decision requires both F and t to exceed their I(1) bounds. With bootstrap = TRUE the recursive bootstrap of boot_ardl is used (separate nulls of Bertelli, Vacca and Zoia (2022) by default): x* is generated recursively, the regime partial sums are rebuilt from x* with the same thresholds, and the decision requires Fov, t and Find to reject (degenerate cases labelled).

Long run. The long-run coefficients -\theta_m / \rho have delta-method standard errors computed with the full covariance matrix. For each decomposed variable the joint Wald test of equal long-run coefficients across regimes is the linear test \theta_1 = \dots = \theta_R (chi-squared with R - 1 degrees of freedom); pairwise tests and the delta-method differences of the long-run coefficients are also reported.

Dynamic multipliers. multipliers$cumulative gives the response of the level of y at horizons 0 to horizon to a permanent unit increase in each partial sum (or linear regressor) at horizon 0, computed by the full recursion of the estimated ECM; it converges to the long-run coefficient. The definition of the multiplier follows the cumulative multiplier of the NARDL literature and is pending verification against Shin, Yu and Greenwood-Nimmo (2014).

Value

An object of class "mtnardl" containing:

References

Bertelli, S., Vacca, G. and Zoia, M. (2022). Bootstrap cointegration tests in ARDL models. Economic Modelling, 116, 105987. doi:10.1016/j.econmod.2022.105987

Kripfganz, S. and Schneider, D. C. (2020). Response surface regressions for critical value bounds and approximate p-values in equilibrium correction models. Oxford Bulletin of Economics and Statistics, 82(6), 1456-1481. doi:10.1111/obes.12377

Pal, D. and Mitra, S. K. (2016). Asymmetric oil product pricing in India: Evidence from a multiple threshold nonlinear ARDL model. Economic Modelling, 59, 314-328. doi:10.1016/j.econmod.2016.08.003

Shin, Y., Yu, B. and Greenwood-Nimmo, M. (2014). Modelling asymmetric cointegration and dynamic multipliers in a nonlinear ARDL framework. In R. C. Sickles and W. C. Horrace (Eds.), Festschrift in Honor of Peter Schmidt (pp. 281-314). Springer. doi:10.1007/978-1-4899-8008-3_9

Examples

data <- generate_oil_data(n = 120)
result1 <- mtnardl(gasoline ~ oil_price, data = data)
result1

result2 <- mtnardl(gasoline ~ oil_price, data = data,
                   thresholds = c(-1, 0, 1))
summary(result2)
result3 <- mtnardl(gasoline ~ oil_price, data = data,
                   thresholds = c(1/3, 2/3), threshold_type = "quantile",
                   bootstrap = TRUE, nboot = 49, seed = 1)
result3$bounds_test



Oil Price and Gasoline Data

Description

Weekly data on oil prices and retail gasoline prices, suitable for demonstrating asymmetric price transmission.

Usage

oil_data

Format

A data frame with 200 rows and 4 variables: week, gasoline, oil_price, exchange_rate.

Source

Simulated data for demonstration purposes

Examples


data(oil_data)

# Test for asymmetric price transmission
model <- qnardl(
  gasoline ~ oil_price + exchange_rate,
  data = oil_data,
  tau = c(0.25, 0.5, 0.75)
)
asymmetry_test(model, var = "oil_price")



Panel ARDL Estimation (PMG / MG / DFE)

Description

Estimate Panel ARDL models with Pooled Mean Group (PMG), Mean Group (MG), and Dynamic Fixed Effects (DFE) estimators following Pesaran, Shin and Smith (1999). This implementation replicates Stata's xtpmg command (Blackburne and Frank 2007).

Usage

panel_ardl(
  formula,
  data,
  id,
  time,
  p = 1,
  q = 1,
  estimator = c("pmg", "mg", "dfe"),
  ec = TRUE,
  trend = FALSE,
  start_time = NULL,
  cluster = FALSE,
  maxiter = 100,
  tol = 1e-06
)

Arguments

formula

A formula y ~ x1 + x2 + ....

data

A data frame containing panel data.

id

Character. Name of the panel/group identifier column.

time

Character. Name of the time variable column.

p

Integer. Lags for dependent variable (default 1).

q

Integer or numeric vector. Lags for independent variables (default 1).

estimator

Character. One of "pmg", "mg", "dfe".

ec

Logical. If TRUE, display error-correction form (default TRUE).

trend

Logical. Include a deterministic time trend (default FALSE).

start_time

Optional. Restrict estimation to observations at or after this time.

cluster

Logical. If TRUE, use cluster-robust standard errors where applicable (default FALSE).

maxiter

Integer. Maximum iterations for PMG optimization (default 100).

tol

Numeric. Convergence tolerance (default 1e-6).

Details

The model is specified as:

\Delta y_{it} = \phi_i (y_{i,t-1} - \theta'_i x_{it}) + \sum_{j=1}^{p-1} \lambda_{ij} \Delta y_{i,t-j} + \sum_{j=0}^{q-1} \delta'_{ij} \Delta x_{i,t-j} + \mu_i + \varepsilon_{it}

Three estimators are available:

Value

An object of class "panel_ardl" with components:

References

Pesaran, M. H., Shin, Y. and Smith, R. P. (1999). Pooled mean group estimation of dynamic heterogeneous panels. Journal of the American Statistical Association, 94(446), 621-634.

Blackburne, E. F. and Frank, M. W. (2007). Estimation of nonstationary heterogeneous panels. Stata Journal, 7(2), 197-208.

Examples

## Not run: 
fit <- panel_ardl(y ~ x1 + x2, data = my_panel,
                  id = "country", time = "year",
                  p = 1, q = 1, estimator = "pmg")
summary(fit)

## End(Not run)


Plot Bootstrap Distribution

Description

Plot the bootstrap distribution of test statistics

Usage

## S3 method for class 'boot_ardl'
plot(x, which = "both", ...)

Arguments

x

An object of class "boot_ardl"

which

Character. "F", "t", or "both" (default)

...

Additional arguments passed to plotting functions


Plot method for fbnardl objects

Description

Plot method for fbnardl objects

Usage

## S3 method for class 'fbnardl'
plot(x, type = c("multipliers", "kstar"), ...)

Arguments

x

An object of class "fbnardl"

type

"multipliers" (dynamic multipliers with bands) or "kstar" (sum of squared residuals by Fourier frequency).

...

Not used


Panel Nonlinear ARDL (Panel NARDL)

Description

Panel data estimation with asymmetric/nonlinear ARDL specification using PMG, MG, or DFE estimators.

Usage

pnardl(formula, data, id, time, p = 1, q = 1,
       estimator = c("pmg", "mg", "dfe"),
       threshold = 0,
       effect = c("individual", "time", "twoways"),
       bootstrap = FALSE, nboot = 500)

## S3 method for class 'pnardl'
print(x, ...)
## S3 method for class 'pnardl'
summary(object, ...)

Arguments

formula

A formula specifying the model: gdp ~ investment + trade + ...

data

A data frame in long panel format

id

Character. Name of the group/panel identifier variable

time

Character. Name of the time variable

p

Integer. Number of lags for dependent variable (default: 1)

q

Integer or vector. Number of lags for independent variables (default: 1)

estimator

Character. One of "pmg", "mg", or "dfe" (default: "pmg")

threshold

Numeric. Threshold for asymmetric decomposition (default: 0)

effect

Character. Type of effects: "individual", "time", "twoways" (default: "individual")

bootstrap

Logical. Use bootstrap for inference (default: FALSE)

nboot

Number of bootstrap replications (default: 500)

x, object

An object of class "pnardl"

...

Additional arguments passed to methods

Details

The Panel NARDL model extends the Shin et al. (2014) NARDL framework to panel data settings. It allows for asymmetric short-run and long-run effects while controlling for cross-sectional heterogeneity.

Three estimators are available:

Value

An object of class "pnardl" containing:

coefficients

Estimated coefficients

long_run_pos

Long-run coefficients for positive changes

long_run_neg

Long-run coefficients for negative changes

short_run

Short-run coefficients

ec_coef

Error correction coefficient

asymmetry_test

Wald test for long-run asymmetry

unit_results

Individual unit estimation results (for MG)

hausman

Hausman test comparing PMG vs MG

References

Shin, Y., Yu, B. and Greenwood-Nimmo, M. (2014). Modelling asymmetric cointegration and dynamic multipliers in a nonlinear ARDL framework.

Pesaran, M. H., Shin, Y. and Smith, R. P. (1999). Pooled mean group estimation of dynamic heterogeneous panels. Journal of the American Statistical Association.

See Also

panel_ardl, qnardl, mtnardl

Examples


# Generate panel data
data <- generate_panel_data(n_groups = 10, n_time = 40)

# Panel NARDL with PMG estimator
result <- pnardl(
  gdp ~ investment + trade,
  data = data,
  id = "country",
  time = "year",
  estimator = "pmg"
)
summary(result)

# Panel NARDL with MG estimator
result_mg <- pnardl(
  gdp ~ investment,
  data = data,
  id = "country",
  time = "year",
  estimator = "mg"
)

# Panel NARDL with bootstrap standard errors (nboot kept small here;
# use several hundred replications in applied work)
result_boot <- pnardl(
  gdp ~ investment,
  data = data,
  id = "country",
  time = "year",
  bootstrap = TRUE,
  nboot = 20
)


Print method for boot_ardl

Description

Print method for boot_ardl

Usage

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

Arguments

x

An object of class "boot_ardl"

...

Not used


Print Method for panel_ardl Objects

Description

Concise display of a fitted panel_ardl model.

Usage

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

Arguments

x

A panel_ardl object.

...

Additional arguments (currently ignored).

Value

Invisibly returns x.


Critical Value Bounds for the PSS Bounds Test

Description

Critical value bounds for the F and t statistics of the Pesaran, Shin and Smith (2001) bounds test, computed from the response surface regressions of Kripfganz and Schneider (2020). With n missing the asymptotic bounds are returned; with n (and sr) the finite-sample bounds.

Usage

pss_critical_values(k, case = 3, level = "5%", n = NULL, sr = 0)

Arguments

k

Number of regressors in levels (excluding the lagged dependent variable)

case

PSS case (1-5)

level

Significance level: "10%", "5%", "2.5%" or "1%"

n

Number of observations (optional)

sr

Number of short-run coefficients (regressors other than the deterministic terms and the lagged levels); used with n

Value

A list with F_bounds and t_bounds (each a list with I0 and I1), k, case and level. The t statistic is not tabulated for cases 2 and 4; the values of cases 3 and 5 are used, as in Kripfganz and Schneider (2020).

References

Pesaran, M. H., Shin, Y. and Smith, R. J. (2001). Bounds testing approaches to the analysis of level relationships. Journal of Applied Econometrics, 16(3), 289-326. doi:10.1002/jae.616

Kripfganz, S. and Schneider, D. C. (2020). Response surface regressions for critical value bounds and approximate p-values in equilibrium correction models. Oxford Bulletin of Economics and Statistics, 82(6), 1456-1481. doi:10.1111/obes.12377

Examples

pss_critical_values(k = 2, case = 3)
pss_critical_values(k = 2, case = 3, n = 80, sr = 4)


Quantile Nonlinear ARDL (QNARDL)

Description

Estimate Quantile Nonlinear ARDL models combining distributional and asymmetric effects.

Usage

qnardl(formula, data, tau = c(0.25, 0.5, 0.75),
       p = 1, q = 1, decompose = NULL, trend = FALSE)

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

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

## S3 method for class 'qnardl'
plot(x, var = NULL, type = "long_run", ...)

Arguments

formula

A formula specifying the model: gdp ~ investment + trade + ...

data

A data frame containing the time series data

tau

Numeric vector of quantiles to estimate (default: c(0.25, 0.5, 0.75))

p

Integer. Number of lags for dependent variable (default: 1)

q

Integer or vector. Number of lags for independent variables (default: 1)

decompose

Character vector. Variables to decompose into +/- components. Default is all x variables.

trend

Logical. Include time trend (default: FALSE)

object, x

An object of class "qnardl"

var

Variable to plot (default: first decomposed variable)

type

"long_run" or "asymmetry"

...

Additional arguments

Details

This function implements the QNARDL model which extends the NARDL framework of Shin, Yu and Greenwood-Nimmo (2014) to a quantile regression setting.

The model allows for:

The partial sum decomposition separates each regressor into positive and negative components.

Value

An object of class "qnardl" containing:

coefficients

Estimated coefficients for each quantile

long_run_pos

Positive long-run coefficients by quantile

long_run_neg

Negative long-run coefficients by quantile

short_run

Short-run coefficients by quantile

ec_coef

Error correction coefficients by quantile

asymmetry_test

Wald test for long-run asymmetry

tau

Quantiles estimated

References

Cho, J. S., Kim, T. H. and Shin, Y. (2015). Quantile cointegration in the autoregressive distributed-lag modeling framework. Journal of Econometrics, 188(1), 281-300.

Shin, Y., Yu, B. and Greenwood-Nimmo, M. (2014). Modelling asymmetric cointegration and dynamic multipliers in a nonlinear ARDL framework. In Festschrift in Honor of Peter Schmidt (pp. 281-314). Springer.

See Also

asymmetry_test, dynamic_multipliers, generate_oil_data

Examples


# Generate oil price data
data <- generate_oil_data(n = 200)

# Estimate QNARDL
model <- qnardl(
  gasoline ~ oil_price + exchange_rate,
  data = data,
  tau = c(0.1, 0.25, 0.5, 0.75, 0.9)
)
summary(model)
plot(model, var = "oil_price")


Rolling and Recursive ARDL (R-ARDL)

Description

Time-varying ARDL bounds test using rolling or recursive windows to detect structural changes in cointegration relationships.

Usage

rardl(formula, data, method = c("rolling", "recursive"),
      window = 50, min_obs = 40, p = 1, q = 1, case = 3,
      parallel = FALSE, ncores = 2)

## S3 method for class 'rardl'
print(x, ...)
## S3 method for class 'rardl'
summary(object, ...)
## S3 method for class 'rardl'
plot(x, type = c("F", "ec", "lr", "all"), ...)

Arguments

formula

A formula specifying the model: gdp ~ investment + trade + ...

data

A data frame containing the time series data

method

Character. Either "rolling" or "recursive" (default: "rolling")

window

Integer. Window size for rolling method (default: 50)

min_obs

Integer. Minimum observations for recursive method (default: 40)

p

Integer. Number of lags for dependent variable (default: 1)

q

Integer or vector. Number of lags for independent variables (default: 1)

case

Integer from 1-5 specifying deterministic components (default: 3)

parallel

Logical. Use parallel processing (default: FALSE)

ncores

Integer. Number of cores for parallel processing

x, object

An object of class "rardl"

type

Character. Plot type: "F", "ec", "lr", or "all"

...

Additional arguments passed to methods

Details

The Rolling ARDL (R-ARDL) approach implements time-varying bounds testing to detect structural changes in cointegration relationships. Two methods are available:

This is useful for detecting:

Value

An object of class "rardl" containing:

F_stats

Time series of F-statistics

t_stats

Time series of t-statistics (EC coefficient)

cointegration

Time series of cointegration decisions

ec_coefs

Time-varying error correction coefficients

lr_coefs

Time-varying long-run coefficients

dates

Index/dates for each window

breaks

Detected structural break points

References

Pesaran, M. H., Shin, Y. and Smith, R. J. (2001). Bounds testing approaches to the analysis of level relationships. Journal of Applied Econometrics, 16(3), 289-326.

See Also

boot_ardl, aardl

Examples


# Generate example data
data <- generate_ts_data(n = 300)

# Rolling ARDL with 60-observation window
roll_result <- rardl(gdp ~ investment + trade, data = data, method = "rolling", window = 60)
plot(roll_result, type = "all")
summary(roll_result)

# Recursive ARDL
rec_result <- rardl(gdp ~ investment + trade, data = data, method = "recursive", min_obs = 50)
plot(rec_result, type = "F")


Summary method for boot_ardl

Description

Summary method for boot_ardl

Usage

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

Arguments

object

An object of class "boot_ardl"

...

Not used


Summary Method for panel_ardl Objects

Description

Detailed summary of a fitted panel_ardl model with long-run, short-run, and error-correction coefficients.

Usage

## S3 method for class 'panel_ardl'
summary(object, digits = 6, ...)

Arguments

object

A panel_ardl object.

digits

Integer. Decimal digits to display (default 6).

...

Additional arguments (currently ignored).

Value

Invisibly returns the summary as a list.