# Flowchart drawing (Complicated Arrows)

The main problem is that, I don't know how to draw the rest of the arrows, especially, the bottom right hand corner. Ihave drawn everything I CAN.

\documentclass[a4paper]{article}

\usepackage[top=1cm,bottom=1cm,left=1cm,landscape]{geometry}

\usepackage{tikz}
\usetikzlibrary{arrows,arrows.meta}
%\input{arrowsnew}

\begin{document}

\tikzstyle{mbigblock} = [rectangle, draw, text width=13cm, text centered, rounded corners, minimum height=1em]
\tikzstyle{block}  = [rectangle, draw, text width=3.5cm, text centered, minimum height=1em]
\tikzstyle{lblock} = [rectangle, draw, text width=5cm, text centered, minimum height=1em]
\tikzstyle{rblock} = [rectangle, draw, text width=3.5cm, text centered, minimum height=1em]

\begin{tikzpicture}[node distance=2cm]

% middle boxes
\node (m1) [mbigblock] {Choose an exhaustive summary, $\kappa$, with $p$ parameters $\theta$};
\node (m2) [mbigblock,below of=m1,node distance=1cm] {Find the rank, $r$, of the derivative matrix $D=\partial \kappa / \partial \theta$};
\node (m3)  [block,below of=m2] {Model is full rank and at least locally identifiable (Th2 a. i.)};
\node (m4)  [block,below of=m3] {Does the model extend?};
\node (m5)  [block,below of=m4] {Can the extension theorem be used?};
\node (m6)  [block,below of=m5] {If $D_{ex}$ is full rank, the model is full rank in general (Th3)};
\node (m7)  [block,below of=m6,text width=2cm] {Is $r_s \geq p$?};
\node (m8l) [block,below left  of=m7,node distance=2.5cm,text width=3cm] {Model is full rank and at least locally identifiable (Th 8b).};
\node (m8r) [block,below right of=m7,node distance=2.5cm,text width=3cm] {Model is parameter redundant and non--identifiable (Th 8b).};
\node (m9)  [block,below of=m7,node distance=3.5cm,text width=2cm] {Is $r_s = p$?};
\node (m10l) [block,below left  of=m9,node distance=2.5cm,text width=3cm] {Solve PDE to find a reduced--form exhaustive summary};
\node (m10r) [block,below right of=m9,node distance=2.5cm,text width=3cm] {$s$ is a reduced--form exhaustive summary};

% left boxes
\node (l1) [lblock,left  of=m3,node distance=8cm] {Model is parameter redundant and not identifiable. There are $r$ estimable parameters. (Th2a.ii)};
\node (l2) [lblock,below of=l1,node distance=3cm] {Solve $\alpha^T D=0$ and PDE(9) to find the set of estimable parameters, $\beta$(Th2b). Let $\theta=\beta$ and find the new $D$. What follows applies to the new set of parameters, from this results for the original $\theta$ can be deduced.};
\node (l3) [lblock,below of=l2,node distance=5cm] {Write $D=PLUR$. Does Det$(U)=0$ have any solutions (for which $R$ is defined)(Th4)? If appropriate write $D_{ex}=P_{ex}L_{ex}U_{ex}R_{ex}$. Does Det$(U_{ex})=0$ have any solutions (Th6)};
\node (l4l) [block,below left  of=l3,node distance=4cm,text width=6em] {Conditionally Full Rank};
\node (l4r) [block,below right of=l3,node distance=4cm,text width=6em] {Essentially Full Rank};
\node (l5l) [block,below of=l4l,text width=6em] {Determine parameter redundant submodels if appropriate.};
\node (l5r) [block,below of=l4r,text width=6em,minimum height=6em] {Test for global identifiability};

% right boxes
\node (r1) [block,right of=m3,node distance=8cm] {Choose a reparameterisation $s$ of length $p_s$};
\node (r2) [block,below of=r1,node distance=4cm] {Rewrite $\kappa$ in terms of $s$. Find the rank $r_s$, of the derivative matrix $D_s=\partial \kappa(s)/\partial s$};
\node (r3) [block,below of=r2,node distance=3cm] {Is rank$(\partial s / \partial \theta)=p_s$ ?};
\node (r4) [block,right of=m9,node distance=8cm,text width=2cm] {Is $r_s=p_s$};
\node (r5l) [block,below left  of=r4,node distance=2.5cm,text width=3cm] {Solve PDE to find an exhaustive summary};
\node (r5r) [block,below right of=r4,node distance=2.5cm,text width=3cm] {$s$ is an exhaustive summary (remark 6)};

