"Some of the observed values are associated with a non-finite logp"

Hi All,

I’ve been working on a model which was working fine on one dataset, but another dataset is triggering the error "Some of the observed values of variable y are associated with a non-finite logp".

My model is as follows:

y belongs to a Binomial distribution and the observed values are all positive integers. I’m having a hard time understanding the error, but context clues had me looking for negative integers in the observed $y$s but I couldn’t find any.

Any help would be greatly appreciated, I’ve been banging my head over this one.

I’ve included a link to a Google Colab notebook that replicates the problem. Here is a truncated version of the error:


The variable y has the following parameters:
0: [ 800 2032 ... 1500  909] [id A] <Vector(int32, shape=(480,))>
1: AdvancedSubtensor1 [id B] <Vector(float64, shape=(?,))>
 ├─ beta [id C] <Vector(float64, shape=(1435,))>
 └─ [   1    1 ... 1426 1434] [id D] <Vector(uint16, shape=(480,))>
The parameters evaluate to:
0: [ 800 2032  957 1994 1498 3108 2000 1600 1554 1206 2117 2134 1200 1987
 1964 3094 1881 2163 1200 1518 1028 2128 1200 2070 1200 2100 1904 2076
 2204 2150 1200 1200 1200 3000 4037 2274 1200 2394 3031 1947 1510 2309
 1200 2150 1013 2445 1200 2108 1200 1502 2835 2108 1200 1556 1200 1200
 2207 1200 4755 2234 1200 1853 2259 1200 2183 1200 1558 1522 1489 2140
 1200 1492 2270 1200 1200 1000 2436 1200 1975 2425 1200 2302 2389 1200
 2153 2496 2333 1200 1523 1500 2168 1200 1272 1929 2124 2449 1200 1520
 2087 1200 2087 1200 1935 1200 1200 1598 1935 1200 2154 1935 1200 1622
 1200 2562 1200 1517 1001 2000 1546 1876 1000 2094 3236 1000  902 2102
 4549 1534 1000 1182 1535 1001 2152 1512 1000 2365 1000 1422 1000 2463
 1804 1733 1115 1536 1000 1186 1000 1500 1000 1896 2361 1000  948 2515
 1000 3092 2651 1194 1000 1512 1539 1000 2491 1000 1528 1003 1000 2735
 4698 1633 1000 1691 1500 1000 1000 1000 1000 1471 1525 4015 1000 1000
 1595 1522 1000 1000 2527 1634 2035 1000 1000 1002 8501 5807 1000 1490
 1513 1000  900 1893  900  900 1000  900  900  900 2122 1000 1500 1000
 1301 2374 1009 1000 1529 1002 1000 2500 1590 1000 2500 1000 1000 2451
 7941 1000 1000 2700 1000 1000 1000 2000 1000 1494 2001 1000 1000 1541
 1000 1521 1000 2490 1500 2512 1000 7961 1000 1000 1000 1000 1226 2001
 1000 2410 1000 1000 1002 2000 5769 1486 1000 1000 1000 1000 1000 1500
 1000 1777 1000 1000 1000 1302 2000 1000 9384 1000 1000 1000 1002 1000
 1000 1579 1001 1000 1023 1000 1000  969 1000 1000 1484 2327 1000 2103
 1000 1000 1907 1000 1585 1000 9401 1000 1000 1000 1003 1000 1000 5423
 1000 1536 4023 1000 1001  941 1000 1000 2227 1000 1000 1411 1000 1408
 1000 1000 1887 9830 1000 1000 1000 1000 1284 2098 1000 1000 1609 1000
 1000 1500 1000 2616 1281 1000 1000 1005 1001 1534 1500 1000 2000 1000
 1492 2002 1000 1477 4839 1000 1001 1000 1000 1350 1770 1000 1512 1000
 2000 1000 1000 1150 1000 1000 1000 1000 2036 1000 1540 1000 1000 1000
 5658 1000 2767 5406 1000 1483 1000 1958 2800 1000 1000 1529 2800 1969
 1182 1000 1000 1000 1479 1000 1000 1970 1000 1000 1001 1000 1029 2029
 1000 1000 1886 1000 1340 1000 1500 1000 1000 1457 1000 1000 1000 1332
 1000 1000 1000 1000 1000 1000 1848 1000 1304 1000 1000 1949 1000 2200
 1000 1474 5066 1000 1000 1000 1622 1000 1437 1498 1000 1000 1326 5250
 1370 1535 2010 1345 1003 1429 1500 2271 2371 1002 2000 1517 4998 1000
 5012 1176 1500 1455 2456 2019 1500 1500 1567 1406 1524 2598 4937 1500
 1956 1369 1500  909]
1: [0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33
 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33
 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33
 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33
 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33
 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33
 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33
 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33
 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33
 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33
 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33
 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33
 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33
 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33
 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33
 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33
 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33
 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33
 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33
 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33
 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33
 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33
 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33
 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33
 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33
 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33
 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33
 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33
 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33
 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33
 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33
 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33
 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33
 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33 0.33
 0.33 0.33 0.33 0.33]
Some of the observed values of variable y are associated with a non-finite logp:
 value = 26000 -> logp = -inf
 value = 65430 -> logp = -inf
 value = 29667 -> logp = -inf
 value = 59820 -> logp = -inf
 value = 46887 -> logp = -inf
 value = 102564 -> logp = -inf
 value = 64000 -> logp = -inf

Could your observed values be larger than n?

1 Like

Of course! It would have taken me years to figure that one out. Thanks so much!

1 Like