Learn R Programming

corcounts (version 1.4)

c2pc: Calculate partial correlations from a correlation matrix

Description

'c2pc' is used to calculate partial correlations from a correlation matrix.

Usage

c2pc(Cin)

Arguments

Cin
A symmetric positive definite correlation matrix.

Value

The partial correlations calculated will beTheta =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...

Details

If you obtain values not in [-1,1], your correlation matrix is not positive definite.

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.

See Also

Package 'corpcor' calculates partial correlations conditional on ALL other margins.

Examples

Run this code
# create 8 dimensional symmetric positive correlation matrix with random entries
Cin <- unstructured(8)
Cin

Theta <- c2pc(Cin)
Theta

# transform Theta back to obtain the correlation matrix
pc2c(Theta)

# identical with Cin
pc2c(Theta) - Cin

Run the code above in your browser using DataLab