1 \documentclass[12pt]{standalone}
4 \usepackage[utf8x]{inputenc}
6 \usepackage[T1]{fontenc}
8 \renewcommand{\rmdefault}{ugm}
9 \renewcommand{\sfdefault}{phv}
10 \usepackage[garamond]{mathdesign}
12 \usetikzlibrary{positioning, shapes, arrows, shadows}
18 observed/.style={circle, draw},
19 partly observed/.style 2 args={draw, fill=#2, path picture={
20 \fill[#1, sharp corners] (path picture bounding box.south west) -|
21 (path picture bounding box.north east) -- cycle;},
23 unobserved/.style={draw, circle, fill=gray!40}
26 \node[observed] (y) {Y};
27 % \node[observed,above=of y, xshift=1cm] (r) {R};
28 \node[partly observed={white}{gray!40}, above = of y] (x) {X};
29 \node[observed, left=of x] (w) {W};
30 \node[unobserved, above=of w, xshift=1cm] (k) {K};
31 \node[unobserved, right=of k] (u) {U};
33 % \draw[->] (r) -- (y);
34 % \draw[->] (r) -- (x);
39 \draw[->] (u) to [out=270,in=30] (y);
43 \matrix [draw, below, yshift=-0.2cm, inner sep=0.6em, outer sep=0em, nodes={align=center, anchor=center}] at (current bounding box.south){
44 \node[observed,label=right:observed] {}; \\
45 \node[unobserved,label=right:unobserved]{}; \\