# NOT RUN {
ex1 <- dagitty("dag {
X [exposure]
Y [outcome]
U [unobserved]
Z -> X -> Y
X <- U -> Y
}")
coordinates(ex1) <- list( x=c(Z=0,X=1,Y=1,U=0) , y=c(Z=0,U=0.5,X=0,Y=1) )
drawdag( ex1 )
# example of drawing open paths
drawdag( ex1 )
drawopenpaths( ex1 ) # open backdoor
drawdag( ex1 , col_arrow="gray" )
drawopenpaths( ex1 , Z=list("U") ) # closed backdoor
# }
Run the code above in your browser using DataLab