I am trying to write the code of a Bernoulli block mixture model in matlab, but am facing an error every time I run the function. In particular, I'm having a problem with how to relate the distribution parameter $\alpha$ to the latent variables $Z$ and $W$.
In other words, \mathbf{Z} follows a multinomial distribution of parameter $\pi$, such that $\dim(\pi)=(1, g)$, where $g$ is the number of clusters of rows and $\sum \pi=1$.
$W$ follows a multinomial distribution of parameter $\rho$ such that $\dim(\rho)=(1,m)$, where $m$ is the number of column clusters and $\sum \rho=1$.
$\mathbf{Z}$ is a matrix of $\dim(N,g)$, and $\mathbf{W}$ is a matrix of $\dim(d,m)$, where $N$ is the number of observations, $p$ is the number of variables, $g$ is the number of row clusters, and $m$ is the number of column clusters.
$X$ follows a bernoulli distribution of parameter $\alpha_{ZW}$, where the notation $\alpha_{ZW}$ denotes the values of $\alpha$ depends on $\mathbf{Z}$ and $\mathbf{W}$, and $\alpha$ is a $\dim(g,m)$ matrix. Please find attached a graphical representation of the model.
How do I write the code of $\alpha_{ZW}$ in order to get generate the model?
