knitr::opts_chunk$set( echo = TRUE, collapse = TRUE, comment = "#>" )
library(combcoint)
The combcoint
package implements the combined non-cointegration test developed by Bayer and Hanck (2013)
The combined test aggregates p-values from the following individual cointegration tests: Engle-Granger Johansen Boswijk Banerjee
The combined test statistic is calculated using Fisher’s combination formula:
$$C = -2 \sum_{i=1}^{k} \ln(p_i)$$ where $p_i$ are the $p$-values from the individual tests. Under the null hypothesis of no cointegration, C follows a chi-squared distribution with 2$\cdot$k degrees of freedom.
You can install the package from CRAN:
install.packages("combcoint")
Or from GitHub
remotes::install_github("Janine-Langerbein/combcoint")
The package includes an example dataset taken from Luetkepohl (2007) http://www.jmulti.de/download/datasets/e1.dat, often used for cointegration testing exercises.
The dataset is automatically available when the package is loaded. You can load it as follows:
data("lutkepohl_e1")
We demonstrate the application of both the classical Engle-Granger cointegration test and the combined Bayer-Hanck cointegration test using the dataset lutkepohl_e1
included in the package.
We first apply the Engle-Granger test:
englegranger(linvestment ~ lincome + lconsumption, data = lutkepohl_e1)
Next, we apply the combined cointegration test on the same dataset:
bayerhanck(linvestment ~ lincome + lconsumption, data = lutkepohl_e1)
By default, the function uses the lags = 1. Optionally, the user can specify the lag length manually, e.g., with 4 lags:
bayerhanck(linvestment ~ lincome + lconsumption, data = lutkepohl_e1, lags = 4)
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.