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] 0.6933099 0.1059470    -2.894750 0.005289061 0.5888336  0.1135148
#> Release[2] 0.7418472 0.0964298    -2.677106 0.009192502 0.6606878  0.1049352
#> Release[3] 0.7779834 0.1144953    -1.939090 0.051188360 0.6541918  0.1152126
#> Release[4] 0.7796338 0.1083422    -2.033984 0.041652071 0.6703353  0.1159261
#> Release[5] 0.8237562 0.1151032    -1.531181 0.115846927 0.7255092  0.1273981
#>            ADF.statistic  ADF.pvalue   DFCT.value DFCT.stderr DFCT.statistic
#> Release[1]     -3.622140 0.000764028  0.459413830   0.1452405      -3.722008
#> Release[2]     -3.233540 0.002183065  0.553793794   0.1382623      -3.227243
#> Release[3]     -3.001479 0.004883293  0.275384339   0.2899485      -2.499118
#> Release[4]     -2.843749 0.007020590  0.174248901   0.2994179      -2.757855
#> Release[5]     -2.154591 0.032032024 -0.002920819   0.4047792      -2.477698
#>            DFCT.pvalue  PP.value PP.stderr PP.statistic   PP.pvalue
#> Release[1]  0.03544964 0.6933099 0.1059470    -2.819899 0.006414345
#> Release[2]  0.09756964 0.7418472 0.0964298    -2.620522 0.010565924
#> Release[3]  0.34289464 0.7779834 0.1144953    -2.194692 0.029173749
#> Release[4]  0.23639116 0.7796338 0.1083422    -2.442588 0.016896947
#> Release[5]  0.35405329 0.8237562 0.1151032    -2.219585 0.027761251