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
)
Number of simulations/scenarios
Time horizon for simulation
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"
Simulation method: "classic", "antithetic", "mm" (moment matching), "hybridantimm" (hybrid antithetic-moment matching), or "TAG"
Vector of copula families (optional)
Vector of copula parameters (optional)
Vector of second copula parameters (optional)
RVineMatrix object for R-vine copula (optional)
Type of vine copula: "CVine", "DVine", or "RVine"
Starting time (optional), better used with numeric frequency
Ending time (optional), better used with numeric frequency
Random seed for reproducibility
A time series object containing the simulated Gaussian shocks
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.
# 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")