# Introduction to combcoint

# Overview

The `combcoint` package implements the combined non-cointegration test developed by Bayer and Hanck (2013) doi:10.1111/j.1467-9892.2012.00814.x. This statistical approach improves the reliability of cointegration detection by aggregating p-values from multiple individual cointegration tests into a single joint test statistic. Specifically, it combines the outcomes of the Engle-Granger, Johansen, Boswijk and Banerjee tests using a Fisher-type combination method. The approach enhances the power and robustness of cointegration testing, particularly in situations where individual tests yield mixed or inconclusive results.

# Methodology

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.

# Installation

You can install the package from CRAN:

    install.packages("combcoint")

Or from GitHub

    remotes::install_github("Janine-Langerbein/combcoint")

# Dataset

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")

# Applied Example

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)
    #> $test.stat
    #> [1] -2.45286
    #>
    #> $lags
    #> [1] 1
    #>
    #> $trend
    #> [1] "const"
    #>
    #> $test
    #> [1] "Engle-Granger"
    #>
    #> $formula
    #> linvestment ~ lincome + lconsumption

Next, we apply the combined cointegration test on the same dataset:

    bayerhanck(linvestment ~ lincome + lconsumption, data = lutkepohl_e1)
    #> Registered S3 method overwritten by 'quantmod':
    #>   method            from
    #>   as.zoo.data.frame zoo
    #> ----------------------------------------------------------
    #> Bayer Hanck Test for Non-Cointegration
    #> ----------------------------------------------------------
    #> Test statistic: 12.4303
    #> p-Value: 0.1858

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)
    #> ----------------------------------------------------------
    #> Bayer Hanck Test for Non-Cointegration
    #> ----------------------------------------------------------
    #> Test statistic: 9.1603
    #> p-Value: 0.3111