API Reference
Complete API documentation for all classes and functions in the NARDL-Fourier library.
NARDL
Standard Nonlinear ARDL model (Shin, Yu & Greenwood-Nimmo, 2014).
class NARDL(data, depvar, exog_vars, decomp_vars, maxlag=4, ic='AIC', case=3)
Parameters
| Parameter |
Type |
Description |
data |
pd.DataFrame |
Time series data |
depvar |
str |
Dependent variable name |
exog_vars |
list |
Exogenous/control variables (linear) |
decomp_vars |
list |
Variables to decompose (asymmetric) |
maxlag |
int |
Maximum lag order (default: 4) |
ic |
str |
Information criterion: 'AIC', 'BIC', 'HQIC' |
case |
int |
Bounds test case (1-5, default: 3) |
Attributes
| Attribute |
Type |
Description |
model |
OLSResults |
Fitted statsmodels OLS model |
best_lags |
dict |
Optimal lag structure {p, q, r} |
best_ic |
float |
Best IC value |
long_run |
dict |
Long-run multipliers per variable |
short_run |
dict |
Short-run coefficients |
ect |
dict |
Error correction term info |
bounds_test |
dict |
PSS bounds test results |
wald |
dict |
Wald asymmetry tests |
diagnostics |
dict |
Diagnostic test results |
Methods
| Method |
Returns |
Description |
summary() |
str |
Full model summary |
FourierNARDL
Fourier NARDL with smooth structural breaks (Zaghdoudi et al., 2023).
class FourierNARDL(data, depvar, exog_vars, decomp_vars, maxlag=4, max_freq=3, ic='AIC', case=3)
Additional Parameters
| Parameter |
Type |
Description |
max_freq |
int |
Maximum Fourier frequency to test (default: 3) |
Additional Attributes
| Attribute |
Type |
Description |
best_freq |
float |
Optimal Fourier frequency k* |
fourier_test |
dict |
Joint significance test for sin/cos terms |
BootstrapNARDL
Bootstrap Fourier NARDL with bootstrap cointegration tests (Bertelli et al., 2022).
class BootstrapNARDL(data, depvar, exog_vars, decomp_vars, maxlag=4, max_freq=3,
ic='AIC', case=3, n_bootstrap=1000, bootstrap_case='III',
random_state=42)
Additional Parameters
| Parameter |
Type |
Description |
n_bootstrap |
int |
Number of bootstrap replications (default: 1000) |
bootstrap_case |
str |
Case: 'II' or 'III' (default: 'III') |
random_state |
int |
Random seed for reproducibility |
Additional Attributes
| Attribute |
Type |
Description |
bootstrap_test |
BootstrapCointegrationTest |
Bootstrap test object |
bootstrap_results |
dict |
Bootstrap test results |
Additional Methods
| Method |
Returns |
Description |
cointegration_decision() |
str |
Decision with interpretation |
plot_bootstrap_distributions(figsize) |
Figure |
Bootstrap distribution plots |
PSSBoundsTest
PSS Bounds Test for cointegration.
class PSSBoundsTest(model, k, case=3)
Parameters
| Parameter |
Type |
Description |
model |
OLSResults |
Fitted NARDL model |
k |
int |
Number of regressors |
case |
int |
Case (1-5) |
BootstrapCointegrationTest
Bootstrap cointegration tests following Bertelli et al. (2022).
class BootstrapCointegrationTest(model, data, depvar, decomp_vars, exog_vars,
best_lags, n_bootstrap=1000, case='III',
random_state=None)
Methods
| Method |
Returns |
Description |
get_results() |
dict |
Complete test results |
summary_table() |
pd.DataFrame |
Formatted summary table |
ResultsTable
Generate publication-ready tables.
class ResultsTable(model)
Methods
| Method |
Parameters |
Description |
regression_table(output) |
output: 'dataframe', 'latex', 'html', 'markdown' |
Regression results table |
long_run_table(output) |
output: format string |
Long-run multipliers table |
short_run_table(output) |
output: format string |
Short-run coefficients table |
diagnostics_table(output) |
output: format string |
Diagnostic tests table |
bounds_test_table(output) |
output: format string |
Bounds test table |
wald_test_table(output) |
output: format string |
Wald asymmetry tests table |
to_latex(filename, tables) |
filename: str, tables: list or 'all' |
Export to LaTeX file |
NARDLPlots
Visualization tools for NARDL models.
class NARDLPlots(model)
Methods
| Method |
Parameters |
Description |
dynamic_multipliers(var, horizon, ci) |
var: str, horizon: int, ci: float |
Dynamic multiplier plot |
cusum(alpha) |
alpha: significance level |
CUSUM plot |
cusumsq(alpha) |
alpha: significance level |
CUSUM of squares plot |
residual_diagnostics() |
- |
Residual diagnostic plots |
Utility Functions
from nardl_fourier.utils import (
partial_sum_decomposition,
check_stationarity,
compute_fourier_terms
)
| Function |
Description |
partial_sum_decomposition(x) |
Decompose series into positive/negative partial sums |
check_stationarity(x, test, alpha) |
ADF/PP/KPSS stationarity tests |
compute_fourier_terms(T, k) |
Compute sin/cos terms for frequency k |
Diagnostic Functions
from nardl_fourier.diagnostics import (
jarque_bera_test,
breusch_godfrey_test,
breusch_pagan_test,
cusum_test,
cusumsq_test,
run_all_diagnostics
)
| Function |
Description |
jarque_bera_test(resid) |
Normality test |
breusch_godfrey_test(model, nlags) |
Serial correlation test |
breusch_pagan_test(model) |
Heteroskedasticity test |
cusum_test(resid, alpha) |
CUSUM stability test |
cusumsq_test(resid, alpha) |
CUSUM of squares test |
run_all_diagnostics(model) |
Run all diagnostics at once |