Finding the $p$-value of a test with exponential data

exponential distributionhypothesis testingp-valueprobabilitystatistics

My problem

Assume that $X$ is exponentially distributed such that $X\in\operatorname{Exp}(\lambda)$.
Let $H_0$ be $\lambda=3$. We want to test $H_0$ against the alternative $H_1$: $\lambda=1$ and reject $H_0$ if we observe a great value $x$ for $X$. Assume that we have observed $x = 0.30$. Determine the p-value of the test.

My attempt of solving the solution

$X \in\operatorname{Exp}(3)$
p-value $= P(X \geq 0.30) = 0.40657$

My question
I think these problems are very difficult, because I am always unsure if I have calculated them correctly.
How do I check that my solution is correct?

Best Answer

Yes. Distribution $\mathsf{Exp}(\lambda=3)$ with mean $1/3$ tends to give smaller values than $\mathsf{Exp}(\lambda=1)$ with mean $1.$ So you are correct to reject $H_0: \lambda = 3$ against $H_0: \lambda=1$ for large observed values $X.$

In particular, the critical value for a test at level 5% is $c = 0.999.$ That is, you would reject $H_0$ for observed $X \ge c.$

c = qexp(.95, 3);  c
[1] 0.9985774

As you say, for observed value $X = 0.30,$ the P-value is $0.466 > 0.05,$ so you do not reject.

1 - pexp(.3, 3)
[1] 0.4065697

If $H_a: \lambda = 1$ is true, then the probability of rejecting based on a single observation is $P(X \ge c\,|\,\lambda=1) = 0.3584.$ With only one observation, it is not surprising to have poor power.

1 - pexp(qexp(.95, 3), 1)
[1] 0.3684031

In the figure below, the critical value $c = 0.999$ is at the vertical red dotted line and the observed value $X = 0.5$ at the solid vertical line.

enter image description here

A test with only one observation may seem counter-intuitive on account of its poor power. By contrast, with $n = 10$ exponential observations, the sample mean has $\bar X_{10}\sim\mathsf{Gamma}(\mathrm{shape}=10, \mathrm{rate}=30)$ under $H_0:\lambda=3$ and $\bar X_{10}\sim\mathsf{Gamma}(10,10)$ under $H_a:\lambda=1.$ These results can be derived using moment generating functions.

Then the critical value for a test at the 5% level is $c=0.523$ and the power of this test using $\bar X_{10}$ as test statistic is about $95.9\%.$

c = qgamma(.95,10,30); c
[1] 0.5235072
1 - pgamma(c, 10, 10)
[1] 0.9588243

The corresponding graph showing null and alternative distributions of $\bar X_{10}$ and the critical value is as follows:

enter image description here

Related Question