ARDL

ARDL: An R package for the analysis of level relationships - Published in JOSS (2022)

https://github.com/natsiopoulos/ardl

Science Score: 93.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 5 DOI reference(s) in README and JOSS metadata
  • Academic publication links
    Links to: wiley.com
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
    Published in Journal of Open Source Software

Scientific Fields

Economics Social Sciences - 60% confidence
Earth and Environmental Sciences Physical Sciences - 40% confidence
Engineering Computer Science - 40% confidence
Last synced: 4 months ago · JSON representation

Repository

ARDL, ECM and Bounds-Test for Cointegration

Basic Info
  • Host: GitHub
  • Owner: Natsiopoulos
  • License: gpl-3.0
  • Language: R
  • Default Branch: master
  • Size: 16.7 MB
Statistics
  • Stars: 19
  • Watchers: 2
  • Forks: 9
  • Open Issues: 8
  • Releases: 6
Created almost 6 years ago · Last pushed 7 months ago
Metadata Files
Readme Changelog Contributing License

README.Rmd

---
output: github_document
---



```{r, include = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)
```

# ARDL 


[![downloads](https://cranlogs.r-pkg.org/badges/grand-total/ARDL)](https://CRAN.R-project.org/package=ARDL)
[![CRAN status](https://www.r-pkg.org/badges/version/ARDL)](https://CRAN.R-project.org/package=ARDL)
[![Lifecycle: stable](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://lifecycle.r-lib.org/articles/stages.html#stable)
[![codecov](https://codecov.io/gh/Natsiopoulos/ARDL/branch/master/graph/badge.svg?token=PVZAY57F3D)](https://app.codecov.io/gh/Natsiopoulos/ARDL)


## Overview

`ARDL` creates complex autoregressive distributed lag (ARDL) models and constructs the underlying unrestricted and restricted error correction model (ECM) automatically, just by providing the order. It also performs the bounds-test for cointegration as described in [Pesaran et al. (2001)](https://onlinelibrary.wiley.com/doi/abs/10.1002/jae.616) and provides the multipliers and the cointegrating equation. The validity and the accuracy of this package have been verified by successfully replicating the results of Pesaran et al. (2001) in [Natsiopoulos and Tzeremes (2022)](https://onlinelibrary.wiley.com/doi/abs/10.1002/jae.2919).

## Why `ARDL`?

- Estimate complex ARDL models just providing the ARDL order
- Estimate the conditional ECM just providing the underlying ARDL model or the order
- Estimate the long-run, short-run, delay, and interim multipliers
- Apply the bound test for no cointegration (*Pesaran et al., 2001*)
	- Both the *F-test* and the *t-test* are available
	- The *p-value* is also available along with the *critical value bounds* for specific level of statistical significance
	- Exact *p-values* and *critical value bounds* are available, along with the asymptotic ones

## Installation

```{r, eval = FALSE}
# You can install the released version of ARDL from CRAN:
install.packages("ARDL")

# Or the latest development version from GitHub:
install.packages("devtools")
devtools::install_github("Natsiopoulos/ARDL")
```

## Usage

This is a basic example which shows how to use the main functions of the `ARDL` package.

Assume that we want to model the `LRM` (logarithm of real money, M2) as a function of `LRY`, `IBO` and `IDE` (see `?denmark`). The problem is that applying an OLS regression on non-stationary data would result into a spurious regression. The estimated parameters would be consistent only if the series were cointegrated.

```{r include=FALSE}
library(ARDL)
```

```{r pkg-data}
library(ARDL)
data(denmark)
```

First, we find the best ARDL specification. We search up to order 5.

```{r auto-ardl}
models <- auto_ardl(LRM ~ LRY + IBO + IDE, data = denmark, max_order = 5)

# The top 20 models according to the AIC
models$top_orders

# The best model was found to be the ARDL(3,1,3,2)
ardl_3132 <- models$best_model
ardl_3132$order
summary(ardl_3132)
```

Then we can estimate the UECM (Unrestricted Error Correction Model) of the underlying ARDL(3,1,3,2).

```{r uecm}
uecm_3132 <- uecm(ardl_3132)
summary(uecm_3132)
```

And also the RECM (Restricted Error Correction Model) of the underlying ARDL(3,1,3,2), allowing the constant to join the long-run relationship (case 2), instead of the short-run (case 3).

```{r recm}
recm_3132 <- recm(uecm_3132, case = 2)
summary(recm_3132)
```

Let's test if there is a long-run levels relationship (cointegration) using the **bounds test** from *Pesaran et al. (2001)*.

```{r bounds-test}
# The bounds F-test (under the case 2) rejects the NULL hypothesis (let's say, assuming alpha = 0.01) with p-value = 0.004418.
bounds_f_test(ardl_3132, case = 2)

# The bounds t-test (under the case 3) rejects the NULL hypothesis (let's say, assuming alpha = 0.01) with p-value = 0.005538.
# We also provide the critical value bounds for alpha = 0.01.
tbounds <- bounds_t_test(uecm_3132, case = 3, alpha = 0.01)
tbounds

# Here is a more clear view of the main results.
tbounds$tab
```

Here we have the short-run and the long-run multipliers (with standard errors, t-statistics and p-values).

```{r mult}
multipliers(ardl_3132, type = "sr")
multipliers(ardl_3132)
```

We can also estimate and visualize the delay multipliers along with their standard errors.

```{r}
mult15 <- multipliers(ardl_3132, type = 15, se = TRUE)
plot_delay(mult15, interval = 0.95)
```


Now let's graphically check the estimated long-run relationship (cointegrating equation) against the dependent variable `LRM`.

```{r ce}
ce <- coint_eq(ardl_3132, case = 2)
```

```{r lr-plot}
plot_lr(ardl_3132, coint_eq = ce, show.legend = TRUE)
```

Forecasting and using an `ardl`, `uecm`, or `recm` model in other functions are easy as they can be converted in regular `lm` models.

```{r Convert-to-lm-and-forecast}
ardl_3132_lm <- to_lm(ardl_3132)

# Forecast using the in-sample data
insample_data <- ardl_3132$model
predicted_values <- predict(ardl_3132_lm, newdata = insample_data)

# Convert to ts class for the plot
predicted_values <- ts(predicted_values, start = c(1974,4), frequency=4)
plot(denmark$LRM, lwd=2) #The input dependent variable
lines(predicted_values, col="red", lwd=2) #The predicted values
```

## Ease of use

Let's see what it takes to build the above ARDL(3,1,3,2) model.

**Using the `ARDL` package (literally one line of code):**

```{r ease-of-use-ardl}
ardl_model <- ardl(LRM ~ LRY + IBO + IDE, data = denmark, order = c(3,1,3,2))
```

**Without the `ARDL` package:**
*(Using the `dynlm` package, because striving with the `lm` function would require extra data transformation to behave like time-series)* ```{r dynlm-ardl} library(dynlm) dynlm_ardl_model <- dynlm(LRM ~ L(LRM, 1) + L(LRM, 2) + L(LRM, 3) + LRY + L(LRY, 1) + IBO + L(IBO, 1) + L(IBO, 2) + L(IBO, 3) + IDE + L(IDE, 1) + L(IDE, 2), data = denmark) ``` ```{r} identical(ardl_model$coefficients, dynlm_ardl_model$coefficients) ``` An ARDL model has a relatively simple structure, although the difference in typing effort is noticeable. Not to mention the complex transformation for an ECM. The extra typing is the least of your problems trying to do this. First you would need to figure out the exact structure of the model! **Using the `ARDL` package (literally one line of code):** ```{r ease-of-use-uecm} uecm_model <- uecm(ardl_model) ``` **Without the `ARDL` package:** ```{r dynlm-uecm} dynlm_uecm_model <- dynlm(d(LRM) ~ L(LRM, 1) + L(LRY, 1) + L(IBO, 1) + L(IDE, 1) + d(L(LRM, 1)) + d(L(LRM, 2)) + d(LRY) + d(IBO) + d(L(IBO, 1)) + d(L(IBO, 2)) + d(IDE) + d(L(IDE, 1)), data = denmark) ``` ```{r} identical(uecm_model$coefficients, dynlm_uecm_model$coefficients) ``` ## References Natsiopoulos, Kleanthis, & Tzeremes, Nickolaos G. (2022). ARDL bounds test for cointegration: Replicating the Pesaran et al. (2001) results for the UK earnings equation using R. *Journal of Applied Econometrics*, 37(5), 1079-1090. https://doi.org/10.1002/jae.2919 Pesaran, M. H., Shin, Y., & Smith, R. J. (2001). Bounds testing approaches to the analysis of level relationships. *Journal of Applied Econometrics*, 16(3), 289-326

JOSS Publication

ARDL: An R package for the analysis of level relationships
Published
November 16, 2022
Volume 7, Issue 79, Page 3496
Authors
Kleanthis Natsiopoulos ORCID
Department of Economics, University of Thessaly, 28th October, 78, 38333, Volos, Greece
Nickolaos G. Tzeremes ORCID
Department of Economics, University of Thessaly, 28th October, 78, 38333, Volos, Greece
Editor
Sebastian Benthall ORCID
Tags
ARDL bounds test cointegration econometrics

Papers & Mentions

Total mentions: 12

The effects of carbon emissions, rainfall, temperature, inflation, population, and unemployment on economic growth in Saudi Arabia: An ARDL investigation
Last synced: 3 months ago
Predicting the influence of climate on grassland area burned in Xilingol, China with dynamic simulations of autoregressive distributed lag models
Last synced: 3 months ago
Impact of oil prices, the U.S interest rates on Turkey’s real estate market. New evidence from combined co-integration and bootstrap ARDL tests
Last synced: 3 months ago
How the banking system is creating a two-way inflation in an economy
Last synced: 3 months ago
Do government expenditure and financial development impede environmental degradation in Venezuela?
Last synced: 3 months ago
Modeling the nexus between coal consumption, FDI inflow and economic expansion: does industrialization matter in South Africa?
Last synced: 3 months ago
Does globalization in Turkey induce increased energy consumption: insights into its environmental pros and cons
Last synced: 3 months ago
The Local and Systemic Humoral Immune Response Against Homologous and Heterologous Strains of the Type 2 Porcine Reproductive and Respiratory Syndrome Virus
Last synced: 3 months ago
ICT, energy consumption, financial development, and environmental degradation in South Africa
Last synced: 3 months ago
Seasonal weather and climate prediction over area burned in grasslands of northeast China
Last synced: 3 months ago
Effects of health on changing labor force participation in Pakistan
Last synced: 3 months ago
Sustainable Development and Crude Oil Revenue: A Case of Selected Crude Oil-Producing African Countries
Last synced: 3 months ago

GitHub Events

Total
  • Watch event: 2
  • Delete event: 1
  • Issue comment event: 2
  • Push event: 3
  • Pull request event: 3
  • Fork event: 1
  • Create event: 1
Last Year
  • Watch event: 2
  • Delete event: 1
  • Issue comment event: 2
  • Push event: 3
  • Pull request event: 3
  • Fork event: 1
  • Create event: 1

Committers

Last synced: 5 months ago

All Time
  • Total Commits: 59
  • Total Committers: 2
  • Avg Commits per committer: 29.5
  • Development Distribution Score (DDS): 0.034
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Natsiopoulos k****o@g****m 57
Unknown u****n@e****m 2

Issues and Pull Requests

Last synced: 4 months ago

All Time
  • Total issues: 20
  • Total pull requests: 6
  • Average time to close issues: 8 months
  • Average time to close pull requests: 1 day
  • Total issue authors: 13
  • Total pull request authors: 2
  • Average comments per issue: 2.45
  • Average comments per pull request: 0.17
  • Merged pull requests: 6
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 2
  • Average time to close issues: N/A
  • Average time to close pull requests: 3 days
  • Issue authors: 0
  • Pull request authors: 2
  • Average comments per issue: 0
  • Average comments per pull request: 0.0
  • Merged pull requests: 2
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • jessie-dotson (4)
  • nipnipj (3)
  • mabuimo (2)
  • omzeybek (2)
  • profkenm (1)
  • jngwj (1)
  • Heisenberg32 (1)
  • sammy-w (1)
  • egalion (1)
  • AZFARHAD24511 (1)
  • melville1808 (1)
  • elemn (1)
  • ha0ye (1)
Pull Request Authors
  • Natsiopoulos (6)
  • daniel-finnan (2)
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • cran 1,734 last-month
  • Total docker downloads: 21,613
  • Total dependent packages: 1
  • Total dependent repositories: 1
  • Total versions: 7
  • Total maintainers: 1
cran.r-project.org: ARDL

ARDL, ECM and Bounds-Test for Cointegration

  • Versions: 7
  • Dependent Packages: 1
  • Dependent Repositories: 1
  • Downloads: 1,734 Last month
  • Docker Downloads: 21,613
Rankings
Docker downloads count: 0.6%
Forks count: 7.3%
Downloads: 10.3%
Average: 12.2%
Stargazers count: 13.3%
Dependent packages count: 18.1%
Dependent repos count: 23.9%
Maintainers (1)
Last synced: 4 months ago

Dependencies

DESCRIPTION cran
  • R >= 3.5.0 depends
  • aod * imports
  • dplyr * imports
  • dynlm * imports
  • lmtest * imports
  • msm * imports
  • stringr * imports
  • zoo * imports
  • qpcR * suggests
  • sandwich * suggests
  • testthat >= 3.0.0 suggests
  • xts * suggests
.github/workflows/test-coverage.yaml actions
  • actions/checkout v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite