Skip to contents

Cointegration tests (Engle-Granger)

Usage

cointegration(vintages.view, adfk = 1, na.zero = FALSE)

Arguments

vintages.view

mts object. Vertical or diagonal view of the create_vintages() output

adfk

Number of lags to consider for ADF

na.zero

Boolean whether missing values should be considered as 0 or rather as data not (yet) available (the default).

Examples


## Simulated data
df_long <- simulate_long(
    n_period = 10L * 4L,
    n_revision = 5L,
    periodicity = 4L,
    start_period = as.Date("2010-01-01")
)

## Create vintage and test
vintages <- create_vintages(df_long, periodicity = 4L)
cointegration(vintages$diagonal_view)
#>                                 value    stderr statistic       pvalue
#> [Release[1]]_[Release[2]] -0.08435420 0.2423447 -4.474429 6.473130e-05
#> [Release[1]]_[Release[3]] -0.08624975 0.2827088 -3.842292 4.836552e-04
#> [Release[1]]_[Release[4]]  0.04488435 0.2950701 -3.236910 2.482782e-03
#> [Release[1]]_[Release[5]] -0.23468791 0.3735761 -3.305051 2.397918e-03
#> [Release[2]]_[Release[3]] -0.44003964 0.3429364 -4.199144 1.907800e-04
#> [Release[2]]_[Release[4]] -0.43019982 0.3376626 -4.235588 2.008765e-04
#> [Release[2]]_[Release[5]] -0.79308694 0.4261924 -4.207224 2.879950e-04
#> [Release[3]]_[Release[4]] -0.18567532 0.2869406 -4.132128 2.607791e-04
#> [Release[3]]_[Release[5]] -0.83791825 0.3713754 -4.948950 5.026124e-05
#> [Release[4]]_[Release[5]] -0.13313652 0.2962410 -3.825049 7.077735e-04