pcor {ggm} | R Documentation |
Computes the partial correlation between two variables given a set of other variables.
pcor(u, S)
u |
a vector of integers of length > 1. The first two integers are the indices of variables the correlation of which must be computed. The rest of the vector is the conditioning set. |
S |
a symmetric positive definite matrix, a sample covariance matrix. |
a scalar, the partial correlation matrix between variables u[1]
and u[2]
given u[-c(1,2)]
.
Giovanni M. Marchetti
data(marks) ## The correlation between vec and alg given ana and sta pcor(c("vec", "alg", "ana", "sta"), var(marks)) ## The same pcor(c(2,3,4,5), var(marks)) ## The correlation between vec and alg given sta pcor(c("vec", "alg", "sta"), var(marks)) ## The marginal correlation between ana and sta pcor(c("ana","sta"), var(marks))