% Middle flows
\draw[->] (m1) -- (m2) ;
\draw[->] (m2) -- node[left] {$r=p$} (m3) ;
\draw[->] (m3) -- (m4) ;
\draw[->] (m4) -- node[left] {Yes} (m5) ;
\draw[->] (m5) -- node[left] {Yes} (m6) ;

\draw[->] (m7) -| node[left]  {Yes} (m8l);
\draw[->] (m7) -| node[right] {No } (m8r);

\draw[->] (m9) -| node[left]  {No}  (m10l);
\draw[->] (m9) -| node[right] {Yes} (m10r);

% Right flows
\draw[->] (r1) -- (r2) ;
\draw[->] (r2) -- (r3) ;
\draw[->] (r3) -- (r4) ;
\draw[->] (r4) -| node[left]  {No}  (r5l);
\draw[->] (r4) -| node[right] {Yes} (r5r);

% Left flows
\draw[->] (l1) -- (l2) ;

%\draw[->] (l3) |-| node[left]  {Yes} (l4l);
%\draw[->] (l3) |-| node[right] {No } (l4r);

\draw[->] (l4l) -- (l5l) ;
\draw[->] (l4r) -- (l5r) ;

% Middle to left
% \draw[->] (m4.west) -| (l3.east) ;

% Middle to right

% Right to middle
\draw[->] (r3.west) -| (m7.north) ;

\end{tikzpicture}

\end{document}


This is as far as I can draw. I dont know how to put the 'zigzag' arrows. I dont know how to put two 'parallel' ones below the same one.

Can someone help me completing the flowchart?

Thanks!

-
Why not create a small sample that captures the areas you're having difficulty with, and ask about those difficulties specifically? – Paul Gessler May 16 '14 at 21:09
See if tex.stackexchange.com/questions/45347/… is of help. – Torbjørn T. May 16 '14 at 21:49
See this link. It may help. tex.stackexchange.com/questions/50780/… – aparna May 16 '14 at 22:06

One way to draw the outer lines would be to define intermediate coordinates:

\coordinate (Above m1) at ($(m1.north)+(0,1.0cm)$);
\coordinate (Below r5l) at ($(r5l.south) + (0,-1.0cm)$);
\draw[ultra thick, blue, ->]
(r5l.south) -- (Below r5l)
-- ++ (7.5cm,0)
|- (Above m1)
-- (m1.north)
;


And for the "zig-zag":

\draw [ultra thick, orange, ->]
(m4.west) --
++(-2.0cm,0) |-
(l3.east)
;
\draw [ultra thick, orange, ->] (m6.west) -- ++(-2.0cm,0);


Using similar techniques you should be able to draw the rest of the arrows.

## Notes:

• The ++(x,y) syntax means the coordinate located at the current position with a translation of (x,y) applied. So ++(-2.0cm,0) means the point 2.0cm to the left.
• A \coordinate defines a name for a specific point. So, \coordinate (Above m1) at ($(m1.north)+(0,1.0cm)$) defines a coordinate named (Above m1) which corresponds to the vector addition of (m1.north) and (0,1.0cm). So 1.0cm above the north point of m1.

## Code:

\documentclass[a4paper]{article}

\usepackage[top=1cm,bottom=1cm,left=1cm,landscape]{geometry}

\usepackage{tikz}
\usetikzlibrary{calc}
%\usetikzlibrary{arrows,arrows.meta}
%\input{arrowsnew}

\begin{document}

\tikzstyle{mbigblock} = [rectangle, draw, text width=13cm, text centered, rounded corners, minimum height=1em]
\tikzstyle{block}  = [rectangle, draw, text width=3.5cm, text centered, minimum height=1em]
\tikzstyle{lblock} = [rectangle, draw, text width=5cm, text centered, minimum height=1em]
\tikzstyle{rblock} = [rectangle, draw, text width=3.5cm, text centered, minimum height=1em]

\begin{tikzpicture}[node distance=2cm,scale=0.8]

