cov_matrix function

Construct Covariance matrix

Construct Covariance matrix

Utility function for constructing covariance matrices based on a simple triplet format (simple_triplet_matrix).

cov_matrix(k, i, j, v)

Arguments

  • k: an integer giving the number of rows and columns of the constructed covariance matrix.
  • i: an integer vector giving the row indices.
  • j: an integer vector giving the row indices.
  • v: a numeric vector giving the corresponding values.

Returns

A dense matrix of covariances.

Examples

cov_matrix(5, c(1, 2), c(2, 3), c(0.8, 0.9))

See Also

Other simulation: rhglm()

  • Maintainer: Benjamin Schwendinger
  • License: GPL-3
  • Last published: 2024-12-20

Useful links