simshocks: Simulation of Gaussian shocks for risk factors

View source: R/simulations_shocks.R

simshocksR Documentation

Simulation of Gaussian shocks for risk factors

Description

Generates Gaussian shocks for simulating risk factors using various methods including classic Monte Carlo, antithetic variates, moment matching, and hybrid approaches.

Usage

simshocks(
  n,
  horizon,
  frequency = c("annual", "semi-annual", "quarterly", "monthly", "weekly", "daily"),
  method = c("classic", "antithetic", "mm", "hybridantimm", "TAG"),
  family = NULL,
  par = NULL,
  par2 = rep(0, length(par)),
  RVM = NULL,
  type = c("CVine", "DVine", "RVine"),
  start = NULL,
  seed = 123
)

Arguments

n

Number of simulations/scenarios

horizon

Time horizon for simulation

frequency

Frequency of observations: "annual", "semi-annual", "quarterly", "monthly", "weekly", or "daily"

method

Simulation method: "classic", "antithetic", "mm" (moment matching), "hybridantimm" (hybrid antithetic-moment matching), or "TAG"

family

Vector of copula families (optional)

par

Vector of copula parameters (optional)

par2

Vector of second copula parameters (optional)

RVM

RVineMatrix object for R-vine copula (optional)

type

Type of vine copula: "CVine", "DVine", or "RVine"

start

Starting time (optional)

seed

Random seed for reproducibility

Details

The function generates Gaussian shocks that can be used for simulating various risk factors. Different simulation methods are available:

  • "classic": Standard Monte Carlo simulation

  • "antithetic": Uses antithetic variates to reduce variance

  • "mm": Moment matching to improve statistical properties

  • "hybridantimm": Combines antithetic variates and moment matching

  • "TAG": Taguchi method

When using copulas (by specifying family and par), the function supports C-vine, D-vine, and R-vine copula structures.

Value

A time series object containing the simulated Gaussian shocks

Examples

# Generate shocks using classic Monte Carlo
shocks <- simshocks(n = 1000, horizon = 5, frequency = "quarterly")

# Generate shocks using antithetic variates
shocks_antithetic <- simshocks(n = 1000, horizon = 5, frequency = "quarterly",
                              method = "antithetic")

# Generate shocks using C-vine copula
shocks_copula <- simshocks(n = 1000, horizon = 5, frequency = "quarterly",
                          family = c(1, 1), par = c(0.5, 0.3),
                          type = "CVine")


Techtonique/ESGtoolkit documentation built on June 11, 2025, 6:24 p.m.