%\documentclass{uai2022} % for initial submission
\documentclass[accepted]{uai2022} % after acceptance, for a revised
                                    % version; also before submission to
                                    % see how the non-anonymous paper
                                    % would look like
%% There is a class option to choose the math font
% \documentclass[mathfont=ptmx]{uai2022} % ptmx math instead of Computer
                                         % Modern (has noticable issues)
% \documentclass[mathfont=newtx]{uai2022} % newtx fonts (improves upon
                                          % ptmx; less tested, no support)
% NOTE: Only keep *one* line above as appropriate, as it will be replaced
%       automatically for papers to be published. Do not make any other
%       change above this note for an accepted version.

%% Choose your variant of English; be consistent
\usepackage[american]{babel}
% \usepackage[british]{babel}

%% Some suggested packages, as needed:
\usepackage[square]{natbib} % has a nice set of citation styles and commands
    \bibliographystyle{plainnat}
    \renewcommand{\bibsection}{\subsubsection*{References}}
\usepackage{mathtools} % amsmath with fixes and additions
% \usepackage{siunitx} % for proper typesetting of numbers and units
\usepackage{booktabs} % commands to create good-looking tables
\usepackage{tikz} % nice language for creating drawings and diagrams


%Additional packages
\usepackage{setspace}
\usepackage{algorithm}% http://ctan.org/pkg/algorithms
\usepackage{algpseudocode}% http://ctan.org/pkg/algorithmicx
\usepackage{amsmath}
\usepackage{amsthm}
\newtheorem{theorem}{Theorem}
\usepackage{graphicx}
\usepackage{float}
\usepackage{subfig}
\usepackage{lscape}
\usepackage{hyperref}

\usepackage{url}
\usepackage{listings}
%\usepackage{minted}

\usepackage{caption}
%\usepackage{subcaption}
%\usepackage{subfigure}

\setlength{\abovedisplayskip}{0pt}
\setlength{\belowdisplayskip}{0pt}

%\usepackage{nameref,zref-xr}
%\zxrsetup{toltxlabel}
%\zexternaldocument*{deng_594}

\usepackage{placeins}


