Skip to content
Graphviz (DOT) templates

Instrumental Variable DAG

Classic IV causal diagram — Z affects X, X affects Y, with unobserved confounder U.

Template previewGraphviz (DOT)
Rendering…

Make it your own.

digraph iv {
  rankdir=LR;
  graph [bgcolor=transparent];
  node [shape=ellipse, style=filled, fontname=Inter, fontsize=11];

  Z [label="Z\n(instrument)", fillcolor="#dcfce7"];
  X [label="X\n(treatment)", fillcolor="#dbeafe"];
  Y [label="Y\n(outcome)", fillcolor="#fce7f3"];
  U [label="U\n(confounder)", fillcolor="#fee2e2", style="filled,dashed"];

  Z -> X;
  X -> Y;
  U -> X;
  U -> Y;
}