% middle boxes
\node (m1) [mbigblock] {Choose an exhaustive summary, $\kappa$, with $p$ parameters $\theta$};
\node (m2) [mbigblock,below of=m1,node distance=1cm] {Find the rank, $r$, of the derivative matrix $D=\partial \kappa / \partial \theta$};
\node (m3)  [block,below of=m2] {Model is full rank and at least locally identifiable (Th2 a. i.)};
\node (m4)  [block,below of=m3] {Does the model extend?};
\node (m5)  [block,below of=m4] {Can the extension theorem be used?};
\node (m6)  [block,below of=m5] {If $D_{ex}$ is full rank, the model is full rank in general (Th3)};
\node (m7)  [block,below of=m6,text width=2cm] {Is $r_s \geq p$?};
\node (m8l) [block,below left  of=m7,node distance=2.5cm,text width=3cm] {Model is full rank and at least locally identifiable (Th 8b).};
\node (m8r) [block,below right of=m7,node distance=2.5cm,text width=3cm] {Model is parameter redundant and non--identifiable (Th 8b).};
\node (m9)  [block,below of=m7,node distance=3.5cm,text width=2cm] {Is $r_s = p$?};
\node (m10l) [block,below left  of=m9,node distance=2.5cm,text width=3cm] {Solve PDE to find a reduced--form exhaustive summary};
\node (m10r) [block,below right of=m9,node distance=2.5cm,text width=3cm] {$s$ is a reduced--form exhaustive summary};

% left boxes
\node (l1) [lblock,left  of=m3,node distance=8cm] {Model is parameter redundant and not identifiable. There are $r$ estimable parameters. (Th2a.ii)};
\node (l2) [lblock,below of=l1,node distance=3cm] {Solve $\alpha^T D=0$ and PDE(9) to find the set of estimable parameters, $\beta$(Th2b). Let $\theta=\beta$ and find the new $D$. What follows applies to the new set of parameters, from this results for the original $\theta$ can be deduced.};
\node (l3) [lblock,below of=l2,node distance=5cm] {Write $D=PLUR$. Does Det$(U)=0$ have any solutions (for which $R$ is defined)(Th4)? If appropriate write $D_{ex}=P_{ex}L_{ex}U_{ex}R_{ex}$. Does Det$(U_{ex})=0$ have any solutions (Th6)};
\node (l4l) [block,below left  of=l3,node distance=4cm,text width=6em] {Conditionally Full Rank};
\node (l4r) [block,below right of=l3,node distance=4cm,text width=6em] {Essentially Full Rank};
\node (l5l) [block,below of=l4l,text width=6em] {Determine parameter redundant submodels if appropriate.};
\node (l5r) [block,below of=l4r,text width=6em,minimum height=6em] {Test for global identifiability};

% right boxes
\node (r1) [block,right of=m3,node distance=8cm] {Choose a reparameterisation $s$ of length $p_s$};
\node (r2) [block,below of=r1,node distance=4cm] {Rewrite $\kappa$ in terms of $s$. Find the rank $r_s$, of the derivative matrix $D_s=\partial \kappa(s)/\partial s$};
\node (r3) [block,below of=r2,node distance=3cm] {Is rank$(\partial s / \partial \theta)=p_s$ ?};
\node (r4) [block,right of=m9,node distance=8cm,text width=2cm] {Is $r_s=p_s$};
\node (r5l) [block,below left  of=r4,node distance=2.5cm,text width=3cm] {Solve PDE to find an exhaustive summary};
\node (r5r) [block,below right of=r4,node distance=2.5cm,text width=3cm] {$s$ is an exhaustive summary (remark 6)};

\draw[ultra thick, red ]  (r5r.south) -- ++ (0,-1.0cm);

% Middle flows
\draw[->] (m1) -- (m2) ;
\draw[->] (m2) -- node[left] {$r=p$} (m3) ;
\draw[->] (m3) -- (m4) ;
\draw[->] (m4) -- node[left] {Yes} (m5) ;
\draw[->] (m5) -- node[left] {Yes} (m6) ;

\draw[->] (m7) -| node[left]  {Yes} (m8l);
\draw[->] (m7) -| node[right] {No } (m8r);

\draw[->] (m9) -| node[left]  {No}  (m10l);
\draw[->] (m9) -| node[right] {Yes} (m10r);

% Right flows
\draw[->] (r1) -- (r2) ;
\draw[->] (r2) -- (r3) ;
\draw[->] (r3) -- (r4) ;
\draw[->] (r4) -| node[left]  {No}  (r5l);
\draw[->] (r4) -| node[right] {Yes} (r5r);

% Left flows
\draw[->] (l1) -- (l2) ;

%\draw[->] (l3) |-| node[left]  {Yes} (l4l);
%\draw[->] (l3) |-| node[right] {No } (l4r);

\draw[->] (l4l) -- (l5l) ;
\draw[->] (l4r) -- (l5r) ;

% Middle to left
% \draw[->] (m4.west) -| (l3.east) ;

% Middle to right

% Right to middle
\draw[->] (r3.west) -| (m7.north) ;