%% Provided macros
% \smaller: Because the class footnote size is essentially LaTeX's \small,
%           redefining \footnotesize, we provide the original \footnotesize
%           using this macro.
%           (Use only sparingly, e.g., in drawings, as it is quite small.)
%% Self-defined macros
%\newcommand{\swap}[3][-]{#3#1#2} % just an example

\title{Bayesian Spillover Graphs for Dynamic Networks: Supplementary Material}

% The standard author block has changed for UAI 2022 to provide
% more space for long author lists and allow for complex affiliations
%
% All author information is authomatically removed by the class for the
% anonymous submission version of your paper, so you can already add your
% information below.
%
% Add authors
\author[1]{{Grace Deng}}
\author[1]{{David S.\ Matteson}}
\affil[1]{%
    Department of Statistics \& Data Science\\
    Cornell University\\
    Ithaca, NY, USA
}

\begin{document}
\onecolumn
\maketitle
%\newpage

\appendix
%\onecolumn
\section{ Moving Average Representation of VAR(1)} \label{appendix:moving_avg}
We can rewrite a VAR(1) model with a moving average representation \citep{tsay2013multivariate} using the mean-adjusted model, which is useful for computing variances of forecast errors.

We define the \textbf{mean-adjusted model}
$\tilde{\mathbf{z}}_{t} = \mathbf{z}_{t} - \mathbf{\mu}$, where $\mathbf{\mu} = (I_{d} - \phi_{1})^{-1} \phi_{0}$.

Then,
$$
\begin{aligned}
\tilde{\mathbf{z}}_{t} &= \mathbf{a}_{t} + \phi_{1}\tilde{\mathbf{z}}_{t-1}  \\
&= \mathbf{a}_{t} + \phi_{1}(\mathbf{a}_{t-1} + \phi_{1}\tilde{\mathbf{z}}_{t-2}) \\
%&= \mathbf{a}_{t} + \phi_{1}\mathbf{a}_{t-1} + \phi_{1}^{2}(\tilde{\mathbf{z}}_{t-2}) \\
&= \mathbf{a}_{t} + \phi_{1}\mathbf{a}_{t-1} + \phi_{1}^{2}(\mathbf{a}_{t-2} + \phi_{1}\tilde{\mathbf{z}}_{t-3}) \\
%&= ... \\
&= \mathbf{a}_{t} + \phi_{1}\mathbf{a}_{t-1} + \phi_{1}^{2}\mathbf{a}_{t-2} + \phi_{1}^{3}\mathbf{a}_{t-3} + ... \\
\end{aligned}
$$

Hence, 
$$
\begin{aligned}
\mathbf{z}_{t} &= \mathbf{\mu} + \tilde{\mathbf{z}}_{t} \\
&= \mathbf{\mu} + \mathbf{a}_{t} + \phi_{1}\mathbf{a}_{t-1} + \phi_{1}^{2}\mathbf{a}_{t-2} + \phi_{1}^{3}\mathbf{a}_{t-3} + ... \\
&= \mathbf{\mu} + \mathbf{a}_{t} + \psi_{1}\mathbf{a}_{t-1} + \psi_{2}\mathbf{a}_{t-2} + ... \\
&= \mathbf{\mu} + \sum^{\infty}_{i=0}\psi_{i}\mathbf{a}_{t-i}
\end{aligned}
$$

where $\psi_{i} = \phi_{1}^{i}$ for $i \geq 0$. 

\section{Proof of Theorem 1} \label{appendix:dag_proof}

\begin{theorem}
If $\phi_{1}$ is a DAG, then (1) no autocorrelation exists, (2) $\phi_{1}$ can be specified by a strictly triangular matrix, (3) all eigenvalues of $\phi_{1}$ are 0 and hence $z_{t}$ is stationary.
\end{theorem}

\noindent \textbf{Proof:} By definition of DAG, no cycles can exist in the adjacency matrix, in this case, $\phi_{1}$. Hence, the diagonal entries which indicate dependency of $z_{it}$ on $z_{i, t+1}$ is necessarily 0, and thereby proving point (1). 

Note that by definition, there exists a topological ordering on the vertices if and only if a graph has no directed cycles. Because $\phi_{1}$ is a DAG, we can relabel the $d$ vertices (time series components) as $v_{1}, v_{2}, ..., v_{d}$. If $v_{i}v_{i'}$ is a directed edge into $i$ from $i'$ (indicating Granger-causality), then $i > i'$. Hence, all entries above the main diagonal are also 0 because these are entries for which $i < i'$.  Combined with point (1) where main diagonal entries are also 0, this satisfies the definition of a strictly lower-triangular matrix (2). 

We've shown that the adjacency matrix of a DAG is strictly lower-triangular via permutation, and note that the order of individual time series components does not matter, although in this case the $d$ vertices are ordered from source to sink nodes. The eigenvalues of any lower-triangular matrix is just its diagonal components \citep{axler1997linear}, meaning that all eigenvalues for $\phi_{1}$ is just 0. Since these are strictly less than $1$ in magnitude, we can conclude that $z_{t}$ is stationary (3). 

\section{Evaluating Accuracy for Source \& Sink Node Identification} \label{appendix:ndcg}
First, define Discounted Cumulative Gain (DCG) at position $d$, for $d$ nodes arranged in a particular order:
\begin{align*}
{\mathrm  {DCG_{{d}}}}=\sum _{{i=1}}^{{d}}{\frac  {rel_{{i}}}{\log_{{2}}(i+1)}}
\end{align*}
where $rel_{i}$ is the graded precision score of node at position $i$, e.g. \{1, 0.5, 0\} for \{source, intermediary, sink\} nodes respectively. Greater penalty is given for source or sink nodes ranked in lower positions. NDCG \citep{valizadegan2009learning} then equals DCG divided by Ideal Discounted Cumulative Gain (IDCG):
\begin{align*}
    {\mathrm  {NDCG_{{d}}}}={\frac  {DCG_{{d}}}{IDCG_{{d}}}}, \ \ {\displaystyle \mathrm {IDCG_{d}} =\sum _{i=1}^{\vert rel_{d}\vert}{\frac {rel_{i}}{\log_{2}(i+1)}}}
\end{align*}
and $\vert rel_{d}\vert$ represents the optimal order of nodes, which is given by the ground truth labels of each node.


\section{BSG for Identifying Sink and Source Nodes}
\subsection{Ablation Experiment - Error Covariance $\Sigma_{a}$ } \label{appendix:dep_errors_ablation}

\begin{table*}[h] \centering 
  \caption{Average NDCG (Accuracy) for Identifying Sink \& Source Nodes with Dependent Errors, 5 Rep.} 
  \label{table:correlated_source_sink_ndcg} 
\resizebox{0.9\textwidth}{!}{%
\begin{tabular}{@{\extracolsep{0pt}} lcc|cc|cc} 
\\[-1.8ex]\hline 
\hline \\[-1.8ex] 
Directed Acyclic & \multicolumn{2}{c}{A. Weak Dependency $\sigma_{jk} = 0.1$} & \multicolumn{2}{c}{B. Moderate Dependency $\sigma_{jk} = 0.5$} & \multicolumn{2}{c}{C. Strong Dependency, $\sigma_{jk} = 0.9$} \\ 
\hline \\[-1.8ex] 
 & NDCG@24 & NDCG@24  & NDCG@24 & NDCG@24 & NDCG@24 & NDCG@24 \\ 
Method & Source Nodes & Sink Nodes & Source Nodes & Sink Nodes & Source Nodes & Sink Nodes  \\
\hline \\[-1.8ex] 
BSG, $h=1$ & 0.938 $\pm$ 0.04 & \textbf{1} $\pm$ 0 & 0.951 $\pm$ 0.004 & \textbf{1} $\pm$ 0 & 0.925 $\pm$ 0.016 & 1 $\pm$ 0 \\ 
BSG, $h=5$ & 0.995 $\pm$ 0.006 & 0.999 $\pm$ 0.001 & \textbf{0.993} $\pm$ 0.004 & 0.997 $\pm$ 0.002 & 0.961 $\pm$ 0.011 & \textbf{0.993} $\pm$ 0.001 \\ 
BSG, $h=10$ & \textbf{0.99} $\pm$ 0.004 & 0.994 $\pm$ 0.002  & 0.989 $\pm$ 0.006 & 0.991 $\pm$ 0.003& \textbf{0.975} $\pm$ 0.01 & 0.988 $\pm$ 0.004 \\ 
\hline \\[-1.8ex] 
VAR-Between & 0.778 $\pm$ 0.068 & 0.796 $\pm$ 0.068 & --- & --- & --- & ---\\ 
VAR-Closeness & 0.648 $\pm$ 0.024 & 0.926 $\pm$ 0.024 & --- & --- & --- & ---\\ 
VAR-Degree & 0.8 $\pm$ 0.045 & 0.868 $\pm$ 0.053 & --- & --- & --- & ---\\ 
VAR-Eigen & 0.71 $\pm$ 0.063 & 0.864 $\pm$ 0.063 & --- & --- & --- & ---\\ 
\hline \\[-1.8ex] 
DBN-Between & 0.75 $\pm$ 0.036 & 0.825 $\pm$ 0.036 & 0.747 $\pm$ 0.085 & 0.827 $\pm$ 0.085 & 0.721 $\pm$ 0.075 & 0.853 $\pm$ 0.075 \\ 
DBN-Closeness & 0.842 $\pm$ 0.07 & 0.733 $\pm$ 0.07 & 0.827 $\pm$ 0.071 & 0.747 $\pm$ 0.071 & 0.801 $\pm$ 0.114 & 0.773 $\pm$ 0.114 \\ 
DBN-Degree & 0.85 $\pm$ 0.06 & 0.82 $\pm$ 0.05 & 0.834 $\pm$ 0.08 & 0.849 $\pm$ 0.031 & 0.827 $\pm$ 0.092 & 0.879 $\pm$ 0.05 \\ 
DBN-Eigen & 0.752 $\pm$ 0.031 & 0.822 $\pm$ 0.031 & 0.73 $\pm$ 0.081 & 0.845 $\pm$ 0.081 & 0.713 $\pm$ 0.071 & 0.862 $\pm$ 0.071 \\ 
\hline \\[-1.8ex] 
GVAR-Between & 0.729 $\pm$ 0.066 & 0.845 $\pm$ 0.066 & 0.684 $\pm$ 0.078 & 0.891 $\pm$ 0.078 & 0.729 $\pm$ 0.04 & 0.845 $\pm$ 0.04 \\ 
GVAR-Closeness & 0.685 $\pm$ 0.037 & 0.89 $\pm$ 0.037 & 0.632 $\pm$ 0.04 & 0.943 $\pm$ 0.04 & 0.689 $\pm$ 0.062 & 0.885 $\pm$ 0.062 \\ 
GVAR-Degree & $\dagger$ & $\dagger$ & $\dagger$ & $\dagger$  & $\dagger$ & $\dagger$  \\ 
GVAR-Eigen & 0.935 $\pm$ 0.016 & 0.639 $\pm$ 0.016 & 0.953 $\pm$ 0.039 & 0.621 $\pm$ 0.039 & 0.89 $\pm$ 0.04 & 0.685 $\pm$ 0.04 \\ 
\hline \\[-1.8ex] 
\multicolumn{5}{l}{--- indicates retrieved NGC graph is degenerate, e.g., only edges are self-directed.} \\
\multicolumn{5}{l}{$\dagger$ indicates network measure cannot distinguish between nodes, e.g., all in/out degrees are equal.}\\
\end{tabular} 
}
\end{table*}

\begin{figure*}[b]
    \centering
    \includegraphics[width=0.7\textwidth]{images/mlv_population_ts.jpeg}
    \caption{Example Multi-species Lotka-Volterra Population with $d=20$ and $T=1000$. Warm colors refer to the 10 predator species and cool colors refer to the 10 prey species. Each predator hunts 2 prey and each prey is hunted by 2 predators.}
    \label{fig:mlv_population_ts}
\end{figure*}

\subsection{Multispecies Lotka-Volterra - Nonlinear Dynamic Systems} \label{appendix:lotka_volterra}

\begin{table}[ht] \centering 
  \caption{Average NDCG (Accuracy) for Identifying Sink \& Source Nodes with Nonlinear Systems, 5 Rep.} 
  \label{table:nonlinear_source_sink_ndcg} 
\resizebox{0.9\textwidth}{!}{%
\begin{tabular}{@{\extracolsep{0pt}} lcc|cc|cc} 
\\[-1.8ex]\hline 
\hline \\[-1.8ex] 
Multi-species LV & \multicolumn{2}{c}{$d=20$, $T=50$}  & \multicolumn{2}{c}{$d=20$, $T=200$}  & \multicolumn{2}{c}{$d=20$, $T=1000$}\\ 
\hline \\[-1.8ex] 
 & NDCG@20 & NDCG@20  \\ 
Method & Source (Predator) & Sink (Prey) & Source (Predator) & Sink (Prey) & Source (Predator) & Sink (Prey) \\
\hline \\[-1.8ex] 
BSG, $h=1$ & 0.995 $\pm$ 0.004 & 0.865 $\pm$ 0.045 & \textbf{0.973} $\pm$ 0.013 & \textbf{0.939} $\pm$ 0.039 & 0.982 $\pm$ 0.015 & \textbf{0.811} $\pm$ 0.069 \\ 
BSG, $h=5$ & \textbf{0.995} $\pm$ 0.002 & 0.905 $\pm$ 0.046 & 0.945 $\pm$ 0.021 & 0.931 $\pm$ 0.047 
& 0.967 $\pm$ 0.024 & 0.755 $\pm$ 0.035\\ 
BSG, $h=10$ & 0.989 $\pm$ 0.01 & \textbf{0.946} $\pm$ 0.015 & 0.892 $\pm$ 0.058 & 0.907 $\pm$ 0.056 & 0.932 $\pm$ 0.031 & 0.711 $\pm$ 0.074  \\ 
\hline \\[-1.8ex] 
VAR-Between & 0.71 $\pm$ 0.058 & 0.84 $\pm$ 0.058 & 0.721 $\pm$ 0.145 & 0.828 $\pm$ 0.145  & --- & ---\\ 
VAR-Closeness & 0.781 $\pm$ 0.093 & 0.768 $\pm$ 0.093 & 0.78 $\pm$ 0.09 & 0.769 $\pm$ 0.09 & --- & ---\\ 
VAR-Degree & 0.768 $\pm$ 0.091 & 0.748 $\pm$ 0.071 & 0.679 $\pm$ 0.084 & 0.737 $\pm$ 0.077 & --- & ---\\ 
VAR-Eigen & 0.812 $\pm$ 0.087 & 0.738 $\pm$ 0.087 & 0.881 $\pm$ 0.037 & 0.669 $\pm$ 0.037 & --- & ---\\ 
\hline \\[-1.8ex] 
DBN-Between & 0.796 $\pm$ 0.125 & 0.753 $\pm$ 0.125 & 0.808 $\pm$ 0.091 & 0.742 $\pm$ 0.091  & 0.892 $\pm$ 0.107 & 0.657 $\pm$ 0.107 \\ 
DBN-Closeness & 0.796 $\pm$ 0.075 & 0.754 $\pm$ 0.075 & 0.806 $\pm$ 0.074 & 0.743 $\pm$ 0.074 & 0.854 $\pm$ 0.086 & 0.696 $\pm$ 0.086 \\ 
DBN-Degree & 0.801 $\pm$ 0.072 & 0.756 $\pm$ 0.101 & 0.825 $\pm$ 0.093 & 0.724 $\pm$ 0.112 & 0.891 $\pm$ 0.061 & 0.704 $\pm$ 0.072 \\ 
DBN-Eigen & 0.753 $\pm$ 0.086 & 0.797 $\pm$ 0.086 & 0.8 $\pm$ 0.111 & 0.75 $\pm$ 0.111 & 0.797 $\pm$ 0.067 & 0.748 $\pm$ 0.073 \\ 
\hline \\[-1.8ex] 
GVAR-Between & 0.736 $\pm$ 0.077 & 0.814 $\pm$ 0.077 & 0.816 $\pm$ 0.111 & 0.733 $\pm$ 0.111 & 0.741 $\pm$ 0.063 & 0.809 $\pm$ 0.063 \\ 
GVAR-Closeness & 0.744 $\pm$ 0.093 & 0.806 $\pm$ 0.093 & 0.83 $\pm$ 0.114 & 0.72 $\pm$ 0.114 & \textbf{0.996} $\pm$ 0.01 & 0.554 $\pm$ 0.01 \\ 
GVAR-Degree  & $\dagger$ & $\dagger$ & $\dagger$ & $\dagger$  & $\dagger$ & $\dagger$  \\ 
GVAR-Eigen & 0.791 $\pm$ 0.129 & 0.758 $\pm$ 0.129 & 0.746 $\pm$ 0.098 & 0.803 $\pm$ 0.098  & 0.816 $\pm$ 0.077 & 0.734 $\pm$ 0.077 \\ 
\hline \\[-1.8ex] 
\multicolumn{5}{l}{--- indicates retrieved NGC graph is degenerate, e.g., only edges are self-directed.} \\
\multicolumn{5}{l}{$\dagger$ indicates network measure cannot distinguish between nodes, e.g., all in/out degrees are equal.}\\
\end{tabular} 
}
\end{table}

\section{Evaluating Kincade Fire Spillovers} \label{appendix:kincade}
\begin{figure}
    \centering
    \includegraphics[width=0.75\textwidth]{images/diff_PM25.jpeg}
    \caption{Hourly PM 2.5 Concentration (FOD) by County During Kincade Fire - Oct. 22 to Nov. 7, 2019.}
    \label{fig:kincade_daily_ts}
\end{figure}


\begin{figure}
    \centering
    \includegraphics[width=0.75\textwidth]{images/county_ranking_pm25.jpeg}
    \caption{County Ranking by BSG Importance and Vulnerability Scores, $h=12$.}
    \label{fig:kincade_ranking}
\end{figure}

\begin{figure}[htbp]
  \centering
  \begin{minipage}[b]{0.33\textwidth}
    \includegraphics[width=\textwidth]{images/kincade_bsg_lower.png}
  \end{minipage}
  \hfill
    \begin{minipage}[b]{0.33\textwidth}
     \includegraphics[width=\textwidth]{images/kincade_full_snorm_graph2.png}
   \end{minipage}
   \hfill
  \begin{minipage}[b]{0.33\textwidth}
    \includegraphics[width=\textwidth]{images/kincade_bsg_upper.png}
  \end{minipage}
      \caption{From left to right: Lower 95\% HPDI Bound, Posterior Mean, and Upper 95\% HPDI Bound. BSG for Kincade Fire, $h$=12 hours ahead. Note the strong variability in spillovers (edge weights) originating from Sonoma County and tighter intervals for indirect spillovers between San Francisco, Contra Costa, and Alameda counties.}
      \label{fig:kincade_bsg_hpdi}
\end{figure}

%\clearpage
\FloatBarrier
\bibliography{deng_594}
\end{document}