# CDVineTreePlot: Plot function for C- or D-vine trees In CDVine: Statistical Inference of C- And D-Vine Copulas

## Description

This function plots one or all trees of a given C- and D-vine copula model.

## Usage

 ```1 2 3 4 5``` ```CDVineTreePlot(data=NULL, family, par=rep(0,length(family)), par2=rep(0,length(family)), names=NULL, type, method="mle", max.df=30, max.BB=list(BB1=c(5,6),BB6=c(6,6),BB7=c(5,6),BB8=c(6,1)), tree="ALL", edge.labels=c("family"), P=NULL, ...) ```

## Arguments

 `data` An N x d data matrix (with uniform margins); default: `data = NULL`. `family` A d*(d-1)/2 vector of pair-copula families with values `0` = independence copula `1` = Gaussian copula `2` = Student t copula (t-copula) `3` = Clayton copula `4` = Gumbel copula `5` = Frank copula `6` = Joe copula `7` = BB1 copula `8` = BB6 copula `9` = BB7 copula `10` = BB8 copula `13` = rotated Clayton copula (180 degrees; “survival Clayton”) `14` = rotated Gumbel copula (180 degrees; “survival Gumbel”) `16` = rotated Joe copula (180 degrees; “survival Joe”) `17` = rotated BB1 copula (180 degrees; “survival BB1”) `18` = rotated BB6 copula (180 degrees; “survival BB6”) `19` = rotated BB7 copula (180 degrees; “survival BB7”) `20` = rotated BB8 copula (180 degrees; “survival BB8”) `23` = rotated Clayton copula (90 degrees) `24` = rotated Gumbel copula (90 degrees) `26` = rotated Joe copula (90 degrees) `27` = rotated BB1 copula (90 degrees) `28` = rotated BB6 copula (90 degrees) `29` = rotated BB7 copula (90 degrees) `30` = rotated BB8 copula (90 degrees) `33` = rotated Clayton copula (270 degrees) `34` = rotated Gumbel copula (270 degrees) `36` = rotated Joe copula (270 degrees) `37` = rotated BB1 copula (270 degrees) `38` = rotated BB6 copula (270 degrees) `39` = rotated BB7 copula (270 degrees) `40` = rotated BB8 copula (270 degrees) `par` A d*(d-1)/2 vector of pair-copula parameters (optional; default: `par = rep(0,length(family))`. `par2` A d*(d-1)/2 vector of second parameters for pair-copula families with two parameters (optional; default: `par2 = rep(0,length(family))`. `names` A vector of names for the d variables. If `names = NULL` (default), column names of `data` (if available) or simply numbers are used. `type` Type of the vine model: `1` or `"CVine"` = C-vine `2` or `"DVine"` = D-vine `method` Character indicating the estimation method: either maximum likelihood estimation (`method = "mle"`; default) or inversion of Kendall's tau (`method = "itau"`). `max.df` Numeric; upper bound for the estimation of the degrees of freedom parameter of the t-copula (default: `max.df = 30`; for more details see `BiCopEst`). `max.BB` List; upper bounds for the estimation of the two parameters (in absolute values) of the BB1, BB6, BB7 and BB8 copulas (default: `max.BB = list(BB1=c(5,6),BB6=c(6,6),BB7=c(5,6),BB8=c(6,1))`). `tree` Number of the tree to be plotted or `tree = "ALL"` (default) to plot all trees. `edge.labels` Vector of edge labels. Possible choices: `FALSE`: no edge labels `"family"`: pair-copula families (default) `"par"`: pair-copula parameters `"par2"`: second pair-copula parameters `"theotau"`: theoretical Kendall's tau values corresponding to pair-copula families and parameters (see `BiCopPar2Tau`) `"emptau"`: empirical Kendall's tau values (only if data is provided!) `P` A list of matrices with two columns for the x-y-coordinates of the nodes in the plot(s) (optional; default: `P = NULL`). `...` further graphical parameters

## Note

The function computes the positions of the nodes automatically with the Fruchterman-Reingold algorithm (see `plot.igraph` for a detailed description). If one would like to set the positions manually, one has to specify a list of matrices `P` in the argument list. A good starting point may be to run the function `CDVineTreePlot` and manipulate the returning matrix P.

The user can set the copula parameters `par` and `par2`. If not set and data is provided, the parameters of the C- or D-vine copula model are estimated sequentially using `CDVineSeqEst`/`BiCopEst`. Then the edge width is chosen according to the empirical Kendall's tau values. Otherwise theoretical values are used.

Ulf Schepsmeier

## References

Aas, K., C. Czado, A. Frigessi, and H. Bakken (2009). Pair-copula constructions of multiple dependence. Insurance: Mathematics and Economics 44 (2), 182-198.

`CDVineMLE`
 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15``` ```# simulate from a 6-dimensional C-vine model with Gaussian pair-copulas d = 6 dd = d*(d-1)/2 par1 = c(0.2,0.69,0.73,0.22,-0.09,0.51,0.32,0.01,0.82,0.01,-0.2, -0.32,-0.19,-0.17,-0.06); fam1 = rep(1,dd) N = 100 U = CDVineSim(N,fam1,par1,type=1) # plot the first tree with pair-copula families and # empirical Kendall's tau values as edge labels CDVineTreePlot(U,fam1,type=1,tree=1,edge.labels=c("family","emptau")) # plot all trees without edge labels and without sequential estimation CDVineTreePlot(data=NULL,family=fam1,par=par1,type=1, edge.labels=FALSE) ```