Description Usage Arguments Details Value Author(s) Examples
'c2pc' is used to calculate the corresponding correlation matrix of dimension T times T out of partial correlations.
1 | pc2c(Theta)
|
Theta |
A T times T matrix with partial correlations. See details. |
The partial correlations in Theta have to be specified as
Theta =
12........13........14..........15...........16
..........23|1......24|1........25|1.........26|1
....................34|12.......35|12........36|12 ...
................................45|123.......46|123
.............................................56|1234
...
and may be NA elsewhere. Theta has to be of dimension T times T.
This routine only calculates partial correlations conditional on 1, 12, 123, 1234, etc.. Partial correlations conditional on other margins can be obtained by a permutation of margins.
A symmetric positive definite correlation matrix of dimension T times T.
Vinzenz Erhardt
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | # create random uniform(0,1) partial correlations in dimension 8
dimension <- 8
Theta <- matrix(NA,dimension,dimension)
for (i in 2:dimension) {
for (j in 1:(i-1)) {
Theta[j,i] <- runif(1,-1,1)
}
}
Theta
# calculate corresponding correlation matrix
C <- pc2c(Theta)
C
# transform back to partial correlations
c2pc(C)
# equivalence with original Theta
Theta - c2pc(C)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.