# Realizations of alternative configurations

Consider a discrete distribution $$P(\mathbf{X},Y)$$ with $$X = \{ X_1, \dots, X_N \}$$. I use the shorthand notation $$p(\mathbf{x}, y)$$ for $$P(\mathbf{X}{=}\mathbf{x}, Y{=}y)$$. Consider $$P_{ind}(\mathbf{X},Y)$$ defined as $$p_{ind}(\mathbf{x}, y) = p_{ind}(\mathbf{x} \vert y) p(y)$$ where $$p_{ind}(\mathbf{x} \vert y) := \prod_{n=1}^N p(x_n \vert y)$$ Is there a way to generate a random variable $$\mathbf{X}'$$ through some (deterministic or non-deterministic) transformation of $$\mathbf{X}$$ such that $$P(\mathbf{X}', Y) = P_{ind}(\mathbf{X},Y)$$?

• Are you satisfied with the answer below? Aug 4 at 14:32

You want to simulate the joint discrete distribution of $$(X_1,\dots,X_N,Y)$$, knowing the following: (i) $$X_1,\dots,X_N$$ are conditionally independent and identically distributed given $$Y$$, (ii) the probability mass function (pmf) $$p_Y$$ of $$Y$$, and (iii) the conditional pmf's $$p_{X|Y}$$ of each $$X_n$$ given $$Y$$. This simulation is done in a straightforward manner.
Indeed, let $$y_1,y_2,\dots$$ be the distinct possible values of $$Y$$ and let $$x_1,x_2,\dots$$ be the distinct possible values of each $$X_n$$. For $$m=0,1,\dots$$, $$k=0,1,\dots$$, and $$j=1,2,\dots$$, let $$t_m:=\sum_{j=1}^m p_Y(y_j),\quad s_{k|j}:=\sum_{i=1}^k p_{X|Y}(x_i|y_j),$$ so that $$t_0=0$$ and $$s_{0|j}=0$$ for all $$j$$.
Let $$U_1,\dots,U_N,V$$ be independent random variables (r.v.'s) each uniformly distributed on $$[0,1)$$. Define the r.v.'s $$X'_1,\dots,X'_N,Y'$$ as follows: for any $$m=1,2,\dots$$, $$k=1,2,\dots$$, and $$n=1,\dots,N$$, $$Y':=y_m\quad\text{if}\quad V\in[t_{m-1},t_m),$$ $$X'_n:=x_k\quad\text{if}\quad Y'=y_m\ \text{and}\ U_n\in[s_{k-1|m},s_{k|m}).$$
Then the joint distribution of $$(X'_1,\dots,X'_N,Y')$$ will be the same as that of $$(X_1,\dots,X_N,Y)$$.