View source: R/RVinePartialcorr.R
RVineCor2pcor | R Documentation |
Correlations to partial correlations and vice versa for R-vines with independence, Gaussian and t-copulas.
RVineCor2pcor(RVM, corMat)
RVinePcor2cor(RVM)
RVM |
|
corMat |
correlation matrix |
RVM |
RVineMatrix with transformed partial correlations (for
|
cor |
correlation matrix (for |
The behavior of RVinePcor2ccor
differs from older versions (<=
1.4). The RVM object is now normalized such that the order of the returned
correlation matrix conforms with the correlation matrix of the data. If
RVM$names
are non-default, the initial ordering of the variables
cannot be traced back and the matrix has to be interpreted as indicated by
the row- and column names.
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.