Learn R Programming

VineCopula (version 2.5.1)

RVineCor2pcor: (Partial) Correlations for R-Vine Copula Models

Description

Correlations to partial correlations and vice versa for R-vines with independence, Gaussian and t-copulas.

Usage

RVineCor2pcor(RVM, corMat)

RVinePcor2cor(RVM)

Value

RVM

RVineMatrix with transformed partial correlations (for Cor2pcor)

cor

correlation matrix (for Pcor2cor)

Arguments

RVM

RVineMatrix() defining only the R-vine structure for Cor2pcor and providing as well the partial correlations for Pcor2cor.

corMat

correlation matrix

Examples

Run this code

## create RVineMatrix-object for Gaussian vine
Matrix <- matrix(c(1, 3, 4, 2,
                   0, 3, 4, 2,
                   0, 0, 4, 2,
                   0, 0, 0, 2), 4, 4)
family <- matrix(c(0, 1, 1, 1,
                   0, 0, 1, 1,
                   0, 0, 0, 1,
                   0, 0, 0, 0), 4, 4)
par <- matrix(c(0, 0.2,   0, 0.6,
                0,   0, 0.2, 0.6,
                0,   0,   0, 0.6,
                0,   0,   0,   0), 4, 4)
RVM <- RVineMatrix(Matrix, family, par)

## calculate correlation matrix corresponding to the R-Vine model
newcor <- RVinePcor2cor(RVM)

## transform back to partial correlations
RVineCor2pcor(RVM, newcor)$par

## check if they are equal
all.equal(RVM$par, RVineCor2pcor(RVM, newcor)$par)

Run the code above in your browser using DataLab