%% Draw the outer lines
\coordinate (Above m1) at ($(m1.north)+(0,1.0cm)$);
\coordinate (Below r5l) at ($(r5l.south) + (0,-1.0cm)$);
\draw[ultra thick, blue, ->]
(r5l.south) -- (Below r5l)
-- ++ (7.5cm,0)
|- (Above m1)
-- (m1.north)
;

\draw [ultra thick, orange, ->]
(m4.west) --
++(-2.0cm,0) |-
(l3.east)
;
\draw [ultra thick, orange, ->] (m6.west) -- ++(-2.0cm,0);

\end{tikzpicture}

\end{document}

-
Hi Peter, I dont exactly get the \coordinate thing. Why do we have +(0,1.0cm) and +(0,-1.0cm). And what's ++ (7.5cm,0) and ++(-2.0cm,0)? – Chen Stats Yu May 16 '14 at 22:55
I got it, thanks! Peter! – Chen Stats Yu May 16 '14 at 23:39
Updated answer with some explanation. – Peter Grill May 16 '14 at 23:42

With the helpful links and Peter's example, I have finally finished the graph!

\documentclass[a4paper]{article}

\usepackage[top=1cm,bottom=1cm,left=1cm,landscape]{geometry}

\usepackage{tikz}
\usetikzlibrary{calc}

\begin{document}

\pagestyle{empty}

\tikzstyle{mbigblock} = [rectangle, draw, text width=13cm, text centered, rounded corners, minimum height=1em]
\tikzstyle{block}  = [rectangle, draw, text width=3.5cm, text centered, minimum height=1em]
\tikzstyle{lblock} = [rectangle, draw, text width=5cm, text centered, minimum height=1em]
\tikzstyle{rblock} = [rectangle, draw, text width=3.5cm, text centered, minimum height=1em]

\begin{tikzpicture}[node distance=2cm]

% middle boxes
\node (m1) [mbigblock] {Choose an exhaustive summary, $\kappa$, with $p$ parameters $\theta$};
\node (m2) [mbigblock,below of=m1,node distance=1cm] {Find the rank, $r$, of the derivative matrix $D=\partial \kappa / \partial \theta$};
\node (m3)  [block,below of=m2] {Model is full rank and at least locally identifiable (Th2 a. i.)};
\node (m4)  [block,below of=m3] {Does the model extend?};
\node (m5)  [block,below of=m4] {Can the extension theorem be used?};
\node (m6)  [block,below of=m5] {If $D_{ex}$ is full rank, the model is full rank in general (Th3)};
\node (m7)  [block,below of=m6,text width=2cm] {Is $r_s \geq p$?};
\node (m8l) [block,below left  of=m7,node distance=2.5cm,text width=3cm] {Model is full rank and at least locally identifiable (Th 8b).};
\node (m8r) [block,below right of=m7,node distance=2.5cm,text width=3cm] {Model is parameter redundant and non--identifiable (Th 8b).};
\node (m9)  [block,below of=m7,node distance=3.5cm,text width=2cm] {Is $r_s = p$?};
\node (m10l) [block,below left  of=m9,node distance=2.5cm,text width=3cm] {Solve PDE to find a reduced--form exhaustive summary};
\node (m10r) [block,below right of=m9,node distance=2.5cm,text width=3cm] {$s$ is a reduced--form exhaustive summary};

% left boxes
\node (l1) [lblock,left  of=m3,node distance=8cm] {Model is parameter redundant and not identifiable. There are $r$ estimable parameters. (Th2a.ii)};
\node (l2) [lblock,below of=l1,node distance=3cm] {Solve $\alpha^T D=0$ and PDE(9) to find the set of estimable parameters, $\beta$(Th2b). Let $\theta=\beta$ and find the new $D$. What follows applies to the new set of parameters, from this results for the original $\theta$ can be deduced.};
\node (l3) [lblock,below of=l2,node distance=5cm] {Write $D=PLUR$. Does Det$(U)=0$ have any solutions (for which $R$ is defined)(Th4)? If appropriate write $D_{ex}=P_{ex}L_{ex}U_{ex}R_{ex}$. Does Det$(U_{ex})=0$ have any solutions (Th6)};
\node (l4l) [block,below left  of=l3,node distance=4cm,text width=6em] {Conditionally Full Rank};
\node (l4r) [block,below right of=l3,node distance=4cm,text width=6em] {Essentially Full Rank};
\node (l5l) [block,below of=l4l,text width=6em] {Determine parameter redundant submodels if appropriate.};
\node (l5r) [block,below of=l4r,text width=6em,minimum height=6em] {Test for global identifiability};

