Skip to contents

Bootstrap Standard Errors

Usage

BootSE(x)

Arguments

x

Numeric matrix. Output of PBootVAROLS(), PBootVARLasso(), RBootVAROLS(), or RBootVARLasso().

Value

A matrix of standard errors.

See also

Other Simulation of Autoregressive Data Functions: BootCI(), SelectVARLasso(), SimVARExo(), SimVAR(), YXExo(), YX()

Author

Ivan Jacob Agaloos Pesigan

Examples

set.seed(42)
# Parametric bootstrap
system.time(
  pb <- PBootVAROLS(
    data = dat_p2,
    p = 2,
    B = 5,
    burn_in = 20
  )
)
#>    user  system elapsed 
#>   0.006   0.007   0.008 
pb$est
#>           [,1]        [,2]        [,3]        [,4]        [,5]         [,6]
#> [1,] 0.7899726  0.36836768 0.008539283  0.02231498  0.11338780  0.024505442
#> [2,] 1.0001995  0.01334496 0.481949237 -0.01730029 -0.03223315  0.234373552
#> [3,] 1.0666814 -0.03022951 0.014945306  0.60741736 -0.01610408 -0.006149189
#>             [,7]
#> [1,] -0.01143384
#> [2,]  0.01815779
#> [3,]  0.29620975
BootSE(pb)
#>           [,1]       [,2]       [,3]       [,4]       [,5]       [,6]
#> [1,] 0.3648676 0.02451411 0.03127928 0.02723355 0.04789385 0.04190886
#> [2,] 0.2199721 0.02181435 0.01852744 0.03444278 0.03192600 0.02659343
#> [3,] 0.2215578 0.01302096 0.04197963 0.02065905 0.04395353 0.02148834
#>            [,7]
#> [1,] 0.03224394
#> [2,] 0.02813527
#> [3,] 0.01333655
system.time(
  pb <- PBootVARLasso(
    data = dat_p2,
    p = 2,
    B = 5,
    burn_in = 20,
    n_lambdas = 50,
    crit = "ebic",
    max_iter = 1000,
    tol = 1e-5
  )
)
#>    user  system elapsed 
#>   3.726   1.251   2.503 
pb$est
#>           [,1]    [,2]      [,3]      [,4]       [,5]      [,6]      [,7]
#> [1,] 0.7899726 0.34043 0.0000000 0.0000000 0.08292061 0.0000000 0.0000000
#> [2,] 1.0001995 0.00000 0.4555224 0.0000000 0.00000000 0.2105309 0.0000000
#> [3,] 1.0666814 0.00000 0.0000000 0.5866893 0.00000000 0.0000000 0.2722931
BootSE(pb)
#>            [,1]       [,2]       [,3]       [,4]       [,5]       [,6]
#> [1,] 0.22911508 0.02801525 0.00000000 0.00000000 0.03203138 0.00000000
#> [2,] 0.07295463 0.00000000 0.02446966 0.00000000 0.00000000 0.04757121
#> [3,] 0.12893135 0.00000000 0.00000000 0.02917335 0.00000000 0.00000000
#>            [,7]
#> [1,] 0.00000000
#> [2,] 0.00000000
#> [3,] 0.02712867

# Residual bootstrap
system.time(
  rb <- RBootVAROLS(
    data = dat_p2,
    p = 2,
    B = 5
  )
)
#>    user  system elapsed 
#>   0.002   0.000   0.001 
rb$est
#>           [,1]        [,2]        [,3]        [,4]        [,5]         [,6]
#> [1,] 0.7899726  0.36836768 0.008539283  0.02231498  0.11338780  0.024505442
#> [2,] 1.0001995  0.01334496 0.481949237 -0.01730029 -0.03223315  0.234373552
#> [3,] 1.0666814 -0.03022951 0.014945306  0.60741736 -0.01610408 -0.006149189
#>             [,7]
#> [1,] -0.01143384
#> [2,]  0.01815779
#> [3,]  0.29620975
BootSE(rb)
#>           [,1]       [,2]       [,3]       [,4]       [,5]        [,6]
#> [1,] 0.1435961 0.03029526 0.03034269 0.02723993 0.02947239 0.007757184
#> [2,] 0.1489594 0.02522726 0.01674005 0.02633025 0.01792935 0.017458148
#> [3,] 0.2133440 0.02539343 0.04924191 0.01684376 0.03071153 0.033001056
#>            [,7]
#> [1,] 0.02363684
#> [2,] 0.02852299
#> [3,] 0.02915080
system.time(
  rb <- RBootVARLasso(
    data = dat_p2,
    p = 2,
    B = 5,
    n_lambdas = 50,
    crit = "ebic",
    max_iter = 1000,
    tol = 1e-5
  )
)
#>    user  system elapsed 
#>   4.430   1.548   3.027 
rb$est
#>           [,1]    [,2]      [,3]      [,4]       [,5]      [,6]      [,7]
#> [1,] 0.7899726 0.34043 0.0000000 0.0000000 0.08292061 0.0000000 0.0000000
#> [2,] 1.0001995 0.00000 0.4555224 0.0000000 0.00000000 0.2105309 0.0000000
#> [3,] 1.0666814 0.00000 0.0000000 0.5866893 0.00000000 0.0000000 0.2722931
BootSE(rb)
#>           [,1]        [,2]       [,3]        [,4]        [,5]        [,6]
#> [1,] 0.2451917 0.004609479 0.00000000 0.000000000 0.001122759 0.000000000
#> [2,] 0.2770871 0.000000000 0.01377074 0.000000000 0.000000000 0.006364486
#> [3,] 0.1866689 0.000000000 0.00000000 0.006006319 0.000000000 0.000000000
#>             [,7]
#> [1,] 0.000000000
#> [2,] 0.000000000
#> [3,] 0.002787642