Learn R Programming

spBayes (version 0.2-4)

covGivens: Returns covariance matrix C given components of P and L in C=PLP'

Description

Given components of $P$ and $\Lambda$ in $C=P\Lambda P^T$, covGivens returns $C$.

Usage

covGivens(theta, lambda, p, strict=TRUE)

Arguments

theta
a p(p-1)/2 vector of Givens angles that are restricted to lie in the interval ($-\pi/2,\pi/2$) for uniqueness and positive definiteness of the covariance matrix. These are arranged in column major order in P.
lambda
a vector of length p of positive eigenvalues which form the diagonal matrix $\Lambda$.
p
refers to the dimension of the desired $p\times p$ covariance matrix.
strict
checks that theta elements lie in the interval ($-\pi/2,\pi/2$) and the lambda elements are positive.

Value

  • A list with the following tags:
  • C$p\times p$ covariance matrix.
  • P$p\times p$ P matrix.
  • Lambdadiagonal elements of the $p\times p$ $\Lambda$ matrix.

Details

The spectral decomposition of a matrix C is given by $P\Lambda P^T$, where P is an orthogonal matrix of eigenvectors and $\Lambda$ is a diagonal matrix of positive eigenvalues. In the case of distinct eigenvalues, $P$ can be expressed as $P = G_{12}, G_{13}, G_{23}, ..., G_{p-1,p}$ where $G_{ij}$ is a $p\times p$ matrix with $cos(\theta_{tl})$ in the tth and lth diagonal elements, $sin(\theta_{tl})$ in the tlth and $-sin(\theta_{tl})$ in the ltth elements, zeros on the rest of the off-diagonal elements and 1's on the rest of the diagonal. The p(p-1)/2 angles are called Givens angles and are restricted to lie in the interval ($-\pi/2,\pi/2$) for uniqueness and positive definiteness of the resulting covariance matrix.

References

Daniels, M.J and R.E. Kass (1999) Nonconjugate Bayesian estimation of covariance matrices and its use in hierarchical models, J. Amer. Statist. Assoc. 94:1254-1263.

Examples

Run this code
########################################
##Syntetic covariance matrix IIIR_1 from
##Daniels, M.J. and R.E. Kass (1999)
##JASA 94(448):1254-1263.
########################################
p <- 5
theta <- rep(pi/4, p*(p-1)/2)
lambda <- c(1, 0.75, 0.56, 0.06, 0.003)

cov <- covGivens(theta, lambda, p)$C
cov2cor(cov)

Run the code above in your browser using DataLab