% right boxes
\node (r1) [block,right of=m3,node distance=8cm] {Choose a reparameterisation $s$ of length $p_s$};
\node (r2) [block,below of=r1,node distance=4cm] {Rewrite $\kappa$ in terms of $s$. Find the rank $r_s$, of the derivative matrix $D_s=\partial \kappa(s)/\partial s$};
\node (r3) [block,below of=r2,node distance=3cm] {Is rank$(\partial s / \partial \theta)=p_s$ ?};
\node (r4) [block,right of=m9,node distance=8cm,text width=2cm] {Is $r_s=p_s$};
\node (r5l) [block,below left  of=r4,node distance=2.5cm,text width=3cm] {Solve PDE to find an exhaustive summary};
\node (r5r) [block,below right of=r4,node distance=2.5cm,text width=3cm] {$s$ is an exhaustive summary (remark 6)};

% Middle flows
\draw[thick,->] (m1) -- (m2) ;
\draw[thick,->] (m2) -- node[left] {$r=p$} (m3) ;
\draw[thick,->] (m3) -- (m4) ;
\draw[thick,->] (m4) -- node[left] {Yes} (m5) ;
\draw[thick,->] (m5) -- node[left] {Yes} (m6) ;

\draw[thick,->] (m7) -| node[left]  {Yes} (m8l);
\draw[thick,->] (m7) -| node[right] {No } (m8r);

\draw[thick,->] (m8l.south) -- ++(0,-0.3cm) -| (m9);
\draw[thick,->] (m8r.south) -- ++(0,-0.3cm) -| (m9);

\draw[thick,->] (m9) -| node[left]  {No}  (m10l);
\draw[thick,->] (m9) -| node[right] {Yes} (m10r);

% Right flows
\draw[thick,->] (r1) -- (r2) ;
\draw[thick,->] (r2) -- (r3) ;
\draw[thick,->] (r3) -- (r4) ;
\draw[thick,->] (r4) -| node[left]  {No}  (r5l);
\draw[thick,->] (r4) -| node[right] {Yes} (r5r);

% Left flows
\draw[thick,->] (l1) -- (l2) ;

\draw[thick,->] (l3.south) - ++ (0,-0.4cm) -| node[left]  {Yes} (l4l);
\draw[thick,->] (l3.south) - ++ (0,-0.4cm) -| node[right] {No } (l4r);

\draw[thick,->] (l4l) -- (l5l) ;
\draw[thick,->] (l4r) -- (l5r) ;

% Middle to left
\draw[thick,->] (m2.west) -| node[left] {$r<p$} (l1.north) ;
\draw[thick, orange, ->]
(m4.west) --
++(-2.0cm,0) |-
(l3.east)
;
\draw[thick, orange, ->] (m6.west) -- ++(-2.0cm,0);

% Middle to right
\draw[thick,->] (m2.east) -| node[above] {Cannot find rank} (r1.north) ;

% Left to middle
%\coordinate (l2tom3) at ($(m3.south)+(0,-0.3cm)$);
\draw[thick,->]
(l2.east)
-- ++(0.5cm,0)
|- ($(m3.south)+(0,-0.5cm)$) %(l2tom3)
;

% Right to middle
\draw[thick,->] (r3.west) -| (m7.north) ;

%% Draw the outer lines
%\coordinate (Above m1) at ($(m1.north)+(0,1.0cm)$);

\draw[thick, red]  (m10r.south) -- ++ (0,-0.5cm);
\draw[thick, red]  (r5l.south) -- ++ (0,-0.5cm);
\draw[thick, red]  (r5r.south) -- ++ (0,-0.5cm);

\draw[thick, blue, ->]
(m10l.south)
-- ++ (0,-0.5cm)
-- ++ (13.5cm,0)
|- ($(m1.north)+(0,0.5cm)$)
-- (m1.north)
;

\end{tikzpicture}

\end{document}


-
The only tiny thing left is: How would I get the text subscripts? Like $D_{\text{ex}}$ in the normal latex? It does not work within tikz. – Chen Stats Yu May 16 '14 at 23:47
Normal latex like $D_{\text{ex}}$ should work just fine in tikz. If not, please post a new question as that is clearly a different problem then drawing lines, which is the thrust of this question. And it would be helpful is posted a MWE instead of a really complicated example. This helps to focus on the actual question rather than dealing with other things which are not related to the question -- and makes the question more useful to a larger audience. – Peter Grill May 17 '14 at 0:23