cov2pcov | R Documentation |
Compute a matrix of partial (co)variances for a group of variables with respect to another.
Take \Sigma
as the covariance matrix of dimension p. Now consider dividing \Sigma
into two groups
of variables. The partial covariance matrices are calculate by:
\Sigma_{11.2} = \Sigma_{11} - \Sigma_{12} \Sigma_{22}^{-1} \Sigma_{21}
\Sigma_{22.1} = \Sigma_{22} - \Sigma_{21} \Sigma_{11}^{-1} \Sigma_{12}
cov2pcov(m, vars1, vars2 = seq(1, ncol(m))[-vars1])
m |
a square numeric matrix. |
vars1 |
a numeric vector indicating the position (rows or columns in |
vars2 |
a numeric vector indicating the position (rows or columns in |
A square numeric matrix.
Anderson Rodrigo da Silva <anderson.agro at hotmail.com>
cov
(Cl <- cov(longley))
cov2pcov(Cl, 1:2)
# End (Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.