# Statistical test with different kinds of null hypothesis

Let $X_1$ and $X_2$ be two binomal random variable with respective parameters $n_1$, $p_1$, $n_2$ and $p_2$. Let $x_1$ and $x_2$ be observations of $X_1$ and $X_2$ respectively. I want to try different null hypotheses. If null hypothesis $H_0: p_1=p_2$, we can derive $P(-g(\alpha)<\frac{p_2-p1}{se(p_1-p_2)}<g(\alpha)|H_0)$ easily and check whether is it below $\alpha$ the level of significance ($g(\alpha)=\Phi^{-1}(\alpha/2)$) . But how to do if the null hypothesis is for example $H_0:p2-p1<v$ with $0<v<1$?

Let us reparametrize your problem, I will assume $$X_1$$ and $$X_2$$ are independent (you did not specify). Let $$\theta = p_2-p_1$$ and now $$X_1 \sim \mathcal{Binom}(n_1, p), \quad X_2\sim\mathcal{Binom}(n_2,p+\theta)$$ and the null hypothesis is $$H_0\colon \theta < \nu$$, where $$0<\nu < 1$$ is a prespecified constant. In this formulation, $$\theta$$ is the focus parameter and $$p$$ is incidental. So it is natural to focus on the profile likelihood function of $$\theta$$, profiling out $$p$$.