Simulation given conditional distribution I have a question regarding conditional distributions and simulation.
Assume you have a random vector of dimension $n$ with distribution $\pmb{Z}\sim N_n(0,\Sigma)$ where $\Sigma_{ii} = 1$, so each component is such that $Z_i \sim N(0,1)$. Now, we have another variables $X_i$ such that $X_i = f(Z_i) \sim Ber(p_i(Z_i))$. So, to simulate each $X_i$ what I did was simulate the vector $\pmb{Z}$ and use the fact that I know the distribution of $X_i | Z_i$.
My question is, why can't I simulate directly from the marginal of each $Z_i$? This is, simulate $Z_i = z$ from the standard normal, then simulate $X_i|Z_i$. Is the conditioning actually on the whole vector?
Finally, if I want to calculate the marginal distribution of $X_i$, can I use the law of total probability conditioning only on $Z_i$ or do I need to condition on the whole vector? This is, is it correct to calculate
$$
f_{X_i}(x) = \int_{\mathbb{R}} f_{X_i|Z_i}(x|z)f_{Z_i}(z)dz
$$
EDIT:
My question is more abstract than what I explained here. Basically, assume $X_i = f(Y_i)$, and also $Y_i$ is part of a vector $\pmb{Y}$. If I want to find the unconditional distribution of $X_i$, do I have to use $X_i |\pmb{Y}$ or can I use only $X_i|Y_i$ given that $X_i$ depends only on $Y_i$, even though $Y_i$ is related to the other components of $\pmb{Y}$.

You do not have to consider all of the individual random variables in $Z$ and only need to consider $Z_i$ as you define the distribution of the conditional random variable $X_i|Z_i$ in terms of $Z_i$:  $X_i|Z_i=z_i \sim \text{Bernoulli}(p_i(z_i))$.
I'm going to drop the subscripts as those are not necessary.  The resulting marginal distribution of $X$ is $\text{Bernoulli}(q)$ where $q$ is the mean of $p(Z)$.  In other words, however you define $p(Z)$, the marginal of $X$ will only depend on the mean of $p(Z)$.
In one of your other questions (https://math.stackexchange.com/questions/4513934/solve-integral-of-phiabxk1-phiabxn-k-phix) you define $p(Z)=\Phi(a+b Z)$.  The mean of $p(Z)$ is given by
$$\int_{-\infty}^\infty \Phi(a+b z)\frac{e^{-z^2/2}}{\sqrt{2\pi}}dz=\Phi\left(\frac{a}{\sqrt{1+b^2}}\right)$$
So the marginal distribution of $X_i$ is a Bernoulli distribution with parameter $\Phi\left(\frac{a}{\sqrt{1+b^2}}\right)$.
