Learn R Programming

causaloptim (version 0.9.8)

create_response_function: Translate regular DAG to response functions

Description

Translate regular DAG to response functions

Usage

create_response_function(graph, right.vars, cond.vars)

Value

A list of functions representing the response functions

Arguments

graph

An aaa-igraph-package object that represents a directed acyclic graph that contains certain edge attributes. The shiny app returns a graph in this format and see examples.

right.vars

Vertices of graph on the right side

cond.vars

Vertices of graph on the left side

Examples

Run this code
### confounded exposure and outcome
b <- igraph::graph_from_literal(X -+ Y, Ur -+ X, Ur -+ Y)
V(b)$leftside <- c(0,0,0)
V(b)$latent <- c(0,0,1)
V(b)$nvals <- c(2,2,2)
E(b)$rlconnect <- E(b)$edge.monotone <- c(0, 0, 0)
cond.vars <- V(b)[V(b)$leftside == 1 & names(V(b)) != "Ul"]
right.vars <- V(b)[V(b)$leftside == 0 & names(V(b)) != "Ur"] 
create_response_function(b, right.vars, cond.vars)

Run the code above in your browser using DataLab