matrix.rank {matrixcalc}R Documentation

Rank of a square matrix

Description

This function returns the rank of a square numeric matrix based on the selected method.

Usage

matrix.rank(x, method = c("qr", "chol"))

Arguments

x

a matrix

method

a character string that specifies the method to be used

Details

If the user specifies "qr" as the method, then the QR decomposition function is used to obtain the rank. If the user specifies "chol" as the method, the rank is obtained from the attributes of the value returned.

Value

An integer.

Note

If the argument is not a square numeric matrix, then the function presents an error message and stops.

Author(s)

Frederick Novomestky fnovomes@poly.edu

References

Magnus, J. R. and H. Neudecker (1999) Matrix Differential Calculus with Applications in Statistics and Econometrics, Second Edition, John Wiley.

See Also

is.square.matrix

Examples

A <- diag( seq( 1, 4, 1 ) )
matrix.rank( A )
B <- matrix( seq( 1, 16, 1 ), nrow=4, byrow=TRUE )
matrix.rank( B )

[Package matrixcalc version 1.0-1 Index]