covariance_matrix {psborrow2}R Documentation

Create Covariance Matrix

Description

Create Covariance Matrix

Usage

covariance_matrix(diag, upper_tri)

Arguments

diag

Diagonal entries of the covariance matrix

upper_tri

Upper triangle entries of the matrix, specified column wise.

Value

A symmetric matrix with diag values on the main diagonal and upper_tri values in the lower and upper triangles.

Examples

m1 <- covariance_matrix(c(1, 1, 1, 1), c(.8, .3, .8, 0, 0, 0))
m1
mvtnorm::rmvnorm(5, mean = c(0, 0, 0, 0), sigma = m1)

# No correlation
covariance_matrix(c(1, 2, 3))


[Package psborrow2 version 0.0.3.4 Index]