How can I put minipage and tikzpicture side by side? I would like the right picture to centre (now it is aligned to the top) and give it a figure environment so I can give it a caption. This caption should be only under the right picture. What should I do?
\begin{figure}
\begin{minipage}{0.6\textwidth}
\begin{algorithm}[H]
\caption{Exact Invariant Simulator} \label{alg:eisim}
\begin{algorithmic}
\FOR{$r \in \{1,2,...,R\}$}
\STATE Sample $\theta_i^{(1,r)}$ from $\theta_i\sim p(\theta_i)$
\STATE Sample $Y^{(1,r)}\sim p(\cdot|\theta_i^{(1,r)})$
\FOR{$s \in \{2,3,..,S\}$}
\STATE Sample $\theta_i^{(s,r)}$ from $\theta_i\sim K_i(\cdot|\theta_{-i}^{(s-1,r)})$
\ENDFOR
\STATE Calculate test statistic $T(\theta^{(S,r)}, Y^{(S,r)})$ \footnotemark
\ENDFOR
\end{algorithmic}
\end{algorithm}
\end{minipage}
\hspace{40pt}
\begin{tikzpicture}
\node[latent] (y) {$Y$};
\node[latent, above = of y] (theta) {$\theta$};
\edge {theta} {y}
\end{tikzpicture}
\end{figure}


\documentclassand ending with\end{document}. I do not want to have to guess what the settings for your algorithm are. – Aug 31 '18 at 11:00