2
$\begingroup$

I want to generate a categorical random variable conditioned on other variables, for example, generate $X$ from $Y$ by $P(X|Y)$, or generate $X$ from $Y_1,Y_2$ by $P(X|Y_1,Y_2)$.

Here, $P(X|Y)$ represents a conditional probability matrix, where value of the $i$-th row and $j$-th column $[P(X|Y)]_{ij}$ is the conditional probability $Pr(X=x_i|Y=y_i)$.

My questions are:

  • Having know the levels of $X$ and $Y$, how to simulate many different conditional probability matrices $P(X|Y)$?
  • Can we manage to control the correlation between $X$ and $Y$ (strong or rather weak) when simulating these conditional probability matrices?
  • Extending the above questions to scenarios with more than one conditioned variables, say, simulating a matrix $P(X|Y_1,Y_2,...,Y_n)$, can we manage to control the correlation between $X$ and $Y_1,Y_2,...,Y_n$, respectively?
$\endgroup$
1
  • $\begingroup$ For those who are interested, one can control the columns to be `more different or same' via controlling the temperature parameter in the gumbel-softmax distribution. $\endgroup$ Apr 3, 2023 at 6:12

1 Answer 1

0
$\begingroup$

I presume that you wanted your definition to be: $$ [P(X|Y)]_{ij} = Pr(X=x_i| Y = y_j). $$

Your first question:
You can simulate such matrices by just randomly assigning nonnegative values to the matrix cells such that the columns sum to one.

Your second question:
If the columns are all the same, i.e. $Pr(x_i|y_j)$ is independent of $j$, then $Pr(x_i|y_j)=Pr(x_i)$, which is the definition of independence, so the more the columns differ, the more you deviate from independence.

Your third question: Just consider $\mathbf Y = (Y_1,\ldots, Y_n)$ as a single random variable with its values being all possible combinations of levels of the $Y_i$, and you have the same task as above.

$\endgroup$
1
  • $\begingroup$ How can I control the columns to be more 'different or same'? Could you provide some specific methods/algorithm? $\endgroup$ Jul 15, 2022 at 7:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.