Chapter Contents
Chapter Contents
Previous
Previous
Next
Next
Language Reference

SWEEP Function

sweeps a matrix

SWEEP( matrix, index-vector)

The inputs to the SWEEP function are as follows:
matrix
is a numeric matrix or literal.

index-vector
is a numeric vector indicating the pivots.
The SWEEP function sweeps matrix on the pivots indicated in index-vector to produce a new matrix. The values of the index vector must be less than or equal to the number of rows or the number of columns in matrix, whichever is smaller.

For example, suppose that A is partitioned into
[ R & S \ T & U
 ]
such that R is q ×q and U is (m-q) ×(n-q). Let
   I = [1 2 3 . . . q]
Then, the statement
   s=sweep(A,I);
becomes
[ R^{-1} & R^{-1} \ 
 -{TR}^{-1} & U-{TR}^{-1} \ ]  .
The index vector can be omitted. In this case, the function sweeps the matrix on all pivots on the main diagonal 1:MIN(nrow,ncol).

The SWEEP function has sequential and reversibility properties when the submatrix swept is positive definite: See Beaton (1964) for more information about these properties.

To use the SWEEP function for regression, suppose the matrix A contains
[ X^'X & X^' Y \ Y^'X & Y^' Y 
 ]
where X'X is k ×k.

Then B = SWEEP(A,1 ... k) contains
[ (X^' X)^{-1} & 
 (X^' X)^{-1} X^' \ -Y^' X(X^' X)^{-1} &
 Y^' (I-X(X^' X)^{-1} 
 X^' ) Y 
 ]
The partitions of B form the beta values, SSE, and a matrix proportional to the covariance of the beta values for the least-squares estimates of B in the linear model
Y = {XB} + \epsilon  .
If any pivot becomes very close to zero (less than or equal to 1E-12), the row and column for that pivot are zeroed. See Goodnight (1979) for more information.

Chapter Contents
Chapter Contents
Previous
Previous
Next
Next
Top
Top

Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.