Learn R Programming

SpatialTools (version 1.0.5)

decomp.cov: Calculates decomposition of covariance matrix

Description

Calculates a decomposition of the provided covariance matrix, V, using the chosen method.

Usage

decomp.cov(V, method = "eigen")

Value

Returns a decomposition matrix U such that V = U %*% t(U).

Arguments

V

A (symmetric, positive-definite) covariance matrix.

method

A character vector specifying the method used to decompose V. Options are "eigen", "chol", or "svd" (Eigen decomposition, Cholesky decomposition, or Singular value decomposition, respectively).

Author

Joshua French

Details

The matrix V is assumed to be symmetric and positive definite. Symmetry is checked, but the positive definiteness of the matrix is not. Returns a decomposition matrix U such that V = U %*% t(U).

See Also

cov.sp

Examples

Run this code
	data(toydata)
	U <- decomp.cov(toydata$V, method = "chol")
	#range(toydata$V - U %*% t(U))

Run the code above in your browser using DataLab