getCovMat: Create a covariance matrix.

Description Usage Arguments Details Value See Also Examples

Description

getCovMat returns a covariance matrix (with nugget).

Usage

1
getCovMat(V, R, sig2)

Arguments

V

A positive vector of length n.

R

An n x n correlation matrix.

sig2

A positive scalar representing the variance of the noise (or nugget).

Details

This creates a covariance matrix, C, where

C = V^{0.5}RV^{0.5} + σ^2 I

where V is a matrix with variances on the diagonal. In the bcgp setting, R is a correlation matrix resulting from combineCorMats, V is a vector of process variances, and sig2 is the variance of the noise (or nugget).

Value

An n x n covariance matrix

See Also

Other correlation and covariance functions: combineCorMats, getCorMat

Examples

1
2
3
4
5
6
7
8
n <- 10
d <- 2
x <- matrix(runif(n * d), nrow = n, ncol = d)
rho <- runif(d, 0, 1)
R <- getCorMat(x, rho)
sig2 <- 0.01
V <- rlnorm(n, -0.1, 0.1)
getCovMat(V, R, sig2)

cbdAmgen/bcgp0a documentation built on May 17, 2019, 10:01 a.m.