Learn R Programming

ISR3 (version 0.98)

SWP: Sweep Function

Description

SWP performs the sweep operator.

Usage

SWP(V, b)

Arguments

V
A symmetric matrix to be swept; this matrix cannot contain missing data or infinite values.
b
An array of integers or column names to sweep.

Value

The swept matrix V. Sweeping will not occur if the column being swept has a zero-valued diagonal element.

Details

This program applies the sweep operator as defined in (Dempster 1969).

References

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

Examples

Run this code
set.seed(100)
# generate a symmetric positive definite matrix
Sigma <- rWishart(1,4,diag(3))[,,1]
# sweep all the columns to produce the inverse
Sigma.inv <- SWP(Sigma,1:3)

Run the code above in your browser using DataLab