mat.util {GeneTS} R Documentation

## Various Matrix Utilities

### Description

`is.positive.definite` tests whether all eigenvalues of a symmetric matrix are positive.

`make.positive.definite` computes the nearest positive definite of a real symmetric matrix, using the algorithm of NJ Higham (1988, Linear Algebra Appl. 103:103-118).

`rank.condition` estimates the rank and the condition of a matrix by computing its singular values D[i] (using `svd`). The rank of the matrix is the number of singular values D[i] > tol) and the condition is the ratio of the largest and the smallest singular value.

`is.square` checks whether a matrix has squared form.

`is.symmetric` checks whether a matrix is symmetric.

### Usage

```is.positive.definite(m, tol, method=c("eigen", "chol"))
make.positive.definite(m, tol)
rank.condition(m, tol)
is.square(m)
is.symmetric(m, eps = .Machine\$double.eps)

```

### Arguments

 `m` matrix `tol` tolerance for singular values and for absolute eigenvalues - only those with values larger than tol are considered non-zero (default: `tol = max(dim(m))*max(D)*.Machine\$double.eps`) `method` Determines the method to check for positive definiteness: eigenvalue computation (`eigen`, default) or Cholesky decomposition (`chol`). `eps` values smaller than < eps are considered zero

### Value

For `is.positive.definite`, `is.square`, and `is.symmetric` a logical value (`TRUE` or `FALSE`).
For `rank.condition` a list object with the following components:

 `rank` Rank of the matrix. `condition` Condition number. `tol` Tolerance.

For `make.positive.definite` a symmetric positive definite matrix.

### Author(s)

Korbinian Strimmer (http://www.stat.uni-muenchen.de/~strimmer/).

`svd`, `pseudoinverse`.

### Examples

```# load GeneTS library
library(GeneTS)

# Hilbert matrix
hilbert <- function(n) { i <- 1:n; 1 / outer(i - 1, i, "+") }

# positive definite ?
m <- hilbert(8)
is.positive.definite(m)

# numerically ill-conditioned
m <- hilbert(15)
rank.condition(m)

# make positive definite
m2 <- make.positive.definite(m)
is.positive.definite(m2)
rank.condition(m2)
m2 - m

# square and symmetric ?
is.square(m)
is.symmetric(m)
```

[Package GeneTS version 2.3 Index]