# NOT RUN {
## simulate dummy data
x <- rnorm(30) * matrix(1, 30, 5) + 0.5 * matrix(rnorm(30 * 5), 30, 5)
u <- pseudo_obs(x)
## fit a model
vc <- vinecop(u, family = "clayton")
# simulate from the model
u <- rvinecop(100, vc)
pairs(u)
# evaluate the density and cdf
dvinecop(u[1, ], vc)
pvinecop(u[1, ], vc)
## Discrete models
vc$var_types <- rep("d", 5) # convert model to discrete
# with discrete data we need two types of observations (see Details)
x <- qpois(u, 1) # transform to Poisson margins
u_disc <- cbind(ppois(x, 1), ppois(x - 1, 1))
dvinecop(u_disc[1:5, ], vc)
pvinecop(u_disc[1:5, ], vc)
# simulated data always has uniform margins
pairs(rvinecop(200, vc))
# }
Run the code above in your browser using DataCamp Workspace