Obtaining the graphical causal model (GCM)

graphModel(adj.mat, cfd.mat = NULL, res.vars = NULL)

Arguments

adj.mat

Matrix of class matrix encoding the relationships in the causal graph. M[i,j] == 1L implies the existence of an edge from node i to node j.

cfd.mat

Symmetric matrix of class matrix encoding the bidirected edges in the causal graph. M[i,j] == M[j, i] == 1L implies the existence of a bidirected edge between nodes i and j.

res.vars

A vector of class character listing all the resolving variables, which should not be changed by the adaption procedure. Default value is NULL, corresponding to no resolving variables. Resolving variables should be a subset of colnames(adj.mat). Resolving variables are marked with a different color in the output.

Value

An object of class igraph, containing the causal graphical, with directed and bidirected edges.

Examples

adj.mat <- cfd.mat <- array(0L, dim = c(3, 3))
colnames(adj.mat) <- rownames(adj.mat) <-
  colnames(cfd.mat) <- rownames(cfd.mat) <- c("A", "X", "Y")

adj.mat["A", "X"] <- adj.mat["X", "Y"] <-
  cfd.mat["X", "Y"] <- cfd.mat["Y", "X"] <- 1L

gcm <- graphModel(adj.mat, cfd.mat, res.vars = "X")