# Solved – Sampling from the conditional distribution assuming sampling from the joint

I am struggling with this question, which I thought it should be easy: suppose we have a method of sampling from the joint distribution of a collection of (discrete ordinal) random variables. We do not know the density. We need to find a way to sample from the conditional distribution of a subset of them, \$X_i\$, given specific values for the others, \$Y_i = y_i\$. Since they are discrete I thought of generating a very large sample from the joint and keep only those where \$Y_i =y_i\$. I am not sure if this makes sense and it also looks potentially extremely inefficient. Is there any other way to do this?

Contents

1) The method of sampling the joint and then looking at the sampling distribution of $$X$$ from the pairs where $$Y=y_i$$ will give you samples from the conditional distribution ($$p(X|Y=y_i)$$), no problem there.

2) there are a number of ways of generating conditionals but you usually need to know (at least!) their joint probability function or some other things you don't appear to know (the conditioning in the opposite direction plus the marginals for example).

Please note that for discrete variables, it's common not to call the probability function a density; that term more often applies to continuous random variables.

Rate this post