This is an internal simulation function. It creates a graph with regression coefficients.

sim_B(p, graph_setting, l, u, unique_ordering = TRUE)

Arguments

p

number of variables to simulate

graph_setting

either "dense", "sparse", "A", or "B". These settings correspons to the settings described in the article.

l

lower bound for direct abolute causal effect

u

upper bound for direct absolute causal effect

unique_ordering

if TRUE the simulated graph will have a unique topological ordering

Value

Returns a matrix of size p times p encoding a graph with regression coefficients.

Details

The sim_B function simulates a causal graph with regression coefficients. The graph is stored as matrix, where the (i,j)th entry in the matrix is non zero only if there is an arrow from j to i in the graph. The value in the (i,j)th entry corresponds to the direct causal effect from j to i.

Examples

sim_B(5, "dense", 0.3, 1)
#> [,1] [,2] [,3] [,4] [,5] #> [1,] 0 -0.7110621 0.0000000 0.0000000 0.8558501 #> [2,] 0 0.0000000 0.6923577 0.0000000 0.4479231 #> [3,] 0 0.0000000 0.0000000 -0.3032418 0.0000000 #> [4,] 0 0.0000000 0.0000000 0.0000000 -0.9181873 #> [5,] 0 0.0000000 0.0000000 0.0000000 0.0000000
sim_B(5, "sparse", 0.7, 1, uniqe_ordering = FALSE)
#> Error in sim_B(5, "sparse", 0.7, 1, uniqe_ordering = FALSE): ubrugt argument (uniqe_ordering = FALSE)