Resamples historical scenarios with flexible probabilities.
Usage
bootstrap_scenarios(x, p, n)
# S3 method for numeric
bootstrap_scenarios(x, p, n)
# S3 method for matrix
bootstrap_scenarios(x, p, n)
# S3 method for ts
bootstrap_scenarios(x, p, n)
# S3 method for xts
bootstrap_scenarios(x, p, n)
# S3 method for tbl
bootstrap_scenarios(x, p, n)
# S3 method for data.frame
bootstrap_scenarios(x, p, n)
Arguments
- x
A time series defining the scenario-probability distribution.
- p
An object of the
ffp
class.- n
An
integer
scalar with the number of scenarios to be generated.
Examples
set.seed(123)
ret <- diff(log(EuStockMarkets))
ew <- rep(1 / nrow(ret), nrow(ret))
bootstrap_scenarios(x = ret, p = as_ffp(ew), n = 10)
#> # A tibble: 10 × 4
#> DAX SMI CAC FTSE
#> <dbl> <dbl> <dbl> <dbl>
#> 1 0.00313 -0.00611 0.00344 0.00349
#> 2 0.00180 0.00548 -0.00514 -0.000790
#> 3 0.00355 -0.00732 -0.0111 0.00138
#> 4 -0.0111 -0.00350 -0.00344 -0.00667
#> 5 0.00691 0.00824 0.00385 -0.00216
#> 6 0.00452 0.00608 0.00938 0.0173
#> 7 0.00351 0.0000394 -0.00527 0.000658
#> 8 0.00349 0.00387 0 0.00888
#> 9 0.0100 0.00157 -0.00274 0.00101
#> 10 -0.00686 -0.00927 0.00165 0.0112