I have a two-variable data set (stock and bond returns) and have fitted distributions to each using fitDist
have chosen a copula using BiCopSelect
and have modeled the bivariate distribution using mvdc
Now, I would like to generate thousands of simulated values from the empirical marginal distributions linked with the empirical copula. I thought about randomly selecting values from both the stock and bond columns, but I don’t think that would capture dependence.
How can I use mdvc
with empirical margins? Or should I be using different code altogether?
What I’ve tried is:
emp_pobs <- pobs(as.matrix(cbind(SPX,Agg)))
emp_cop <- empCopula(emp_pobs)
n.grid <- 24
sq <- seq(0, 1, length.out = n.grid)
u <- as.matrix(expand.grid("u[1]" = sq, "u[2]" = sq, KEEP.OUT.ATTRS = FALSE))
delta <- 0.01
sq. <- seq(delta, 1-delta, length.out = n.grid)
u. <- as.matrix(expand.grid("u[1]" = sq., "u[2]" = sq., KEEP.OUT.ATTRS = FALSE))
emp_margins <- F.n(u., emp_pobs)
my_sim <- mvdc(emp_cop, emp_margins)
Thanks!