Dealing with zero cells in the psi frequency test In Jayne's "Theory of Probability" book, he proposes the psi test of frequency as opposed to the more common chi-squared test. He demonstrates how the test deals better with low-expected value cells more gracefully than the chi-squared test. However, he does not directly explain how to deal with zero cells.
Psi is caluculated as the following:
10*sum(nk*log10(nk/n*pk))


However, as it contains the log10 of the ratio, in zero cells, that resolves to undefined.
He poses an example which includes a zero cell, but doesn't demonstrate the steps to solve it, and my attempts at differetn variations do not get quite the same results as he describes.
His starts with the following example, which contains no zeroes:
flip a coin 29 times. The results are 14 heads and 14 tails, and 1 edge. Your prior hypothesis is that a coin will land on heads with frequency 0.499, tails 0.499, and on edge 0.002.
He compares this to a naive hypothesis of 1/3 for each possible outcome.
He demonstrates how to calculate both of these:
10*(14*log10(14/(29*.499)) + 14*log10(14/(29*.499)) + 1*(log10(1/(29*.002))))

and resolves it to 8.34.
The naive hypothesis is as follows:
10*(14*(log10(14*3/(29))) + 14*(log10(14*3/(29))) + 1*(log10(1*3/(29))))

and resolves it to 35.19.
However, he then follows up by altering the sitation to see what would happen under either hypothesis if the edge result had instead been another heads. He does not demonstrate how to solve this, but shows the results:
0.30 and 51.2, respectively.
I have been unable to replicate those exact values. If I assume that zero cells just zero out/are not included, I get 0.33 and 51.3, which are both close, but not identical, and futzing with various rounding and truncating rules hasn't resulted in both of those (although I can find different rounding/truncating rules to get one or the other).
Any help on how to use the psi test with zero cells would be greatly appreciated.


Any help on how to use the psi test with zero cells would be greatly appreciated.

The problem is that you are trying to evaluate the function
$$
x\log(x/y)
$$
at $x=0$ with $y$ fixed.
The first term (the linear term in x) goes to zero linearly (obviously). The second term (the log term) goes to negative infinity, but very slowly.
You can not evaluate exactly at zero, since you can not make sense of a multiplication like:
$$
0\times log(0) = 0 \times -\infty
$$
But, you can sensibly evaluate the limit as $x$ goes to zero from above:
$$
\lim_{x\to 0^+} x\log(x/y)
$$
And, the result is zero.
So, the bottom line is that it is correct to just "drop" the terms with $n_i=0$.
Regarding the differences in numerical results between your calculation and the one in the text, I think the text is wrong. You might want to look at this errata page for Jaynes' textbook. If you do not find this listed in the errata sheet, I suggest you submit it as a new potential error for the errata sheet. But, before you do, maybe check your calculation again; the numbers I am calculating are slightly different from yours. I calculate approximately 0.33 and approximately 51.1 (not 51.3, as your wrote in your question).
