Skip to contents

Simulate from the model X = X If we pass in upper triangular then we take transpose X ~ MVN(0, (I - W)^-T Where eps ~ MVN(0, Sigma)

Usage

sim_linear_sem(W, n = 1, Sigma = diag(ncol(W)), check_lower = TRUE)

Arguments

W

Adjacency matrix representing SEM (d x d)

n

Number of samples

Sigma

Covariance matrix of noise

Value

Matrix of samples (n x d)

Examples

B <- matrix(
c(0, 3, 0, 3,
  0, 0, 0, 5,
  0, 0, 0, 2,
  0, 0, 0, 0),
nrow = 4, ncol = 4, byrow = TRUE)
d <- ncol(B)
X <- sim_linear_sem(B, n = 500, Sigma = 1 * diag(ncol(B)))