# Poisson binomial distribution hypothesis test

Let $$X_i$$, $$i=1, \dots, n$$, be independent non-identically distributed random variables with Bernoulli distributions with unknown probability of successes $$p_i$$, $$i=1, \dotsc, n$$. Then $$Y:=\sum_{i=1}^n X_i$$ has Poisson binomial distribution.

Let $$p_i^0 \in (0,1)$$, $$i=1, \dots, n$$, be some known real numbers and let

$$p:=\frac{1}{n}\sum_{i=1}^n p_i$$,

$$p^0:=\frac{1}{n}\sum_{i=1}^n p_i^0$$.

How do I test a hypothesis:

$$\text{H}_0: p=p^0$$ vs. $$\text{H}_1: p \neq p^0$$?

Similarly, how to test one sided hypothesises?

Do you have a context for this problem, any additional information? As there is $$n$$ (unrelated) parameters $$p_1, p_2, \dotsc, p_n$$ with $$n$$ independent observations $$X_1, X_2, \dotsc,X_n$$, there is not much to go on ... but since you have defined the focus (or interest) parameter $$p=\frac1{n}\sum p_i$$, maybe there are some possibiities ... in an applied setting, I would go for any scrap there must be of prior information, build a prior distribution for the $$p_i$$, and go for bayes. But without that: We can estimate $$p$$ with $$\bar{X}_n=\frac1n\sum_i X_i$$, which is unbiased for $$p$$, and is also the maximum likelihood etimator. We can even bound its variance with $$\DeclareMathOperator{\V}{\mathbb{V}} \V \bar{X}_n = (\frac1n)^2 \sum_i p_i(1-p_i) \leq \frac1{4n}$$ which tends to zero when $$n$$ grows without bound, so this estimator is consistent.

Your hypothesis testing problem is more difficult, but you could use, with large $$n$$, the above variance bound to construct a very conservative confidence interval, and invert it to get a test. I'm unsure if we can do much better than that, without getting more information.

But can we do better than this? Let us see if we can define a profile likelihood function. The likelihood function (which in itself will not be very useful here) is $$L(p_1, \dotsc,p_n)=\prod_i p_i^{X_i} (1-p_i)^{1-X_i}$$ which is saturated and the maximized value is always 1. The profile likelihood for $$p=\frac1n \sum_i p_i$$ is $$L_{\text{Prof}}(p) = \sup_{\sum_i p_i=p} L(p_1, \dotsc,p_n)$$ and this will have value 1 only if $$\sum_i p_i =\sum_i X_i$$, else it will be less. Now write $$Y=\sum_i X_i$$, we can show that $$L_{\text{Prof}}(p) = (1-\underline{q})^{n-Y}\bar{q}^Y$$ where $$\underline{q}=\begin{cases} \frac{p-Y/n}{1-Y/n} &\text{if Y/n \leq p}\\ 0 & \text{otherwise} \end{cases} \\ \bar{q}=\begin{cases} 1 & \text{If Y/n \leq p}\\ np/Y & \text{otherwise} \end{cases}$$ Let us look at this for a case with $$n=100, Y=35$$. Then $$\sqrt{\frac1{4 n}}=0.05$$, so our conservative about 95% interval is $$(0.35-0.1,0.35+0.1)$$.

which does not relly lok like a loglikelihood as we know them ... not being differentiable at the maximum, not looking parabolic at least close to the maximum, and contemplating a bit we see that this properties will survive irrespective $$n$$. So we cannot expect to be able to use this like a usual loglikelihood function. For the record, R code for the plot:

lproflik <- function(n, Y) {
Vectorize(function(p) {
qu <- if (Y/n <= p) 1.0 else p/(Y/n)
ql <- if (Y/n <= p) (p-Y/n)/(1-Y/n) else 0.0
(n-Y)*log(1-ql) + Y*log(qu)
} )
}

plot( lproflik(100, 35), from=0.25, to=0.45, col="blue",
main="Profile loglikelihood for p")
abline(h=-qchisq(0.95, 1)/2, col="red")