# Two sample test for exponential distribution with only two observations

Suppose we have two independent random variables $$X_1 \sim \exp(\lambda_1)$$ and $$X_2 \sim \exp(\lambda_2)$$ .

Now, we are given just one observation each from the two distributions above, say $$S_1$$ and $$S_2$$ respectively. On the basis of these two observed numbers $$S_1$$ and $$S_2$$ , I am interested in testing the following two different hypotheses, viz.

• Null hypothesis $$~~H_0 : ~~\lambda_1 = \lambda_2~~$$ against the alternative hypothesis $$~~H_A : ~~\lambda_1 \neq \lambda_2$$
• Null hypothesis $$~~H_0 : ~~\lambda_1 = \lambda_2~~$$ against the alternative hypothesis $$~~H_A : ~~\lambda_1 < \lambda_2$$

Can someone please suggest appropriate ways to test these two hypotheses at some given level, say $$\alpha\in(0,1)$$ ?

Note : I guess, under the assumption of the null hypothesis (in both the problems), we may play with the random variable $$Z = \frac{X_1}{X_1+X_2}$$ because it'll probably be uniformly distributed. Anyway, I'm unable to think any further. Also, here $$\exp(\lambda)$$ refers to an exponential distribution with parameter $$\lambda$$ .

• How is it possible that the great Kolmogorov doesn't know the asnwer to this question?
– Zen
Nov 15, 2020 at 23:52
• I know the answer. Just testing others' skills. ;)
– JRC
Nov 16, 2020 at 3:19

Consider a likelihood ratio test. Since the likelihood maximizing $$\hat\lambda_0$$, $$\hat\lambda_1$$, $$\hat\lambda_2$$, are respectively $$1/\bar{x}=2/(x_1+x_2)$$, $$1/x_1$$, and $$1/x_2$$, the likelihood ratio $$\Lambda$$ is

\begin{align} \Lambda &= \frac{f_{\hat\lambda_0}(x_1,x_2)}{f_{\hat \lambda_1}(x_1)f_{\hat \lambda_2}(x_2)} \\ &= \frac{\hat\lambda_0^2 e^{-\hat\lambda_0(x_1+x_2)}}{\hat\lambda_1 e^{-\hat\lambda_1x_1} \hat\lambda_2 e^{-\hat\lambda_2x_2}} \\ &= \frac{\hat\lambda_0^2}{\hat\lambda_1 \hat\lambda_2}e^{-\hat\lambda_0(x_1+x_2)+\hat\lambda_1x_1+\hat\lambda_2x_2} \\ &= \frac{x_1x_2}{\bar x^2}e^{-2+1+1} \\ &= \left(\frac{\tilde x}{\bar x}\right)^2 \end{align}

where $$\tilde x$$ is the geometric mean of $$x_1$$ and $$x_2$$.

That gives the rule for the first hypothesis test to reject $$H_0$$ when $$\tilde x/\bar x an appropriate $$c$$. The same rule works for the second test but needs the accompanying condition that $$x_1>x_2$$.

The ratio of geometric to algebraic mean makes intuitive sense since the geometric is always less and only equals the algebraic mean with $$x_1=x_2$$. If the two observations are close, then the null hypothesis looks reasonable and the likelihood ratio will be high. If $$x_1$$ and $$x_2$$ are very different then the geometric mean will be a good deal less than the algebraic mean and the likelihood ratio will be low, indicating that the null hypothesis should be rejected.

This question relates to the more general question Find the distribution of the statistic and the critical region of the generalized test at level $\alpha$ for two sample test, which asks the same question but with samples of potentially different sizes than one.

An answer to that question uses a statistic that follows Fisher's z-distribution. When we apply the same approach to this problem, then that answer simplifies to the use of the statistic $$\log(X_1/X_2)$$ which follows a logistic distribution with scale $$s=1$$ and location $$\mu = \log(\lambda_1/\lambda_2)$$.

So the tests for the hypothesis $$\lambda_1/\lambda_2=1$$ can be tested with the statistic $$\log(X_1/X_2)$$. And the p-values can be computed based on that statistic following a logistic distribution given the null hypothesis. The difference between the first and second case is whether you use a one-tailed or two-tailed test, and changes the p-value by a factor two.