Skip to content

Instantly share code, notes, and snippets.

@amodig
Created February 7, 2014 14:12
Show Gist options
  • Save amodig/8863306 to your computer and use it in GitHub Desktop.
Save amodig/8863306 to your computer and use it in GitHub Desktop.
dot2tex - AR2 model
\documentclass[english]{article}
\usepackage[margin=0.0in]{geometry}
\usepackage{babel}
\usepackage{tikz}
\usetikzlibrary{automata,shapes,arrows}
\usepackage{dot2texi}
\begin{document}
\pagestyle{empty}
\begin{tikzpicture}[>=latex',scale=0.6]
\tikzstyle{n} = [draw,shape=circle,minimum size=3em,inner sep=0pt,fill=black!20]
\tikzstyle{e} = [draw,shape=circle,minimum size=3em,inner sep=0pt,fill=white]
\tikzstyle{.} = [draw=none]
\begin{dot2tex}[fdp,tikz,codeonly,styleonly]
digraph G {
splines=true;
overlap=scale;
nodesep=0.01;
esep=0.9;
width=0.6;
height=0.6;
node [style="n"];
x1 [texlbl = "$x_{t-2}$", pos="1,3!"];
x2 [texlbl = "$x_{t-1}$", pos="2,3!"];
x3 [texlbl = "$x_{t}$", pos="3,3!"];
x4 [texlbl = "$x_{t+1}$", pos="4,3!"];
x5 [texlbl = "$x_{t+2}$", pos="5,3!"];
x6 [texlbl = "$x_{t+3}$", pos="6,3!"];
node [style="."]
x7 [texlbl = "$\cdots$", pos="7,3!"];
e7x [texlbl = "$\cdots$", pos="7,2!"];
node [style="n"];
y1 [texlbl = "$y_{t-2}$", pos="1,0!"];
y2 [texlbl = "$y_{t-1}$", pos="2,0!"];
y3 [texlbl = "$y_{t}$", pos="3,0!"];
y4 [texlbl = "$y_{t+1}$", pos="4,0!"];
y5 [texlbl = "$y_{t+2}$", pos="5,0!"];
y6 [texlbl = "$y_{t+3}$", pos="6,0!"];
node [style="."]
y7 [texlbl = "$\cdots$", pos="7,0!"];
e7y [texlbl = "$\cdots$", pos="7,1!"];
node [style="e"];
e3x [texlbl = "$\epsilon_{t}^{(x)}$", pos="3,2!"];
e4x [texlbl = "$\epsilon_{t+1}^{(x)}$", pos="4,2!"];
e5x [texlbl = "$\epsilon_{t+2}^{(x)}$", pos="5,2!"];
e6x [texlbl = "$\epsilon_{t+3}^{(x)}$", pos="6,2!"];
node [style="e"];
e3y [texlbl = "$\epsilon_{t}^{(y)}$", pos="3,1!"];
e4y [texlbl = "$\epsilon_{t+1}^{(y)}$", pos="4,1!"];
e5y [texlbl = "$\epsilon_{t+2}^{(y)}$", pos="5,1!"];
e6y [texlbl = "$\epsilon_{t+3}^{(y)}$", pos="6,1!"];
subgraph Rel1 {
rank=same {x1 -> x2 -> x3 -> x4 -> x5 -> x6 -> x7;}
rank=same {y1 -> y2 -> y3 -> y4 -> y5 -> y6 -> y7;}
edge [style="thick"]
e3x -> x3;
e4x -> x4;
e5x -> x5;
e6x -> x6;
e3y -> y3;
e4y -> y4;
e5y -> y5;
e6y -> y6;
}
subgraph Rel2 {
edge [dir=none, style=invis]
e3x -> e3y;
e4x -> e4y;
e5x -> e5y;
e6x -> e6y;
}
}
\end{dot2tex}
\draw[->,black,thick] (x1) to[out=45,in=135] (x3);
\draw[->,black,thick] (x2) to[out=45,in=135] (x4);
\draw[->,black,thick] (x3) to[out=45,in=135] (x5);
\draw[->,black,thick] (x4) to[out=45,in=135] (x6);
\draw[->,black,thick] (x5) to[out=45,in=135] (x7);
\coordinate[right of=x7] (x8);
\draw[->,black,thick,shorten >=0pt] (x6) to[out=45,in=135] (x8);
\draw[->,black,thick] (y1) to[out=-45,in=-135] (y3);
\draw[->,black,thick] (y2) to[out=-45,in=-135] (y4);
\draw[->,black,thick] (y3) to[out=-45,in=-135] (y5);
\draw[->,black,thick] (y4) to[out=-45,in=-135] (y6);
\draw[->,black,thick] (y5) to[out=-45,in=-135] (y7);
\coordinate[right of=y7] (y8);
\draw[->,black,thick,shorten >=0pt] (y6) to[out=-45,in=-135] (y8);
\end{tikzpicture}
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment