# Re: st: truncation problem with an exponential : way around?

 From László Sándor <[email protected]> To [email protected] Subject Re: st: truncation problem with an exponential : way around? Date Thu, 28 Jan 2010 13:41:33 -0500

```Thanks, Maarten, this helps!

Actually one term would still overflow or underflow for me (this is
the right name, truncation is something else), but a simple "if, else
if, else" construction solves the problem for very high or very low
values of the index.

Sorry I was so surprised not to even think it through myself.

Thanks again,

Laszlo

On Thu, Jan 28, 2010 at 1:17 PM, Maarten buis <[email protected]> wrote:
>
> --- On Thu, 28/1/10, László Sándor wrote:
> > I ran into a standard problem when coding up an estimator :
> > at a point to use simply Bayes' rule, I thought I'd
> > calculate proper likelihood from log-likelihood. This broke
> > down very fast for any test runs, and now I know why : the
> > number got that big that it became meaningless on a computer.
> >
> > If I want to keep my code general, so I cannot simply rescale
> > this or that variable, what else could I do? What is the
> > normal way out?
>
> The standard way is to keep working on the log-likelihood scale,
> so, for example, you would transform Bayes theorem as below:
>
> p(a|b) = p(b|a) p(a)/p(b)
> ln[p(a|b)] = ln[p(b|a) p(a)/p(b)]
> ln[p(a|b)] = ln[p(b|a)] + ln[p(a)] - ln[p(b)]
>
> Hope this helps,
> Maarten
>
> --------------------------
> Maarten L. Buis
> Institut fuer Soziologie
> Universitaet Tuebingen
> Wilhelmstrasse 36
> 72074 Tuebingen
> Germany
>
> http://www.maartenbuis.nl
> --------------------------
>
>
>
>
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```