1
$\begingroup$

Say I have multiple (independent) categorically distributed random variables: $X_1, X_2, \ldots, X_k$, which all range from $0,1,2,\ldots,N$, and with each coming from distributions with different probability vectors: $\vec{p}_1, \vec{p}_2, \ldots, \vec{p}_k$. I can sample these easily with numpy.

Now I want to apply the constraint that the sum of these variables is fixed: $\sum_{i=1}^k X_i = N$. How would I go about sampling the $X_i$s given this constraint? I'd like to avoid the naive solution of sampling as above and then throwing out the samples which don't satisfy the constraint.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.