Skip to main content

wavenardl

Wavelet-based Nonlinear Autoregressive Distributed Lag (W-NARDL) for Python

Python 3.9+ License: MIT

The first Python implementation of both standard NARDL and Wavelet-based NARDL models. This library provides a complete econometric toolkit for asymmetric cointegration analysis with wavelet denoising.

Features

Core Models

  • NARDL — Nonlinear ARDL with short-run and long-run asymmetry (Shin et al., 2014)
  • Wavelet NARDL — HTW wavelet-denoised NARDL (Jammazi et al., 2015)
  • ARDL — Standard linear ARDL as a special case

Wavelet Methods

  • Haar à Trous Wavelet (HTW) — Non-decimated transform from the paper
  • PyWavelets Integration — SWT, DWT with any wavelet family
  • Donoho Thresholding — Universal soft/hard threshold denoising

Statistical Tests

  • PSS Bounds F-test — Pesaran, Shin & Smith (2001) with Cases I–V
  • Narayan Test — Small-sample critical values (Narayan, 2005)
  • Symmetry Tests — Wald tests for long-run and short-run asymmetry
  • Diagnostics — Breusch-Godfrey, Breusch-Pagan, Jarque-Bera, RESET, CUSUM

Analysis Tools

  • Dynamic Multipliers — Cumulative multiplier curves with bootstrap CI
  • Long-run Coefficients — Delta method standard errors
  • Error Correction Model — Two-step ECM estimation
  • Automatic Lag Selection — Grid search, quick search (AIC/BIC/HQ)

Output & Visualization

  • Publication Tables — LaTeX, HTML, and rich console output
  • Wavelet Plots — Decomposition, scalogram heatmaps
  • Multiplier Plots — Positive/negative effects with CI bands
  • Diagnostic Plots — Residuals, Q-Q, ACF, CUSUM panels

Installation

pip install wavenardl

Or from source:

git clone https://github.com/mkeita/wavenardl.git
cd wavenardl
pip install -e .

Quick Start

Standard NARDL

from wavenardl import NARDL, pss_f_test, symmetry_test

import pandas as pd
data = pd.read_csv('my_data.csv')

# Estimate NARDL with asymmetric exchange rate effects
model = NARDL(
    data=data,
    formula="oil ~ exrate + cpi + Asymmetric(exrate) + deterministic(crisis)",
    maxlag=4,
    criterion='BIC'
)
results = model.fit(mode='grid')
results.summary()

# Cointegration test
pss = pss_f_test(results, case=3)
print(pss)

# Symmetry test
sym = symmetry_test(results)
print(sym)

Wavelet NARDL

from wavenardl import WaveletNARDL

# Fit W-NARDL with HTW denoising (as in the paper)
wmodel = WaveletNARDL(
    data=data,
    formula="oil ~ exrate + Asymmetric(exrate)",
    maxlag=4,
    wavelet_method='htw',  # Haar à Trous from the paper
    n_levels=4
)
results = wmodel.fit(fit_original=True)

# Compare original vs wavelet-denoised NARDL
results['comparison'].summary()

Dynamic Multipliers

from wavenardl import DynamicMultipliers, bootstrap_multipliers, plot_multipliers

# Compute multipliers
dm = DynamicMultipliers(results, horizon=40)
dm.summary()

# Bootstrap confidence intervals
mpsi = bootstrap_multipliers(results, horizon=40, replications=500, confidence_level=95)

# Plot
plot_multipliers(mpsi, variable='exrate', dep_var='oil')

Wavelet Visualization

from wavenardl import HaarATrousWavelet, plot_wavelet_decomposition, plot_scalogram

htw = HaarATrousWavelet(n_levels=6)
analysis = htw.full_analysis(data['oil'].values, name='Oil Price')

# Decomposition plot (paper Fig. 1 style)
plot_wavelet_decomposition(analysis)

# Scalogram heatmap
plot_scalogram(analysis, cmap='magma')

Publication Tables

from wavenardl import summary_table, comparison_table

# LaTeX table for journal submission
latex = summary_table(results, format='latex')
print(latex)

# HTML table for reports
html = summary_table(results, format='html')

Formula Syntax

The formula interface supports R-like specifications:

Formula Element Description
y ~ x1 + x2 Standard ARDL
Asymmetric(x1) or asym(x1) Both LR and SR asymmetry
Lasymmetric(x1) Long-run only asymmetry
Sasymmetric(x1) Short-run only asymmetry
deterministic(d1 + d2) Exogenous / dummy variables
trend Linear time trend
-1 No intercept

Dependencies

  • NumPy, Pandas, SciPy, Statsmodels
  • PyWavelets (pywt)
  • Matplotlib
  • Rich, Tabulate

References

  • Jammazi, R., Lahiani, A., & Nguyen, D. K. (2015). A wavelet-based nonlinear ARDL model for assessing the exchange rate pass-through to crude oil prices. Journal of International Financial Markets, Institutions and Money, 34, 173-187.

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

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

  • Narayan, P. K. (2005). The saving and investment nexus for China. Applied Economics, 37(17), 1979-1990.

Author

Dr Merwan Roudane

License

MIT License

Metadata

Release files for wavenardl 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for wavenardl 1.0.1
File Size Uploaded Provenance
wavenardl-1.0.1.tar.gz 43.6 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for wavenardl 1.0.1
File Interpreter ABI Platform
wavenardl-1.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 92.8 kB

Release files / wavenardl-1.0.1.tar.gz

Download URL wavenardl-1.0.1.tar.gz
Size 43.6 kB
Tags Source
SHA-256 checksum
How to use checksums
4400b9fd8bfdaf45a857edad8c80874112f0989639cc64345896008bbe2126a3
BLAKE2b-256 checksum
How to use checksums
e7c0c31deed5c93683f6137af598a103eda2fa28721734e433f4884195df45bc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.0

Release files / wavenardl-1.0.1-py3-none-any.whl

Download URL wavenardl-1.0.1-py3-none-any.whl
Size 49.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a488f13444c04b1ea358cb563116dc12a674d928a7cef1b2a647e7a9924b25f2
BLAKE2b-256 checksum
How to use checksums
8735f8fbe3498355be84856b3b34f56318585b1d983bce45682aa498bd79abab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.0

Security for wavenardl 1.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page