# randomized Neyman-Pearson lemma for a discrete distribution

We let $$\Theta=\{0,1\}$$, and $$X$$ be a discrete R.V with the following probability distribution:

x 1 2 3 4 5 6 7 8
$$f(x;0)$$ 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.86
$$f(x;1)$$ 0.14 0.12 0.10 0.08 0.06 0.04 0.02 0.44
Ratio 7 6 5 4 3 2 1 0.511

We want to use the theorem of Neyman-Pearson to find the most powerful test of size $$\alpha=0.05$$ for the hypothesis $$H_0: \theta=0$$ and $$H_1: \theta=1$$, and also I want to calculate the Type II error probability of this test(power?).

I have looked at some similar questions(Neyman pearson on discrete distribution and Most powerful test for deciding probability mass function), however I'm still struggling to understand what to do in this case, especially since I need an exact value, so the test has to be randomized. Any help is much appreciated!

You want high probability of rejection of $$H_0$$ when $$H_1$$ is true, which would lead to the choice of values of $$x$$ with high values of $$f(x;1)$$. On the other hand, every time you include a value $$x$$ in your critical region you increase the power of your test by $$f(x;1)$$ but also the probability of unduly rejecting $$H_0$$ by $$f(x;0)$$. You want maximum power, but not exceeding your pre-assigned "budget" of Type I error of $$\alpha=0.05$$.
If you were buying potatos in a market, you would take first the offers of those which give you the most potatos per unit of money. Similarly here, you would pick for your critical region those values of $$x$$ which give you the maximum ratio $$f(x;1)/f(x;0)$$ (conveniently calculated for you in the last row).
Here, that would lead to picking $$\{1,2\}$$ for a total expense of 0.04. Adding $$x=3$$ to these would exceed your budget, so you add only "one half" of $$x=3$$, by playing a lottery which rejects the null hypothesis one half of the time when you observe $$x=3$$. With this device, your total probability of unduly rejecting $$H_0$$ will be $$\alpha=0.05$$ as required.