random_dag: Simulate random DAG

View source: R/simulation_helpers.R

random_dagR Documentation

Simulate random DAG

Description

Simulates a directed acyclic graph (DAG) and returns its adjacency matrix. Copyright (c) 2013 Jonas Peters peters@math.ku.dk. All rights reserved.

Usage

random_dag(p, prob_connect, caus_order = sample(p, p, replace = FALSE))

Arguments

p

Integer — greater than 0. Number of nodes.

prob_connect

Numeric — between 0 and 1. The probability that an edge i {\rightarrow} j is added to the DAG.

caus_order

Numeric vector. The causal order of the DAG. If the argument is not provided it is generated randomly.

Value

Square binary matrix. A matrix representing the random DAG.


nicolagnecco/causalXtreme documentation built on April 21, 2024, 4:22 a.m.