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

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.

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).

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).

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.

Author

Ulf Schepsmeier, Jeffrey Dissmann, Jakob Stoeber

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
#> [1] 1198.919

# compute the pointwise log-likelihoods
ll <- RVineLogLik(simdata, RVM, separate = TRUE)
ll$loglik
#>   [1]  1.650962909  7.343343544  5.907552484  1.452133126  5.107280976
#>   [6]  3.570778885  9.611784442  2.663215764  6.411155126  5.784532245
#>  [11]  7.864579936  3.523347213  2.777988368  3.660844659 -0.557596125
#>  [16]  4.862661063  3.632567556  3.634167314  5.837203510  4.343431355
#>  [21]  2.625122048  8.759696654  1.933754329  4.493455661  3.526011462
#>  [26]  2.754764146  5.235347162  3.662177110  4.371822479  5.948037992
#>  [31]  3.565972134  3.750334004  3.952414682  2.845952330  2.919537477
#>  [36]  3.428011398  4.394202420  2.088986513  1.116357490  3.689925288
#>  [41]  3.012731183  3.297585043  2.557612938  2.747514531  1.797756181
#>  [46]  3.043828725  2.619833158  2.873308126  2.873442334  2.088307828
#>  [51]  4.999401172  3.114141025  9.797844211  2.089135245  0.006719337
#>  [56]  6.597135721  1.742940439  3.336473286  3.419120579  5.672502915
#>  [61]  0.727573451  4.520098773  3.112682292  4.750548858  2.416544921
#>  [66] -3.126371475  3.252299525  2.054099028  3.860630543  2.047412351
#>  [71]  2.672111363  8.656706366  4.993461703  2.498347945  3.729509163
#>  [76]  5.863374165  3.606243876  2.486782075  5.662278654  2.292811160
#>  [81]  5.882248550  2.603217621  2.869261669  1.425525180  3.313576606
#>  [86]  2.955776159  4.094134905  2.173562391  3.422326150  3.253690499
#>  [91]  2.785488674  6.287158466  6.221258336  4.185746645  5.013154018
#>  [96]  3.170843091  2.307856357  5.539595654  2.589141750  3.666233908
#> [101]  4.091906707  3.904398687  2.485211784  4.075696814  3.989331767
#> [106] -1.412133121  5.381702774  3.909166866  2.523345648  4.113651402
#> [111]  3.491201110  1.454538765  5.454980602  3.381896849  3.333239333
#> [116]  2.370850691  7.646845836  3.154517436 -0.325426816  2.540429469
#> [121]  4.409116866  3.164386705 -1.149704053  4.243462339  7.109277207
#> [126]  3.728414530  4.677145171  3.028847997  3.084799552  2.371097220
#> [131]  6.852503855  4.061525626  3.917973242  4.394147558 13.218939882
#> [136]  2.930198313  3.821243665  3.252722439  8.839913766  3.587057440
#> [141]  1.343599101  3.560625898  4.169693493 -0.424089085  3.374558722
#> [146]  3.538763361  2.308820666 -2.136530564  3.013229224  0.431711144
#> [151]  5.009135893  1.714457828  3.918923378  5.916174580  7.944845401
#> [156]  4.524589965  1.903614728  2.991045663  5.319163135  4.151116942
#> [161]  2.949819550  7.333508327  5.920994465  7.075604447  1.514190643
#> [166]  8.871767792 12.171635597  2.926094192  7.953508134  2.426933180
#> [171]  2.132677509 -0.490290216  2.951704616  5.596871261  4.706709317
#> [176]  0.615334388  3.775095321  4.634369592  4.027044878  0.533799015
#> [181]  7.046672708  2.271119523 12.062884106  7.273894330  1.876248831
#> [186]  3.271657878  3.162510025  2.694786264  5.712440537  6.406253960
#> [191]  0.907432244  4.616375853  2.712092643  2.725252042  1.623216042
#> [196] -0.181927637  2.809477806  2.874753119  7.422465004  4.225591909
#> [201]  2.717617985  2.186233293  2.147249044  4.774206290  3.459554312
#> [206]  4.368803670  4.728634372  3.618045061  5.540711838  3.619592463
#> [211]  5.829353550  4.036946775  2.336474209  1.584087359  7.134404056
#> [216]  3.201873505  4.129673886  5.221214955  1.974245714 11.139795130
#> [221]  4.084183407  2.312542220  6.486160542  3.825490677  4.801737035
#> [226]  5.107369708  4.212386871  3.641285245  1.290903917  3.460392781
#> [231]  6.783479328  2.454459702  3.814316876  4.404663550  2.903667473
#> [236]  2.851868686 12.565127679  5.403486168  4.742263945  0.899236298
#> [241]  8.269661753  3.215164654  4.226514178  3.112714365  1.182789058
#> [246]  8.292867984 15.841905423  6.133167718  6.833165972  4.316149733
#> [251] -0.850862407  1.203567647  4.512113539  2.948986165  7.682011806
#> [256]  3.907380275  3.898758395  4.242494733  3.612761406  3.544534500
#> [261]  8.267875867  2.463575076  4.515975860  4.986242696  2.327409344
#> [266]  2.161585193  3.961508596  4.287260890  4.615198999  6.025050645
#> [271] 11.673862584  3.340208439  2.790415291  4.099663743  4.310988130
#> [276]  1.727391233  1.945279582  3.891369735  9.859481392  3.251923419
#> [281]  6.429399390  2.168009255  5.161329240  3.829198680  4.837623266
#> [286]  2.869752889  4.649498201  3.821930011  5.834249184  2.524625274
#> [291]  3.553159143  2.846835792  6.018486013  5.997807812  2.561486903
#> [296]  0.896623260 -0.017314688  6.566010797  3.148239034 10.309523412