0

I have a large vector of likelihoods all in the range (0 to 1) but all numbers are quite a bit less than 1. I need to compute the maximum likelihood of the product of these vectors.

How can I avoid underflow, my fitter is failing in all my attempts. The first step I took was to divide my array by the max value in my array. I am maximizing the product of the sum of two probabilities sampled n times, Ultimately I need to minimize as per the BIC:

BIC = -2. * ln(L) + 5n_theta(nz)

Anyways L is an array of really small numbers of the form

L = product of ([(p(z1|a) + p(z1|b)), (p(z2|a) + p(z2|b)), ...., (p(zn|a) + p(zn|b))])

Here is an example with two parameters a and b that I vary and the array has size n and each p is < 1.

wedi
  • 1,332
  • 1
  • 13
  • 28
Canuck
  • 567
  • 1
  • 7
  • 15

1 Answers1

0

Have you considered working in log-likelihood?

L = (p1 * p2 * p3) ** N becomes ln(L) = N * (ln(p1) + ln(p2) + ln(p3)) Which will be much more resistant to numerical precision problems.

And then you can directly use ln(L) in your -2.0 * ln(L) + 5n_theta(nz)

Jacob Panikulam
  • 1,196
  • 1
  • 9
  • 12
  • Hello, I realized how poorly I had explained my question and I have largely edited it. – Canuck Apr 21 '17 at 00:56
  • I have tried something similar but I believe I may have implemented it incorrectly, thanks for your help I will review – Canuck Apr 21 '17 at 01:02