swp: Sweep operator

Description Usage Arguments Details Value Author(s) References See Also Examples

Description

Sweeps a covariance matrix with respect to a subset of indices.

Usage

1
swp(V, b)

Arguments

V

a symmetric positive definite matrix, the covariance matrix.

b

a subset of indices of the columns of V.

Details

The sweep operator has been introduced by Beaton (1964) as a tool for inverting symmetric matrices (see Dempster, 1969).

Value

a square matrix U of the same order as V. If a is the complement of b, then U[a,b] is the matrix of regression coefficients of a given b and U[a,a] is the corresponding covariance matrix of the residuals.

If b is empty the function returns V.

If b is the vector 1:nrow(V) (or its permutation) then the function returns the opposite of the inverse of V.

Author(s)

Giovanni M. Marchetti

References

Beaton, A.E. (1964). The use of special matrix operators in statistical calculus. Ed.D. thesis, Harvard University. Reprinted as Educational Testing Service Research Bulletin 64-51. Princeton.

Dempster, A.P. (1969). Elements of continuous multivariate analysis. Reading: Addison-Wesley.

See Also

fitDag

Examples

1
2
3
## A very simple example
V <- matrix(c(10, 1, 1, 2), 2, 2)
swp(V, 2)

Example output

Loading required package: igraph

Attaching package: 'igraph'

The following objects are masked from 'package:stats':

    decompose, spectrum

The following object is masked from 'package:base':

    union


Attaching package: 'ggm'

The following object is masked from 'package:igraph':

    pa

     [,1] [,2]
[1,]  9.5  0.5
[2,]  0.5 -0.5

ggm documentation built on March 26, 2020, 7:49 p.m.

Related to swp in ggm...