arbitraryOrderCorrelation: Partial correlations

Description Usage Arguments Value See Also Examples

View source: R/arbitraryOrderCorrelation.R

Description

Compute arbitrary kth order partial correlations using recursion. This implementation is very inefficient.

Usage

1

Arguments

S

A numeric correlation matrix

z

A integer vector of indices of the variables to condition on. I.e. length(z) is the order of the partial correlations. If z has length 0 the marginal correlations are returned.

Value

A numeric matrix of the same size as the correlation matrix with the partial correlations given the variables indexed by z. NaN are returned in the rows and columns of the conditioned variables.

See Also

correlation correlation

Examples

1
2
3
4
5
X <- createData(6, 20)
Y <- createData(6, 20)
Z <- createData(6, 20)
S <- cor(X)
arbitraryOrderCorrelation(S, z = c(2, 3, 5))

AEBilgrau/correlateR documentation built on Nov. 15, 2019, 9:21 a.m.