I have a measurement with two possible outcomes, let's say 0 and 1. If the outcome of the measurement is 1, the true value is always 1. If the outcome of the measurement is 0, there is a chance of 1% that the outcome of the measurement is false and the true value is 1 (and 99% that the outcome of the measurement was correct). For a sample of $n$ measurements, I want to test if the ratio of 1s, which we call $p$ is less than 0.05 with a significance level of $\alpha = 0.05$. First,let us assume that we ignore the measurement error. We can calculate if $$\sum_{i=0}^c B(i|p_0,n)\leq \alpha$$ where $c$ is the number of 1s measured and $p_0=0.05.$ So for 59 measurements where the outcome of all the measurements is 0, it is possible to conclude with a significance level of 0.05 that the probability for 1s is less than 0.05.
I had two ideas to include the measurement error, but these give different results:
For the $n-c$ measurements with the outcome 0 we know that $B(l|0.01,n-c)$ is the probability for $l$ undetected 1s and therefore the probability for $c+l$ 1s. So $$\sum_{i=0}^{n-c} B(i|0.01,n-c) \sum_{j=0}^{c+l}B(j|p_0,n)$$ should be the probability for at most $c$ measured 1s under the assumption that $p=p_0$. Therefore, if this is less than $\alpha$ we conclude $p\leq p_0$.
We do the test as if we ignore the mesurement error but with $p_0=0.0404$. In this case we know that the posibility of measuring a 1 is less than 0.0404 and the posibility of a measurements true value beinig a 1 is less than $$0.0404+(1-0.0404)*0.01 \approx 0.05.$$
But both ways lead to different results. For example when we have $n=74$ measurements where all the outcomes are 0s with the secound way we can conclude (with the significance $\alpha = 0.05$) that at most a ratio of 0.05 are 1s and with the first way we cannot. So at least one of them needs to be false, but which one?