Skip to contents

Specify a matrix with constant values on the diagonal and on the off-diagonals. Such matrices can be used to vary the degree of dependency in covariate matrices, for example when evaluating accuracy of KL-divergence estimation algorithms.

Usage

constDiagMatrix(dim = 1, diag = 1, offDiag = 0)

Arguments

dim

Dimension

diag

Value at the diagonal

offDiag

Value at off-diagonals

Value

A dim-by-dim matrix

Examples

constDiagMatrix(dim = 3, diag = 1, offDiag = 0.9)
#>      [,1] [,2] [,3]
#> [1,]  1.0  0.9  0.9
#> [2,]  0.9  1.0  0.9
#> [3,]  0.9  0.9  1.0