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.0760920 0.02650206    2.8711717 0.9983733 1.0706418 0.03494104
#> Release[2] 1.0797077 0.02169862    3.6733980 0.9997991 1.0449947 0.02861695
#> Release[3] 0.9544934 0.05288013   -0.8605614 0.3188937 0.9361367 0.05377613
#> Release[4] 0.9563834 0.05157373   -0.8457132 0.3246546 0.9422743 0.05422577
#> Release[5] 1.0065022 0.06202035    0.1048397 0.6987347 1.0032162 0.06771362
#>            ADF.statistic ADF.pvalue DFCT.value DFCT.stderr DFCT.statistic
#> Release[1]    2.02174337  0.9873704  0.9373832  0.05674814      -1.103415
#> Release[2]    1.57230855  0.9688151  0.9511755  0.04311644      -1.132388
#> Release[3]   -1.18757674  0.2051380  0.3611297  0.24695041      -2.587039
#> Release[4]   -1.06454285  0.2450705  0.3239961  0.28829986      -2.344794
#> Release[5]    0.04749681  0.6790338 -0.1899049  0.38666233      -3.077375
#>            DFCT.pvalue  PP.value  PP.stderr PP.statistic PP.pvalue
#> Release[1]   0.9108172 1.0760920 0.02650206    2.5667940 0.9964668
#> Release[2]   0.9054680 1.0797077 0.02169862    2.6465254 0.9971078
#> Release[3]   0.3038507 0.9544934 0.05288013   -0.9088984 0.3006094
#> Release[4]   0.4168471 0.9563834 0.05157373   -0.9059072 0.3017861
#> Release[5]   0.1437274 1.0065022 0.06202035    0.4597083 0.8043938