1
$\begingroup$

I am trying to implement a particle filter to track multiple objects. During the propagation phase I need to take N samples from a three dimensional probability distribution, which does not fit known distribution types. In a 1D distribution I would just create the cumulative distribution function, invert it and take random samples from that - can I do something similar with higher dimensional distributions?

I am implementing in Java by the way, so just giving me an R function is not going to help me too much.

$\endgroup$
  • $\begingroup$ Does it have countably finite number of possible values for each dimension? $\endgroup$ – Tim May 8 '17 at 8:23
  • $\begingroup$ Yes, in fact it is limited to quite a manageable 240x180x90 cases. $\endgroup$ – Mr Squid May 8 '17 at 8:24
1
$\begingroup$

Your distribution takes form of large $I \times J \times K$ table with values mapped to probabilities

$$ \Pr(X = x, Y = y, Z = z) = p_{ijk} $$

instead of thinking of it as of a 3-dimensional object, think of it as of a table, i.e.

X  Y  Z  Pr
x1 y1 z1 p111
x1 y1 z2 p112
...
xI yJ zK pIJK

now to draw samples from it you need only to sample rows of such table with probabilities equal to $p_{ijk}$, so you just need an algorithm for sampling from univariate categorical distribution!

$\endgroup$
  • $\begingroup$ Thanks a lot, that makes a lot of sense but somehow I didn't think of it. Thanks! $\endgroup$ – Mr Squid May 8 '17 at 23:34

Your Answer

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

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