| Title: | Causal Effect Estimation via Doubly Robust One-Step Estimators and TMLE in Graphical Models with Unmeasured Variables |
|---|---|
| Description: | Provides doubly robust one-step and targeted maximum likelihood (TMLE) estimators for average causal effects in acyclic directed mixed graphs (ADMGs) with unmeasured variables. Automatically determines whether the treatment effect is identified via backdoor adjustment or the extended front-door functional, and dispatches to the appropriate estimator. Supports incorporation of machine learning algorithms via 'SuperLearner' and cross-fitting for nuisance estimation. Methods are described in Guo and Nabi (2024) <doi:10.48550/arXiv.2409.03962>. |
| Authors: | Anna Guo [aut, cre] (GitHub: https://github.com/annaguo-bios) |
| Maintainer: | Anna Guo <[email protected]> |
| License: | GPL-3 |
| Version: | 0.1.0 |
| Built: | 2026-06-01 09:34:54 UTC |
| Source: | https://github.com/annaguo-bios/flexcausal |
Data generated from a classic backdoor model, where the pre-treatment variable X cause A and Y, and the treatment A cause Y.
data_backdoordata_backdoor
A data frame with 2000 rows and 3 variables: X, A, Y.
a variable that follows uniform distribution at the interval of
a binary treatment
a variable that follows normal distribution
https://github.com/annaguo-bios/flexCausal
Data generated from the simulation model in Figure 4(a) of the paper https://arxiv.org/abs/2409.03962. The model can also be found in Figure (a) of the github repository: https://github.com/annaguo-bios/flexCausal
data_example_adata_example_a
A data frame with 2000 rows and 7 variables: X, A, U, M=(M.1,M.2), L, Y.
a variable that follows uniform distribution at the interval of
a binary treatment
an unmeasured confounder following a normal distribution
first component of the bivariate mediator M, following a normal distribution
second component of the bivariate mediator M, following a normal distribution
a variable that follows normal distribution
a variable that follows normal distribution
https://github.com/annaguo-bios/flexCausal
Data generated from the simulation model in Figure 4(b) of the paper https://arxiv.org/abs/2409.03962. The model can also be found in Figure (b) of the github repository: https://github.com/annaguo-bios/flexCausal
data_example_bdata_example_b
A data frame with 2000 rows and 6 variables: X, A, U1, U2, M=(M.1,M.2), L, Y.
a variable that follows uniform distribution at the interval of
a binary treatment
first unmeasured confounder following a normal distribution
second unmeasured confounder following a normal distribution
first component of the bivariate mediator M, following a normal distribution
second component of the bivariate mediator M, following a normal distribution
a variable that follows normal distribution
a variable that follows normal distribution
https://github.com/annaguo-bios/flexCausal
Data generated from a front-door model where a pre-treatment variable X and an unmeasured confounder U affect both the treatment A and outcome Y, and the treatment A affects Y through a binary mediator M.
data_frontdoordata_frontdoor
A data frame with 2000 rows and 5 variables:
a pre-treatment variable following a uniform distribution on
an unmeasured confounder following a normal distribution
a binary treatment variable (0/1)
a binary mediator variable (0/1)
a continuous outcome variable following a normal distribution
https://github.com/annaguo-bios/flexCausal
The main user-facing function of the package. Given a causal graph specified as an acyclic directed mixed graph (ADMG), this function automatically determines the identifiability status of the treatment effect and dispatches to the appropriate estimator:
If the treatment is fixable (i.e., backdoor-adjustable),
estimation proceeds via .call_backdoor, returning G-computation,
IPW, one-step (AIPW), and TMLE estimators.
If the treatment is primal fixable (extended front-door
functional), estimation proceeds via .call_nps, returning
one-step and TMLE estimators.
If the treatment is neither fixable nor primal fixable, the function stops with an error.
A message is also printed indicating whether the graph is nonparametrically saturated, in which case the returned estimators are semiparametrically efficient.
estADMG( a = NULL, data = NULL, vertices = NULL, di_edges = NULL, bi_edges = NULL, treatment = NULL, outcome = NULL, multivariate.variables = NULL, graph = NULL, superlearner.seq = F, superlearner.Y = F, superlearner.A = F, superlearner.M = F, superlearner.L = F, crossfit = F, K = 5, ratio.method.L = "bayes", ratio.method.M = "bayes", dnorm.formula.L = NULL, dnorm.formula.M = NULL, lib.seq = c("SL.glm", "SL.earth", "SL.ranger", "SL.mean"), lib.L = c("SL.glm", "SL.earth", "SL.ranger", "SL.mean"), lib.M = c("SL.glm", "SL.earth", "SL.ranger", "SL.mean"), lib.Y = c("SL.glm", "SL.earth", "SL.ranger", "SL.mean"), lib.A = c("SL.glm", "SL.earth", "SL.ranger", "SL.mean"), formulaY = "Y ~ .", formulaA = "A ~ .", linkY_binary = "logit", linkA = "logit", n.iter = 500, cvg.criteria = 0.01, truncate_lower = 0, truncate_upper = 1, zerodiv.avoid = 0 )estADMG( a = NULL, data = NULL, vertices = NULL, di_edges = NULL, bi_edges = NULL, treatment = NULL, outcome = NULL, multivariate.variables = NULL, graph = NULL, superlearner.seq = F, superlearner.Y = F, superlearner.A = F, superlearner.M = F, superlearner.L = F, crossfit = F, K = 5, ratio.method.L = "bayes", ratio.method.M = "bayes", dnorm.formula.L = NULL, dnorm.formula.M = NULL, lib.seq = c("SL.glm", "SL.earth", "SL.ranger", "SL.mean"), lib.L = c("SL.glm", "SL.earth", "SL.ranger", "SL.mean"), lib.M = c("SL.glm", "SL.earth", "SL.ranger", "SL.mean"), lib.Y = c("SL.glm", "SL.earth", "SL.ranger", "SL.mean"), lib.A = c("SL.glm", "SL.earth", "SL.ranger", "SL.mean"), formulaY = "Y ~ .", formulaA = "A ~ .", linkY_binary = "logit", linkA = "logit", n.iter = 500, cvg.criteria = 0.01, truncate_lower = 0, truncate_upper = 1, zerodiv.avoid = 0 )
a |
Numeric scalar or length-two numeric vector specifying the treatment
level(s) of interest. The treatment must be coded as 0/1. If a scalar,
the function returns |
data |
A data frame containing all variables listed in |
vertices |
A character vector of variable names in the causal graph.
Ignored if |
di_edges |
A list of length-two character vectors specifying directed
edges. For example, |
bi_edges |
A list of length-two character vectors specifying bidirected
edges. For example, |
treatment |
A character string naming the binary (0/1) treatment
variable in |
outcome |
A character string naming the outcome variable in |
multivariate.variables |
A named list mapping compound vertex names to
their column names in |
graph |
A graph object created by |
superlearner.seq |
Logical. If |
superlearner.Y |
Logical. If |
superlearner.A |
Logical. If |
superlearner.M |
Logical. If |
superlearner.L |
Logical. If |
crossfit |
Logical. If |
K |
A positive integer specifying the number of cross-fitting folds.
Used only when |
ratio.method.L |
A character string specifying the method for estimating density ratios for variables in L (primal fixable case only). Options are:
|
ratio.method.M |
A character string specifying the method for
estimating density ratios for variables in M (primal fixable case only).
Same options as |
dnorm.formula.L |
An optional named list of regression formulas for
variables in L, used when |
dnorm.formula.M |
An optional named list of regression formulas for
variables in M, used when |
lib.seq |
SuperLearner library for sequential regression.
Default is |
lib.L |
SuperLearner library for density ratio estimation for L.
Default is |
lib.M |
SuperLearner library for density ratio estimation for M.
Default is |
lib.Y |
SuperLearner library for outcome regression.
Default is |
lib.A |
SuperLearner library for propensity score estimation.
Default is |
formulaY |
A formula or character string for outcome regression of Y on
its Markov pillow. Used only when |
formulaA |
A formula or character string for propensity score regression
of A on its Markov pillow. Used only when |
linkY_binary |
A character string specifying the link function for
outcome regression when Y is binary and |
linkA |
A character string specifying the link function for propensity
score regression when |
n.iter |
Maximum number of TMLE iterations. Default is 500. |
cvg.criteria |
Numeric. TMLE convergence threshold. The iterative
update stops when |
truncate_lower |
Numeric. Propensity score values below this threshold
are clipped. Default is |
truncate_upper |
Numeric. Propensity score values above this threshold
are clipped. Default is |
zerodiv.avoid |
Numeric. Density ratio or propensity score values below
this threshold are clipped to prevent division by zero.
Default is |
The return structure depends on the identifiability path:
A named list with components TMLE,
Onestep, IPW, and Gcomp, plus per-treatment-level
sub-lists.
A named list with components
TMLE and Onestep.
# Fixable graph: simple backdoor adjustment test <- estADMG( a = 1, data = data_backdoor, vertices = c('A', 'Y', 'X'), di_edges = list(c('X', 'A'), c('X', 'Y'), c('A', 'Y')), treatment = 'A', outcome = 'Y' ) # Primal fixable graph: extended front-door functional test <- estADMG( a = 1, data = data_example_a, vertices = c('A', 'M', 'L', 'Y', 'X'), bi_edges = list(c('A', 'Y')), di_edges = list(c('X', 'A'), c('X', 'M'), c('X', 'L'), c('X', 'Y'), c('M', 'Y'), c('A', 'M'), c('A', 'L'), c('M', 'L'), c('L', 'Y')), treatment = 'A', outcome = 'Y', multivariate.variables = list(M = c('M.1', 'M.2')) ) # ACE estimation E(Y(1)) - E(Y(0)) test <- estADMG( a = c(1, 0), data = data_example_a, vertices = c('A', 'M', 'L', 'Y', 'X'), bi_edges = list(c('A', 'Y')), di_edges = list(c('X', 'A'), c('X', 'M'), c('X', 'L'), c('X', 'Y'), c('M', 'Y'), c('A', 'M'), c('A', 'L'), c('M', 'L'), c('L', 'Y')), treatment = 'A', outcome = 'Y', multivariate.variables = list(M = c('M.1', 'M.2')) )# Fixable graph: simple backdoor adjustment test <- estADMG( a = 1, data = data_backdoor, vertices = c('A', 'Y', 'X'), di_edges = list(c('X', 'A'), c('X', 'Y'), c('A', 'Y')), treatment = 'A', outcome = 'Y' ) # Primal fixable graph: extended front-door functional test <- estADMG( a = 1, data = data_example_a, vertices = c('A', 'M', 'L', 'Y', 'X'), bi_edges = list(c('A', 'Y')), di_edges = list(c('X', 'A'), c('X', 'M'), c('X', 'L'), c('X', 'Y'), c('M', 'Y'), c('A', 'M'), c('A', 'L'), c('M', 'L'), c('L', 'Y')), treatment = 'A', outcome = 'Y', multivariate.variables = list(M = c('M.1', 'M.2')) ) # ACE estimation E(Y(1)) - E(Y(0)) test <- estADMG( a = c(1, 0), data = data_example_a, vertices = c('A', 'M', 'L', 'Y', 'X'), bi_edges = list(c('A', 'Y')), di_edges = list(c('X', 'A'), c('X', 'M'), c('X', 'L'), c('X', 'Y'), c('M', 'Y'), c('A', 'M'), c('A', 'L'), c('M', 'L'), c('L', 'Y')), treatment = 'A', outcome = 'Y', multivariate.variables = list(M = c('M.1', 'M.2')) )
Construct the adjacency matrix implied by the directed edges stored in the graph object.
f.adj_matrix(graph)f.adj_matrix(graph)
graph |
A graph object generated by the |
An adjacency matrix of the graph.
graph <- make.graph(vertices=c('A','M','L','Y','X'), bi_edges=list(c('A','Y')), di_edges=list(c('X','A'), c('X','M'), c('X','L'), c('X','Y'), c('M','Y'), c('A','M'), c('A','L'), c('M','L'), c('L','Y'))) f.adj_matrix(graph)graph <- make.graph(vertices=c('A','M','L','Y','X'), bi_edges=list(c('A','Y')), di_edges=list(c('X','A'), c('X','M'), c('X','L'), c('X','Y'), c('M','Y'), c('A','M'), c('A','L'), c('M','L'), c('L','Y'))) f.adj_matrix(graph)
Function to extract the children of a node OR nodes in a graph object. Children of a node are the nodes that have edges from the given node.
f.children(graph, nodes)f.children(graph, nodes)
graph |
A graph object generated by the |
nodes |
A character vector of nodes for which to extract children. |
A vector of vertices contains children set of the given nodes.
graph <- make.graph(vertices=c('A','M','L','Y','X'), bi_edges=list(c('A','Y')), di_edges=list(c('X','A'), c('X','M'), c('X','L'), c('X','Y'), c('M','Y'), c('A','M'), c('A','L'), c('M','L'), c('L','Y'))) f.children(graph, c('A'))graph <- make.graph(vertices=c('A','M','L','Y','X'), bi_edges=list(c('A','Y')), di_edges=list(c('X','A'), c('X','M'), c('X','L'), c('X','Y'), c('M','Y'), c('A','M'), c('A','L'), c('M','L'), c('L','Y'))) f.children(graph, c('A'))
Function to extract the descendants of a node OR nodes in a graph object. Descendants of a node Vi are set Vj such that there is a directed path Vi->...->Vj. Descendants set including Vi itself by convention.
f.descendants(graph, nodes)f.descendants(graph, nodes)
graph |
A graph object generated by the |
nodes |
A character vector of nodes for which to extract children. |
A vector of vertices contains descendants set of the given nodes.
graph <- make.graph(vertices=c('A','M','L','Y','X'), bi_edges=list(c('A','Y')), di_edges=list(c('X','A'), c('X','M'), c('X','L'), c('X','Y'), c('M','Y'), c('A','M'), c('A','L'), c('M','L'), c('L','Y'))) f.descendants(graph, c('A'))graph <- make.graph(vertices=c('A','M','L','Y','X'), bi_edges=list(c('A','Y')), di_edges=list(c('X','A'), c('X','M'), c('X','L'), c('X','Y'), c('M','Y'), c('A','M'), c('A','L'), c('M','L'), c('L','Y'))) f.descendants(graph, c('A'))
Function to extract the name of vertices that is in the district of a given vertex in a graph object. District of a unfixed vertex Vi is the set of vertices that are connected to Vi by bidirected edges, including Vi itself by convention.
f.district(graph, node)f.district(graph, node)
graph |
A graph object generated by the |
node |
A character string of a vertex for which to extract district. |
A vector of vertices that is in the district of the given vertex.
graph <- make.graph(vertices=c('A','M','L','Y','X'), bi_edges=list(c('A','Y')), di_edges=list(c('X','A'), c('X','M'), c('X','L'), c('X','Y'), c('M','Y'), c('A','M'), c('A','L'), c('M','L'), c('L','Y'))) f.district(graph, c('A'))graph <- make.graph(vertices=c('A','M','L','Y','X'), bi_edges=list(c('A','Y')), di_edges=list(c('X','A'), c('X','M'), c('X','L'), c('X','Y'), c('M','Y'), c('A','M'), c('A','L'), c('M','L'), c('L','Y'))) f.district(graph, c('A'))
Function to get the Markov blanket of a vertex in a graph object. Markov blanket of a vertex Vi is the union of vertices that is in the district of Vi and their parents set. Mb= union(district(Vi), parents(district(Vi))).
f.markov_blanket(graph, node)f.markov_blanket(graph, node)
graph |
A graph object generated by the |
node |
A character string of a vertex for which to extract Markov blanket. |
A vector of vertices that is in the Markov blanket of the given vertex.
graph <- make.graph(vertices=c('A','M','L','Y','X'), bi_edges=list(c('A','Y')), di_edges=list(c('X','A'), c('X','M'), c('X','L'), c('X','Y'), c('M','Y'), c('A','M'), c('A','L'), c('M','L'), c('L','Y'))) f.markov_blanket(graph, 'A')graph <- make.graph(vertices=c('A','M','L','Y','X'), bi_edges=list(c('A','Y')), di_edges=list(c('X','A'), c('X','M'), c('X','L'), c('X','Y'), c('M','Y'), c('A','M'), c('A','L'), c('M','L'), c('L','Y'))) f.markov_blanket(graph, 'A')
Function to get the Markov pillow of a vertex in a graph object.
Markov pillow of a vertex Vi is the subset of the Markov blanket of Vi that proceed Vi in the topological ordering of the graph.
Mp= {{Vj in union(district(Vi), parents(district(Vi))): Vj proceed Vi}}.
f.markov_pillow(graph, node, treatment = NULL)f.markov_pillow(graph, node, treatment = NULL)
graph |
A graph object generated by the |
node |
A character string of a vertex for which to extract Markov pillow. |
treatment |
A character string specifying the treatment variable in the graph. |
A vector of vertices that is in the Markov pillow of the given vertex.
graph <- make.graph(vertices=c('A','M','L','Y','X'), bi_edges=list(c('A','Y')), di_edges=list(c('X','A'), c('X','M'), c('X','L'), c('X','Y'), c('M','Y'), c('A','M'), c('A','L'), c('M','L'), c('L','Y'))) f.markov_pillow(graph, 'A')graph <- make.graph(vertices=c('A','M','L','Y','X'), bi_edges=list(c('A','Y')), di_edges=list(c('X','A'), c('X','M'), c('X','L'), c('X','Y'), c('M','Y'), c('A','M'), c('A','L'), c('M','L'), c('L','Y'))) f.markov_pillow(graph, 'A')
Function to extract the parents of a node OR nodes in a graph object. Parents of a node are the nodes that have directed edges pointing to the node.
f.parents(graph, nodes)f.parents(graph, nodes)
graph |
A graph object generated by the |
nodes |
A character vector of nodes for which to extract parents. |
A vector of vertices contains parents set of the given nodes.
graph <- make.graph(vertices=c('A','M','L','Y','X'), bi_edges=list(c('A','Y')), di_edges=list(c('X','A'), c('X','M'), c('X','L'), c('X','Y'), c('M','Y'), c('A','M'), c('A','L'), c('M','L'), c('L','Y'))) f.parents(graph, c('Y','L'))graph <- make.graph(vertices=c('A','M','L','Y','X'), bi_edges=list(c('A','Y')), di_edges=list(c('X','A'), c('X','M'), c('X','L'), c('X','Y'), c('M','Y'), c('A','M'), c('A','L'), c('M','L'), c('L','Y'))) f.parents(graph, c('Y','L'))
Function to return the reachable closure of a set of vertices in a graph object.
First obtain a Conditional ADMG (CADMG) via recursively fixing as many vertices as possible in the set of all vertices (V) excluding the set of vertices specified by the nodes parameter (S), i.e. V \ S.
The reachable closure is the subset of V \ S, where each vertex is not fixable even upon fixing other vertices.
f.reachable_closure(graph, nodes)f.reachable_closure(graph, nodes)
graph |
A graph object generated by the |
nodes |
A character vector of vertices. |
A list containing the following components:
A character vector containing the reachable closure of the given vertices.
A character vector of vertices telling the order in which the vertices were fixed.
The CADMG obtained via recursively fixing as many vertices as possible in the set of all vertices (V) excluding the set of vertices specified by the nodes parameter (S), i.e. V \ S.
graph <- make.graph(vertices=c('A','M','L','Y','X'), bi_edges=list(c('A','Y')), di_edges=list(c('X','A'), c('X','M'), c('X','L'), c('X','Y'), c('M','Y'), c('A','M'), c('A','L'), c('M','L'), c('L','Y'))) f.reachable_closure(graph, 'A')graph <- make.graph(vertices=c('A','M','L','Y','X'), bi_edges=list(c('A','Y')), di_edges=list(c('X','A'), c('X','M'), c('X','L'), c('X','Y'), c('M','Y'), c('A','M'), c('A','L'), c('M','L'), c('L','Y'))) f.reachable_closure(graph, 'A')
Wrapper around f.top_orderMAT() that first builds the adjacency matrix from the graph.
f.top_order(graph, treatment = NULL)f.top_order(graph, treatment = NULL)
graph |
A graph object generated by the |
treatment |
A character string indicating the treatment variable. If NULL, this function will rank vertices according to their input order in the vertices vector when there are ties. |
A vector of vertices ranked with rank from small to large.
graph <- make.graph(vertices=c('A','M','L','Y','X'), bi_edges=list(c('A','Y')), di_edges=list(c('X','A'), c('X','M'), c('X','L'), c('X','Y'), c('M','Y'), c('A','M'), c('A','L'), c('M','L'), c('L','Y'))) f.top_order(graph)graph <- make.graph(vertices=c('A','M','L','Y','X'), bi_edges=list(c('A','Y')), di_edges=list(c('X','A'), c('X','M'), c('X','L'), c('X','Y'), c('M','Y'), c('A','M'), c('A','L'), c('M','L'), c('L','Y'))) f.top_order(graph)
Function to check if a treatment variable is fixable in a graph object. If the treatment is fixable, then the average causal effect of the treatment on any choice of the outcome in the given graph is always identified via backdoor adjustment.
is.fix(graph, treatment)is.fix(graph, treatment)
graph |
A graph object generated by the |
treatment |
A character string specifying the treatment variable in the graph. |
A logical value indicating whether the treatment is primal fixable.
graph <- make.graph(vertices=c('A','M','L','Y','X'), bi_edges=list(c('A','Y')), di_edges=list(c('X','A'), c('X','M'), c('X','L'), c('X','Y'), c('M','Y'), c('A','M'), c('A','L'), c('M','L'), c('L','Y'))) is.p.fix(graph, 'A')graph <- make.graph(vertices=c('A','M','L','Y','X'), bi_edges=list(c('A','Y')), di_edges=list(c('X','A'), c('X','M'), c('X','L'), c('X','Y'), c('M','Y'), c('A','M'), c('A','L'), c('M','L'), c('L','Y'))) is.p.fix(graph, 'A')
Function to check if a graph is mb-shielded. A graph being mb-shielded means that the graph only implies ordinary equality constraints on the observed data distribution.
is.mb.shielded(graph)is.mb.shielded(graph)
graph |
A graph object generated by the |
A logical value indicating whether the graph is mb-shielded.
graph <- make.graph(vertices=c('A','M','L','Y','X'), bi_edges=list(c('A','Y')), di_edges=list(c('X','A'), c('X','M'), c('X','L'), c('X','Y'), c('M','Y'), c('A','M'), c('A','L'), c('M','L'), c('L','Y'))) is.mb.shielded(graph)graph <- make.graph(vertices=c('A','M','L','Y','X'), bi_edges=list(c('A','Y')), di_edges=list(c('X','A'), c('X','M'), c('X','L'), c('X','Y'), c('M','Y'), c('A','M'), c('A','L'), c('M','L'), c('L','Y'))) is.mb.shielded(graph)
Function to check if a graph is nonparametrically saturated. A graph being nonparametrically saturated means that the graph implies NO equality constraints on the observed data distribution
is.np.saturated(graph)is.np.saturated(graph)
graph |
A graph object generated by the |
A logical value indicating whether the graph is nonparametrically saturated.
graph <- make.graph(vertices=c('A','M','L','Y','X'), bi_edges=list(c('A','Y')), di_edges=list(c('X','A'), c('X','M'), c('X','L'), c('X','Y'), c('M','Y'), c('A','M'), c('A','L'), c('M','L'), c('L','Y'))) is.np.saturated(graph)graph <- make.graph(vertices=c('A','M','L','Y','X'), bi_edges=list(c('A','Y')), di_edges=list(c('X','A'), c('X','M'), c('X','L'), c('X','Y'), c('M','Y'), c('A','M'), c('A','L'), c('M','L'), c('L','Y'))) is.np.saturated(graph)
Function to check if a treatment variable is primal fixable in a graph object. If the treatment is primal fixable, then the average causal effect of the treatment on any choice of the outcome in the given graph is always identified.
is.p.fix(graph, treatment)is.p.fix(graph, treatment)
graph |
A graph object generated by the |
treatment |
A character string specifying the treatment variable in the graph. |
A logical value indicating whether the treatment is primal fixable.
graph <- make.graph(vertices=c('A','M','L','Y','X'), bi_edges=list(c('A','Y')), di_edges=list(c('X','A'), c('X','M'), c('X','L'), c('X','Y'), c('M','Y'), c('A','M'), c('A','L'), c('M','L'), c('L','Y'))) is.p.fix(graph, 'A')graph <- make.graph(vertices=c('A','M','L','Y','X'), bi_edges=list(c('A','Y')), di_edges=list(c('X','A'), c('X','M'), c('X','L'), c('X','Y'), c('M','Y'), c('A','M'), c('A','L'), c('M','L'), c('L','Y'))) is.p.fix(graph, 'A')
This function create a graph object that can be used in other functions in this package.
make.graph(vertices, bi_edges, di_edges, multivariate.variables = NULL)make.graph(vertices, bi_edges, di_edges, multivariate.variables = NULL)
vertices |
A character vector of vertices in the graph. |
bi_edges |
A list of vectors that record the bidirectional edges in the graph. For example, |
di_edges |
A list of vectors that record the directed edges in the graph. For example, |
multivariate.variables |
A list of variables that are multivariate in the causal graph.
For example, |
A graph object with the following components:
verticesEquivalent to the input argument vertices.
fixedA data frame with a column fixed that indicates whether the vertex is fixed or not. The vertices is not fixed initially.
bi_edgesEquivalent to the input argument bi_edges.
di_edgesEquivalent to the input argument di_edges.
multivariate.variablesA list of variables that are multivariate in the causal graph. For example, multivariate.variables=list(M=c('M1,'M2')) means M is bivariate and the corresponding columns in the dataframe are M1 and M2. Default is NULL.
make.graph(vertices=c('A','M','L','Y','X'), bi_edges=list(c('A','Y')), di_edges=list(c('X','A'), c('X','M'), c('X','L'), c('X','Y'), c('M','Y'), c('A','M'), c('A','L'), c('M','L'), c('L','Y')))make.graph(vertices=c('A','M','L','Y','X'), bi_edges=list(c('A','Y')), di_edges=list(c('X','A'), c('X','M'), c('X','L'), c('X','Y'), c('M','Y'), c('A','M'), c('A','L'), c('M','L'), c('L','Y')))