# gamVineSimulate: Simulation from a 'gamVine-class' object In gamCopula: Generalized Additive Models for Bivariate Conditional Dependence Structures and Vine Copulas

## Description

Simulation from a `gamVine-class` object

## Usage

 `1` ```gamVineSimulate(n, GVC, U = NULL, newdata = NULL) ```

## Arguments

 `n` number of d-dimensional observations to simulate. `GVC` A `gamVine` object. `U` If not `NULL`, `U` is an (N,d)-matrix of U[0,1] random variates to be transformed to the copula sample. `newdata` If not `NULL`, which is mandatory when the attribute `covariates` from `GVC` is not `NA`, `newdata` is a data frame containing the values of the model covariates at which simulations are required.

## Value

A matrix of data simulated from the given `gamVine` object.

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54``` ```require(VineCopula) ## Example adapted from RVineSim ## Define 5-dimensional R-vine tree structure matrix Matrix <- c(5, 2, 3, 1, 4, 0, 2, 3, 4, 1, 0, 0, 3, 4, 1, 0, 0, 0, 4, 1, 0, 0, 0, 0, 1) Matrix <- matrix(Matrix, 5, 5) ## Define R-vine pair-copula family matrix family <- c(0, 1, 3, 4, 4, 0, 0, 3, 4, 1, 0, 0, 0, 4, 1, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0) family <- matrix(family, 5, 5) ## Define R-vine pair-copula parameter matrix par <- c(0, 0.2, 0.9, 1.5, 3.9, 0, 0, 1.1, 1.6, 0.9, 0, 0, 0, 1.9, 0.5, 0, 0, 0, 0, 4.8, 0, 0, 0, 0, 0) par <- matrix(par, 5, 5) ## Define second R-vine pair-copula parameter matrix par2 <- matrix(0, 5, 5) ## Define RVineMatrix object RVM <- RVineMatrix(Matrix = Matrix, family = family, par = par, par2 = par2, names = c("V1", "V2", "V3", "V4", "V5")) ## Convert to gamVine object GVC <- RVM2GVC(RVM) ## U[0,1] random variates to be transformed to the copula sample n <- 1e2 d <- 5 U <- matrix(runif(n*d), nrow = n) ## The output of gamVineSimulate correspond to that of RVineSim sampleRVM <- RVineSim(n, RVM,U) sampleGVC <- gamVineSimulate(n, GVC,U) all.equal(sampleRVM, sampleGVC) ## Fit the two models and compare the estimated parameter fitRVM <- RVM2GVC(RVineSeqEst(sampleRVM,RVM)) fitGVC <- gamVineSeqFit(sampleGVC,GVC) all.equal(simplify2array(attr(fitRVM, "model")), simplify2array(attr(fitGVC, "model"))) ```

### Example output

```Loading required package: VineCopula
[1] TRUE
[1] TRUE
```

gamCopula documentation built on Aug. 18, 2017, 1:01 a.m.