Skip to contents

Linear regression model of a latter vintage (L) on a preliminary vintage (P)

Usage

slope_and_drift(vintages.view, gap = 1, na.zero = FALSE)

Arguments

vintages.view

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

gap

Integer. Gap to consider between each vintages. Default is 1 which means that revisions are calculated and tested for each vintages consecutively.

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)
slope_and_drift(vintages$diagonal_view)
#>             N        R2         F intercept.estimate intercept.stderr
#> Release[2] 29 0.9939361  4425.602         0.15027633        0.6926224
#> Release[3] 26 0.9985866 16956.903        -0.25206122        0.3298895
#> Release[4] 17 0.9992438 19821.412         0.23581438        0.2107640
#> Release[5] 14 0.9997989 59650.136        -0.04437905        0.1026261
#>            intercept.pvalue slope.estimate slope.stderr slope.pvalue   skewness
#> Release[2]        0.8298651      0.9961734  0.014974377    0.8002403 -0.3722054
#> Release[3]        0.4522681      1.0026125  0.007699452    0.7373301 -0.6780136
#> Release[4]        0.2808000      1.0081042  0.007160414    0.2754838 -0.2080953
#> Release[5]        0.6730950      0.9986551  0.004088931    0.7478881 -0.3615824
#>               kurtosis JarqueBera.value JarqueBera.pvalue BreuschPagan.R2
#> Release[2]  0.89969211        1.5908588         0.4513874     0.003804105
#> Release[3] -0.41506612        2.0948851         0.3508338     0.004235920
#> Release[4] -1.00251497        0.7855006         0.6751973     0.075373274
#> Release[5] -0.05842755        0.2851232         0.8671342     0.113710532
#>            BreuschPagan.value BreuschPagan.pvalue   White.R2 White.value
#> Release[2]          0.1031030           0.7506095 0.02828903   0.8203818
#> Release[3]          0.1020945           0.7520952 0.08563116   2.2264103
#> Release[4]          1.2227627           0.2862397 0.10342178   1.7581703
#> Release[5]          1.5395945           0.2383890 0.12346070   1.7284498
#>            White.pvalue      arch.R2  arch.value arch.pvalue
#> Release[2]    0.6635236 0.0746503261 2.090209131   0.1482458
#> Release[3]    0.3285044 0.0450459388 1.126148471   0.2885984
#> Release[4]    0.4151625 0.0002702476 0.004323962   0.9475714
#> Release[5]    0.4213780 0.0145449596 0.189084475   0.6636797