Learn R Programming

VineCopula (version 1.3)

RVineTreePlot: Plot function for R-vine trees

Description

This function plots one or all trees of a given R-vine copula model.

Usage

RVineTreePlot(data=NULL, RVM, 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.
RVM
An RVineMatrix object including the structure and the pair-copula families and parameters.
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": theoret
P
A list of matrices with two columns for the x-y-coordinates of the nodes in the plot(s) (optional; default: P = NULL).

Value

  • A list of matrices P with two columns for the x-y-coordinates of the nodes in the plot(s).

See Also

BiCopName

Examples

Run this code
set.seed(666)
# 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"))

# set random seed for testing
set.seed(666)

# plot all trees with pair-copula families and
# theoretical Kendall's tau values as edge labels
P = RVineTreePlot(data=NULL,RVM=RVM,tree="ALL",
                  edge.labels=c("family","theotau"),P=NULL)

# manipulate the first matrix of x-y-coordinates
P[[1]][1,] = P[[1]][1,]*2  

# re-set random seed for testing
set.seed(666)
# plot only the first tree with new coordinates
P = RVineTreePlot(data=NULL,RVM=RVM,tree=1,edge.labels=FALSE,P=P)

Run the code above in your browser using DataLab