Skip to contents

Unit root test

Usage

unitroot(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 Augmented Dicky-Fuller (ADF) test

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)
unitroot(vintages[["diagonal_view"]])
#>            DF.value  DF.stderr DF.statistic DF.pvalue ADF.value ADF.stderr
#> Release[1] 1.012299 0.01360221    0.9042249 0.8982287  1.012901 0.01454395
#> Release[2] 1.030057 0.01434186    2.0957251 0.9887260  1.026659 0.01646841
#> Release[3] 1.036825 0.01448038    2.5431288 0.9958057  1.027811 0.01731627
#> Release[4] 1.133463 0.07375288    1.8096039 0.9780057  1.121354 0.11532950
#> Release[5] 1.115859 0.12234962    0.9469484 0.9027843  1.098563 0.27637837
#>            ADF.statistic ADF.pvalue  DFCT.value DFCT.stderr DFCT.statistic
#> Release[1]     0.8870500  0.8953677  0.94672919  0.08075693     -0.6596438
#> Release[2]     1.6187872  0.9708928  0.81436748  0.15754395     -1.1782903
#> Release[3]     1.6060837  0.9699941  0.65786013  0.19517929     -1.7529517
#> Release[4]     1.0522356  0.9178617  0.09458938  0.48059457     -1.8839385
#> Release[5]     0.3566233  0.7765613 -0.25027918  0.66292368     -1.8860077
#>            DFCT.pvalue PP.value  PP.stderr PP.statistic PP.pvalue
#> Release[1]   0.9665384 1.012299 0.01360221    0.8327207 0.8861984
#> Release[2]   0.8932913 1.030057 0.01434186    2.0489660 0.9875731
#> Release[3]   0.7103413 1.036825 0.01448038    2.4427657 0.9946847
#> Release[4]   0.6448796 1.133463 0.07375288    2.1366437 0.9878585
#> Release[5]   0.6432629 1.115859 0.12234962    1.1188415 0.9262597