RVineLogLik: Log-Likelihood of an R-Vine Copula Model

View source: R/RVineLogLik.R

RVineLogLikR Documentation

Log-Likelihood of an R-Vine Copula Model

Description

This function calculates the log-likelihood of a d-dimensional R-vine copula model for a given copula data set.

Usage

RVineLogLik(
  data,
  RVM,
  par = RVM$par,
  par2 = RVM$par2,
  separate = FALSE,
  verbose = TRUE,
  check.pars = TRUE,
  calculate.V = TRUE
)

Arguments

data

An N x d data matrix (with uniform margins).

RVM

An RVineMatrix() object including the structure and the pair-copula families and parameters.

par

A d x d matrix with the pair-copula parameters (optional; default: par = RVM$par).

par2

A d x d matrix with the second parameters of pair-copula families with two parameters (optional; default: par2 = RVM$par2).

separate

Logical; whether log-likelihoods are returned point wisely (default: separate = FALSE).

verbose

In case something goes wrong, additional output will be plotted.

check.pars

logical; default is TRUE; if FALSE, checks for family/parameter-consistency are omitted (should only be used with care).

calculate.V

logical; whether V matrices should be calculated. Default is TRUE, but requires a lot of memory when dimension is large. Use FALSE for a memory efficient version.

Details

For observations \boldsymbol{u}=(\boldsymbol{u}_1^\prime,...,\boldsymbol{u}_N^\prime)^\prime the log-likelihood of a d-dimensional R-vine copula with d-1 trees and corresponding edge sets E_1,...,E_{d-1} is given by

\texttt{loglik}:=l_{RVine}\left(\boldsymbol{\theta}|\boldsymbol{u}\right)

=\sum_{i=1}^N \sum_{\ell=1}^{d-1} \sum_{e\in E_\ell} \ln[c_{j(e),k(e)|D(e)}(F(u_{i,j(e)}|u_{i,D(e)}),F(u_{i,k(e)}|u_{i,D(e)})|\theta_{j(e),k(e)|D(e)})]

where \boldsymbol{u}_i=(u_{i,1},...,u_{i,d})^\prime\in[0,1]^d,\ i=1,...,N. Further c_{j(e),k(e)|D(e)} denotes a bivariate copula density associated to an edge e and with parameter(s) \boldsymbol{\theta}_{j(e),k(e)|D(e)}. Conditional distribution functions such as F(u_{i,j(e)}|\boldsymbol{u}_{i,D(e)}) are obtained recursively using the relationship

h(u|\boldsymbol{v},\boldsymbol{\theta}) := F(u|\boldsymbol{v}) = d C_{uv_j|v_{-j}}(F(u|v_{-j}),F(v_j|v_{-j}))/d F(v_j|v_{-j}),

where C_{uv_j|\boldsymbol{v}_{-j}} is a bivariate copula distribution function with parameter(s) \boldsymbol{\theta} and \boldsymbol{v}_{-j} denotes a vector with the j-th component v_j removed. The notation of h-functions is introduced for convenience. For more details see Dissmann et al. (2013).

Value

loglik

The calculated log-likelihood value of the R-vine copula model.

V

The stored transformations (h-functions and log-likelihoods of each pair-copula) which may be used for posterior updates (three matrices: direct, indirect and value).

Author(s)

Ulf Schepsmeier, Jeffrey Dissmann, Jakob Stoeber

References

Dissmann, J. F., E. C. Brechmann, C. Czado, and D. Kurowicka (2013). Selecting and estimating regular vine copulae and application to financial returns. Computational Statistics & Data Analysis, 59 (1), 52-69.

See Also

BiCopHfunc(), RVineMatrix(), RVineMLE(), RVineAIC(), RVineBIC()

Examples


# 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"))

# simulate a sample of size 300 from the R-vine copula model
set.seed(123)
simdata <- RVineSim(300, RVM)

# compute the log-likelihood
ll <- RVineLogLik(simdata, RVM, separate = FALSE)
ll$loglik

# compute the pointwise log-likelihoods
ll <- RVineLogLik(simdata, RVM, separate = TRUE)
ll$loglik


VineCopula documentation built on Sept. 11, 2024, 5:26 p.m.