 - \tilde{p}_{kk'})]. \notag
\end{align}
Marginalizing out $r_k$ using the gamma-Poisson conjugacy, we have
\begin{align}
l_{k\cdot} & \sim \mathrm{NB}({\gamma_0}/{K}, \hat{p}_{k}), \notag
\end{align}
where $\hat{p}_{k} = \frac{\sum_{k'}\xi^{\delta_{kk'}}r_{k'}^{1-\delta_{kk'}}\log(1 - \tilde{p}_{kk'})}{c_0 -\sum_{k'}\xi^{\delta_{kk'}}r_{k'}^{1-\delta_{kk'}}\log(1 - \tilde{p}_{kk'})}$. We introduce the auxiliary variables $\tilde{l}_k\sim\mathrm{CRT}(l_{k\cdot}, \gamma_0/K)$ and re-express the bivariate distribution over $l_{k\cdot}$ and $\tilde{l}_k$ as
\begin{align}
l_{k\cdot} & \sim \mathrm{SumLog}(\tilde{l}_k, \hat{p}_k), \notag\\
\tilde{l}_k&\sim\mathrm{Po}\Big[-\frac{\gamma_0}{K}\log(1- \hat{p}_k)\Big] \label{eq_lkt}.
\end{align}
Using Eq.~(\ref{eq_lkt}), we can then sample $\gamma_0$ via the gamma-Poisson conjugacy as
\begin{align}
(\gamma_0 \mid -) &\sim \mathrm{Gam}\Big[1 + \sum_k \tilde{l}_k, \frac{1}{1 - \frac{1}{K}\sum_k\log(1- \hat{p}_k) }\Big].\label{eq_gam0}
\end{align}

\noindent\textbf{Sampling latent memberships $\phi_{nk}^{(t)}$.}
Since the latent memberships $\phi_{nk}^{(t)}$ evolve over time according to our Markovian construction, the backward and forward information need to be incorporated into the updates of $\phi_{nk}^{(t)}$.
We start from time slice $t=T$, 
\begin{align}\label{}
x_{nk\cdot\cdot}^{(T)} &\sim \mathrm{Po}(\phi_{nk}^{(T)}\omega_{nk}^{(T)}), \qquad \phi_{nk}^{(T)} \sim \mathrm{Gam}(\phi_{nk}^{(T-1)}/\tau, {1}/{\tau}),\notag
\end{align}
where
\begin{align}\label{}
x_{nk\cdot\cdot}^{(t)} & \equiv \sum_{\substack{m\neq n},k'} x_{mkk'n}^{(t)}, \qquad \omega_{nk}^{(t)} &\equiv \sum_{m\neq n, k'}\phi_{mk'}^{(t)}\lambda_{kk'}. \notag
\end{align}
Via the gamma-Poisson conjugacy, we have
\begin{align}\label{}
(\phi_{nk}^{(T)} \mid -) &\sim \mathrm{Gam}\Big[\phi_{nk}^{(T-1)}/\tau + x_{nk\cdot\cdot}^{(T)}, {1}/({\tau + \omega_{nk}^{(T)}})\Big].
\end{align}
Marginalizing out $\phi_{nk}^{(T)}$ yields
\begin{align}\label{}
x_{nk\cdot\cdot}^{(T)} &\sim \mathrm{NB}(\phi_{nk}^{(T-1)}/\tau, \varrho_{nk}^{(T)}),
\end{align}
where $\varrho_{nk}^{(T)} = \frac{\omega_{nk}^{(T)}}{\tau + \omega_{nk}^{(T)}}$.
According to Result~2, the NB distribution can be augmented with an auxiliary variable as
\begin{align}\label{}
y_{nk}^{(T)} &\sim \mathrm{CRT}(x_{nk\cdot\cdot}^{(T)}, \phi_{nk}^{(T-1)}/\tau).
\end{align}
We re-express the bivariate distribution over $x_{nk\cdot\cdot}^{(T)}$ and $y_{nk}^{(T)}$ as
\begin{align}
x_{nk\cdot\cdot}^{(T)} &\sim \mathrm{SumLog}(y_{nk}^{(T)}, \varrho_{nk}^{(T)}), \notag\\
y_{nk}^{(T)} &\sim \mathrm{Po}\Big[-\frac{\phi_{nk}^{(T-1)}}{\tau}\log(1 - \varrho_{nk}^{(T)})\Big]. \label{eq:y_nk_pois}
\end{align}
where 
\begin{align}
\varrho_{nk}^{(t)} = \frac{\omega_{nk}^{(t)} - \frac{1}{\tau}\log(1-\varrho_{nk}^{(t+1)})}{\tau + \omega_{nk}^{(t)} - \frac{1}{\tau}\log(1-\varrho_{nk}^{(t+1)})}.\label{eq:varrho}
\end{align}
Given $x_{nk\cdot\cdot}^{(T-1)}\sim\mathrm{Po}(\phi_{nk}^{(T-1)}\omega_{nk}^{(T-1)})$, via the Poisson additive property, we have
\begin{align}
y_{nk}^{(T)} + x_{nk\cdot\cdot}^{(T-1)} &\sim \mathrm{Po}\Big(\phi_{nk}^{(T-1)} \Big[ \omega_{nk}^{(T-1)}- \frac{1}{\tau}{\log(1 - \varrho_{nk}^{(T)})} \Big] \Big). \label{eq:backward}
\end{align}
Combing the likelihood in Eq.~(\ref{eq:backward}) with the gamma prior placed on $\phi_{nk}^{(T-1)}$, we immediately have the conditional distribution of $\phi_{nk}^{(T-1)}$ via the gamma-Poisson conjugacy as
\begin{align}\label{}
(\phi_{nk}^{(T-1)}|-) &\sim \mathrm{Gam}\Big[\phi_{nk}^{(T-2)}/\tau + y_{nk}^{(T)} + x_{nk\cdot\cdot}^{(T-1)}, \\ &\frac{1}{\tau + \omega_{nk}^{(T-1)} - \frac{1}{\tau}\log(1-\varrho_{nk}^{(T)})}\Big]. \notag
\end{align}
Here, $y_{nk}^{(T)}$ can be considered as the \emph{backward} information passed from $t = T$ to $T-1$. 
Recursively, we augment $\phi_{nk}^{(t)}$ at each time slice with an auxiliary variable $y_{nk}^{(t)}$  as
\begin{align}
y_{nk}^{(t+1)} + x_{nk\cdot\cdot}^{(t)} &\sim \mathrm{NB}(\phi_{nk}^{(t-1)}/\tau, \varrho_{nk}^{(t)}), \notag\\
y_{nk}^{(t)} &\sim \mathrm{CRT}(x_{nk\cdot\cdot}^{(t)} + y_{nk}^{(t+1)}, \phi_{nk}^{(t-1)}/\tau), \label{eq:y}
\end{align}
where the NB distribution over $y_{nk}^{(t+1)} + x_{nk\cdot\cdot}^{(t)}$ is obtained via the Poisson additive property and gamma-Poisson conjugacy with $x_{nk\cdot\cdot}^{(t)} \sim \mathrm{Po}(\phi_{nk}^{(t)}\omega_{nk}^{(t)})$. Repeatedly using Result~2, we have
\begin{align}
y_{nk}^{(t+1)} + x_{nk\cdot\cdot}^{(t)} &\sim \mathrm{SumLog}(y_{nk}^{(t)}, \varrho_{nk}^{(t)}), \notag\\
y_{nk}^{(t)} &\sim \mathrm{Po}\Big[-\frac{\phi_{nk}^{(t-1)}}{\tau}\log(1 - \varrho_{nk}^{(t)})\Big]. \notag
\end{align}
 By repeatedly exploiting the Poisson additive property and gamma-Poisson conjugacy, we obtain
\begin{align}
(\phi_{nk}^{(t-1)} \mid -) \sim \mathrm{Gam}&\Big[y_{nk}^{(t)} + \phi_{nk}^{(t-2)}/\tau + x_{nk\cdot\cdot}^{(t-1)}, \label{eq:phi}\\
& \frac{1}{\tau + \omega_{nk}^{(t-1)} - \frac{1}{\tau}\log(1-\varrho_{nk}^{(t)})}\Big]. \notag
\end{align}
We sample the auxiliary variables $y_{nk}^{(t)}$ and update $\varrho_{nk}^{(t)}$ recursively from $t=T$ to $t=1$, which can be considered as the \emph{backward filtering} step. Then, in the \emph{forward} pass we sample $\phi_{nk}^{(t)}$ from $t = 1$ to $t=T$. 
\\
\noindent\textbf{Sampling hyperparameters.}
Via the gamma-gamma conjugacy, we sample $c