mat.rank: Matrix Rank

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

Description

This function estimate the rank of a matrix.

Usage

1
mat.rank(mat, tol)

Arguments

mat

a numeric matrix or data frame that can contain missing values.

tol

positive real, the tolerance for singular values, only those with values larger than tol are considered non-zero.

Details

mat.rank estimate the rank of a matrix by computing its singular values d[i] (using nipals). The rank of the matrix can be defined as the number of singular values d[i] > 0.

If tol is missing, it is given by tol=max(dim(mat))*max(d)*.Machine$double.eps.

Value

The returned value is a list with components:

rank

a integer value, the matrix rank.

tol

the tolerance used for singular values.

Author(s)

Sébastien Déjean and Ignacio González.

See Also

nipals

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
## Hilbert matrix
hilbert <- function(n) { i <- 1:n; 1 / outer(i - 1, i, "+") }
mat <- hilbert(16)
mat.rank(mat)

## Not run: 
## Hilbert matrix with missing data
idx.na <- matrix(sample(c(0, 1, 1, 1, 1), 36, replace = TRUE), ncol = 6)
m.na <- m <- hilbert(9)[, 1:6]
m.na[idx.na == 0] <- NA
mat.rank(m)
mat.rank(m.na)

## End(Not run)

ajabadi/mixOmics2 documentation built on Aug. 9, 2019, 1:08 a.m.