get_default_effect: Define default effect for a given graph

View source: R/graph-utilities.R

get_default_effectR Documentation

Define default effect for a given graph

Description

Define default effect for a given graph

Usage

get_default_effect(graphres)

Arguments

graphres

The graph object, should have vertex attributes "outcome" and "exposure"

Value

A string that can be passed to parse_effect

Examples

graphres <- graph_from_literal(Z -+ X, X -+ Y, Ul -+ Z, Ur -+ X, Ur -+ Y)
V(graphres)$leftside <- c(1, 0, 0, 1, 0)
V(graphres)$latent <- c(0, 0, 0, 1, 1)
V(graphres)$nvals <- c(3, 2, 2, 2, 2)
V(graphres)$exposure <- c(0, 1, 0, 0, 0)
V(graphres)$outcome <- c(0, 0, 1, 0, 0)
E(graphres)$rlconnect <- c(0, 0, 0, 0, 0)
E(graphres)$edge.monotone <- c(0, 0, 0, 0, 0)
get_default_effect(graphres = graphres) == "p{Y(X = 1)=1} - p{Y(X = 0)=1}" # TRUE

causaloptim documentation built on Nov. 2, 2023, 6:06 p.m.