I have to take draws from the discrete posterior distribution:
$ P(X = x_i |y) \propto P(X = x_i)\prod_{t}^N p(Y_t|X)$
where $P(X = x )$ is the probability mass function of a discrete uniform with boundaries $a$ and $b$ and $p(Y_t|x)$ is the pdf of a student-t with $X$ degrees of freedom.
In MATLAB my problem is that for my realizations $Y_t = y_t$ when I evaluate the product of the student-t pdfs, namely $\prod_{t}^N p(y_t|X = x_i)$ I get zeros because of numerical problems. I took logarithms and calculated what follows:
$ exp\left[log(P(X = x_i |y))\right] \propto exp\left[ log(P(X = x_i)) + \sum_{t}^N log(p(y_t|X=x_i))\right] $
But same problem since when I compute the exponential function I get all zeros. I have tried then to subtract the maximum of value of the $\sum_i^N log(p(y_t|X = x_i))$ but again I have numerical problems with the exponent.
What can I do?
N.B: In general I am trying to take draws from equation (7) in