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.0328634 0.07377414    0.4454601 0.8011735  1.061959 0.08698220
#> Release[2] 1.0615015 0.07152490    0.8598613 0.8898221  1.063526 0.08027818
#> Release[3] 1.1812444 0.15000615    1.2082466 0.9369958  1.172373 0.18283643
#> Release[4] 0.6664229 0.38438941   -0.8678102 0.3169076  1.148419        NaN
#> Release[5] 0.0000000 0.00000000    0.0000000 0.0000000  0.000000 0.00000000
#>            ADF.statistic ADF.pvalue  DFCT.value DFCT.stderr DFCT.statistic
#> Release[1]     0.7123188  0.8625823  0.02087265   0.2356117      -4.155682
#> Release[2]     0.7913275  0.8776692  0.19382245   0.2416421      -3.336247
#> Release[3]     0.9427727  0.9025676  0.10492444   0.3778558      -2.368829
#> Release[4]           NaN        NaN -2.48545171         NaN            NaN
#> Release[5]     0.0000000  0.0000000  0.00000000   0.0000000       0.000000
#>            DFCT.pvalue  PP.value  PP.stderr PP.statistic PP.pvalue
#> Release[1]  0.01774043 1.0328634 0.07377414    1.0795272 0.9225114
#> Release[2]  0.08614630 1.0615015 0.07152490    1.3952913 0.9551763
#> Release[3]  0.40523727 1.1812444 0.15000615    1.3147827 0.9475635
#> Release[4]         NaN 0.6664229 0.38438941   -0.8704289 0.3159075
#> Release[5]  0.00000000 0.0000000 0.00000000    0.0000000 0.0000000