Learn R Programming

ffp (version 0.2.2)

bootstrap_scenarios: Flexible Probabilities Driven Bootstrap

Description

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)

Value

A tibble with the number of rows equal to 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.

Details

The argument x is supposed to have the same size of p.

Examples

Run this code
set.seed(123)
ret <- diff(log(EuStockMarkets))
ew  <- rep(1 / nrow(ret), nrow(ret))

bootstrap_scenarios(x = ret, p = as_ffp(ew), n = 10)

Run the code above in your browser using DataLab