Learn R Programming

fake (version 1.4.0)

SimulateSymmetricMatrix: Simulation of symmetric matrix with block structure

Description

Simulates a symmetric matrix with block structure. If continuous=FALSE, matrix entries are sampled from a discrete uniform distribution taking values in v_within (for entries in the diagonal block) or v_between (for entries in off-diagonal blocks). If continuous=TRUE, entries are sampled from a continuous uniform distribution taking values in the range given by v_within or v_between.

Usage

SimulateSymmetricMatrix(
  pk = 10,
  v_within = c(0.5, 1),
  v_between = c(0, 0.1),
  v_sign = c(-1, 1),
  continuous = FALSE
)

Value

A symmetric matrix with uniformly distributed entries sampled from different distributions for diagonal and off-diagonal blocks.

Arguments

pk

vector of the number of variables per group, defining the block structure.

v_within

vector defining the (range of) nonzero entries in the diagonal blocks. If continuous=FALSE, v_within is the set of possible values. If continuous=FALSE, v_within is the range of possible values.

v_between

vector defining the (range of) nonzero entries in the off-diagonal blocks. If continuous=FALSE, v_between is the set of possible precision values. If continuous=FALSE, v_between is the range of possible precision values. This argument is only used if length(pk)>1.

v_sign

vector of possible signs for matrix entries. Possible inputs are: -1 for negative entries only, 1 for positive entries only, or c(-1, 1) for both positive and negative entries.

continuous

logical indicating whether to sample precision values from a uniform distribution between the minimum and maximum values in v_within (diagonal blocks) or v_between (off-diagonal blocks) (continuous=TRUE) or from proposed values in v_within (diagonal blocks) or v_between (off-diagonal blocks) (continuous=FALSE).