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

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,
  end_ = NULL,
  seed = 123
)

Arguments

n

Number of simulations/scenarios

horizon

Time horizon for simulation

frequency

Frequency of observations: if numeric (as for ts objects), better used with start_ and end_. Otherwise a string, either "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), better used with numeric frequency

end_

Ending time (optional), better used with numeric frequency

seed

Random seed for reproducibility

Value

A time series object containing the simulated Gaussian shocks

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": TAG method

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

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")