analyze_graph {causaloptim}R Documentation

Analyze the causal graph to determine constraints and objective

Description

The graph must contain edge attributes named "leftside" and "lrconnect" that takes values 0 and 1. Only one edge may have a value 1 for lrconnect. The shiny app returns a graph in this format.

Usage

analyze_graph(graph, constraints, effectt)

Arguments

graph

An aaa-igraph-package object that represents a directed acyclic graph

constraints

A vector of character strings that represent the constraints

effectt

A character string that represents the causal effect of interest

Value

A an object of class "linearcausalproblem", which is a list with the following components. This list can be passed to optimize_effect which interfaces with Balke's code. Print and plot methods are also available.

variables

Character vector of variable names of potential outcomes, these start with 'q' to match Balke's notation

parameters

Character vector of parameter names of observed probabilities, these start with 'p' to match Balke's notation

constraints

Character vector of parsed constraints

objective

Character string defining the objective to be optimized in terms of the variables

p.vals

Matrix of all possible values of the observed data vector, corresponding to the list of parameters.

q.vals

Matrix of all possible values of the response function form of the potential outcomes, corresponding to the list of variables.

parsed.query

A nested list containing information on the parsed causal query.

objective.nonreduced

The objective in terms of the original variables, before algebraic variable reduction. The nonreduced variables can be obtained by concatenating the columns of q.vals.

response.functions

List of response functions.

graph

The graph as passed to the function.

R

A matrix with coefficients relating the p.vals to the q.vals p = R * q

c0

A vector of coefficients relating the q.vals to the objective function theta = c0 * q

iqR

A matrix with coefficients to represent the inequality constraints

Examples

### 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)
E(b)$rlconnect <- E(b)$edge.monotone <- c(0, 0, 0)
analyze_graph(b, constraints = NULL, effectt = "p{Y(X = 1) = 1} - p{Y(X = 0) = 1}")

[Package causaloptim version 0.8.2 Index]